github.com/subosito/twilio@v0.0.1/README.md (about) 1 # Twilio 2 3 [](https://travis-ci.org/subosito/twilio) 4 5 Simple Twilio API wrapper in Go. 6 7 ## Usage 8 9 As usual you can `go get` the twilio package by issuing: 10 11 ```bash 12 $ go get github.com/subosito/twilio 13 ``` 14 15 Then you can use it on your application: 16 17 ```go 18 package main 19 20 import ( 21 "fmt" 22 "github.com/subosito/twilio" 23 ) 24 25 func main() { 26 // Common stuffs 27 AccountSid := "ac650108548e09aC2eed18ddb850c20b9" 28 AuthToken := "2ecaf74387cbb28456aad6fb57b5ad682" 29 from := "+15005550006" 30 to := "+62801234567" 31 callbackUrl := "http://subosito.com/" 32 33 // Initialize twilio client 34 t := twilio.NewTwilio(AccountSid, AuthToken) 35 36 // You can set custom Transport, eg: you're using `appengine/urlfetch` on Google's appengine 37 // c := appengine.NewContext(r) // r is a *http.Request 38 // t.Transport = &urlfetch.Transport{Context: c} 39 40 // Send SMS 41 params := twilio.SMSParams{StatusCallback: callbackUrl} 42 s, err := t.SendSMS(from, to, "Hello Go!", params) 43 44 // or, make a voice call 45 // params := twilio.CallParams{Url: callbackUrl} 46 // s, err := t.MakeCall(from, to, params) 47 48 if err != nil { 49 fmt.Println(err) 50 return 51 } 52 53 fmt.Printf("%+v\n", s) 54 return 55 } 56 ``` 57 58 ## Resources 59 60 Documentation: http://godoc.org/github.com/subosito/twilio 61