Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chrisenytc/twilio
A golang package for the twilio cloud telephone service API
https://github.com/chrisenytc/twilio
Last synced: 3 months ago
JSON representation
A golang package for the twilio cloud telephone service API
- Host: GitHub
- URL: https://github.com/chrisenytc/twilio
- Owner: chrisenytc
- License: mit
- Archived: true
- Created: 2016-02-10T08:09:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-06T23:42:10.000Z (over 8 years ago)
- Last Synced: 2024-06-20T23:56:06.359Z (5 months ago)
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-twilio-golang - chrisenytc/twilio
README
# Twilio
> A golang package for the twilio www.twilio.com cloud telephone service API. This package supports initiating calls, sending SMS and generating TwiML.
## Getting Started
1º Install twilio
```bash
$ go get github.com/chrisenytc/twilio
```## How to Use
Example with Twilio Rest API:
```go
package mainimport (
"fmt""github.com/chrisenytc/twilio/twirest"
)func main() {
// Test account Sid/Token
accountSid := "enter your account sid"
authToken := "enter your auth token"client := twirest.NewClient(accountSid, authToken)
msg := twirest.SendMessage{
Text: "Hello monkey",
To: "+15005550001",
From: "+15005550005"}resp, err := client.Request(msg)
if err != nil {
fmt.Println(err)
return
}fmt.Println(resp.Message.Status)
}
```Example with TwiML:
```go
package mainimport (
"net/http""github.com/chrisenytc/twilio/twiml"
)func helloMonkey(w http.ResponseWriter, r *http.Request) {
callers := map[string]string{"+15005550001": "Langur"}
resp := twiml.NewResponse()
r.ParseForm()
from := r.Form.Get("From")
caller, ok := callers[from]msg := "Hello monkey"
if ok {
msg = "Hello " + caller
}resp.Action(twiml.Say{Text: msg},
twiml.Play{Url: "http://demo.twilio.com/hellomonkey/monkey.mp3")
resp.Send(w)
}func main() {
http.HandleFunc("/", helloMonkey)
http.ListenAndServe(":8080", nil)
}
```## Contributing
Bug reports and pull requests are welcome on GitHub at [https://github.com/chrisenytc/twilio](https://github.com/chrisenytc/twilio). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
1. Fork it [chrisenytc/twilio](https://github.com/chrisenytc/twilio/fork)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am "Add some feature"`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request## Support
If you have any problem or suggestion please open an issue [here](https://github.com/chrisenytc/twilio/issues).## Credits
This is a fork of the project [ckvist/twilio](https://bitbucket.org/ckvist/twilio). Give some respect to him.## License
Check [here](LICENSE).