The unofficial Go helper library for Twilio.
go get github.com/carlosdp/twiliogo
package main
import (
"fmt"
twilio "github.com/carlosdp/twiliogo"
)
func main() {
client := twilio.NewClient("<ACCOUNT_SID", "<AUTH_TOKEN>")
message, err := twilio.NewMessage(client, "3334445555", "2223334444", twilio.Body("Hello World!"))
if err != nil {
fmt.Println(err)
} else {
fmt.Println(message.Status)
}
}
package main
import (
"fmt"
twilio "github.com/carlosdp/twiliogo"
)
func main() {
client := twilio.NewClient("<ACCOUNT_SID>", "<AUTH_TOKEN>")
call, err := twilio.NewCall(client, "8883332222", "3334443333", nil)
if err != nil {
fmt.Println(err)
} else {
fmt.Println("Call Queued!")
}
}
- Calls
- Messages
- IncomingPhoneNumbers (partial)
Tests can be run using go test
, as with most golang projects. This project also contains integration tests (where they can be done non-destructively using the API or the working Test Credential endpoints).
These integration tests can be run by providing the necessary environment variables to access the API, as in this Makefile:
test:
@export API_KEY="<API KEY>";\
export API_TOKEN="<API TOKEN>";\
export TEST_KEY="<TEST KEY>";\
export TEST_TOKEN="<TEST TOKEN>";\
export TEST_FROM_NUMBER="<DEFAULT TEST CRED NUMBER>";\
export FROM_NUMBER="<TEST FROM NUMBER>";\
export TO_NUMBER="<TEST TO NUMBER>";\
go test -v
This is a side project meant to allow for quick adoption of the Twilio API for those programming web applications with it in Go. Feel free to submit pull requests so that we can cover all of the features the Twilio API has to offer!
Here are a few things that the project needs in order to reach v1.0:
- Complete test coverage. Right now, tests cover the bare minimum of usage for each feature implemented.
- Complete IncomingPhoneNumber functionality.
- Implement the following resources:
- AvailablePhoneNumbers
- OutgoingCallerIds
- Applications
- ConnectApps
- AuthorizedConnectApps
- Conferences
- Queues
- Short Codes
- Recordings
- Transcriptions
- Notifications
- SIP Domains
- IpAccessControlLists
- CredentialLists
- Usage Records
- Usage Triggers
This project is licensed under the MIT License