https://github.com/ghvstcode/twillight
Golang SDK for Twilio APIs. https://pkg.go.dev/github.com/Ghvstcode/twillight
https://github.com/ghvstcode/twillight
Last synced: 10 months ago
JSON representation
Golang SDK for Twilio APIs. https://pkg.go.dev/github.com/Ghvstcode/twillight
- Host: GitHub
- URL: https://github.com/ghvstcode/twillight
- Owner: Ghvstcode
- License: mit
- Created: 2020-12-23T07:48:44.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-03T20:19:35.000Z (almost 5 years ago)
- Last Synced: 2025-03-27T21:38:38.227Z (10 months ago)
- Language: Go
- Homepage:
- Size: 104 KB
- Stars: 17
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TWILIGHT 🦅
Twilight is an unofficial Golang SDK for Twilio APIs. Twilight was born as a result of my inability to spell **Twilio** correctly. I searched for a **Twillio** Golang client library and couldn’t find any, I decided to build one. Halfway through building this, I realized I had spelled **Twilio** as **Twillio** when searching for a client library on Github.

### INSTALLATION
To use this in your project, Run the following command
``$ go get -u github.com/Ghvstcode/twilight``
With this project, you can interact with the following Twilio APIs
* SMS API
* Verify API
* Lookup API
### USAGE
The full examples can be found [here](https://github.com/Ghvstcode/twilight/blob/main/examples/main.go)
* To get started with this library, you have to first authenticate. You can do this by calling the NewAuth function and passing your Account SID & Auth Token gotten from your Twilio console.
* Next, You have to create a client for the API you intend to interact with. The created clients implement the interface the core functions require as their first argument
* 5 digit error codes are Twilio errors. 0 error codes are my fault. You could check [here](https://www.twilio.com/docs/api/errors) for a list of all Twilio error codes
This is an example showning how to use this library to send an SMS
```Golang
a := twillight.NewAuth("ACxxxxxxx", "f7xxxxxxxxx")
smsClient := a.NewSmsClient()
res, err := twillight.NewOutgoingMessage(smsClient, "+443566778", "+1543222", "HelloWorld")
if err != nil {
er := err.(*app.ErrorResponse)
fmt.Println("An Error Occured! status Code is", er.ErrorCode())
fmt.Println(err.Error())
}
fmt.Println(res.Status)
```
### Issues & Contributions
* You encountered any issues while using this[Or just want to mess around]? Go ahead and create a new Issue!
* I would love to see this project grow, If you have any contributions or ideas, please let me know! Send in your PR's
### Notes/To-Do
- [ ] Improve Test Coverage
- [ ] Add more API's