Jusibe API Go package
A Go package which wraps Jusibe API
// Create the Jusibe Configuration. Note that your AccessToken and PublicKey are required
cfg := &jusibe.Config{
PublicKey: os.Getenv("JUSIBE_PUBLIC_KEY"),
AccessToken: os.Getenv("JUSIBE_ACCESS_TOKEN"),
}
// Create the client
j, err := jusibe.New(cfg)
if err != nil {
log.Fatal(err)
}
// Send SMS
to, from, message := "08000000000000", "Azeez", "Hello World"
smsResponse, _, err := j.SendSMS(context.Background(), to, from, message)
if err != nil {
log.Fatal(err)
}
// Check Delivery Status
deliveryResponse, _, err := j.CheckSMSDeliveryStatus(context.Background(), smsResponse.MessageID)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", deliveryResponse)
// Send Bulk SMS
to, from, message := "08000000000000,08050000000,08090000000", "Azeez", "Hello World"
bulkSMSResponse, _, err := j.SendBulkSMS(context.Background(), to, from, message)
if err != nil {
log.Fatal(err)
}
// Check Bulk SMS Status
status, _, err := j.CheckBulkSMSStatus(context.Background(), bulkSMSResponse.BulkMessageID)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", status)
// Get SMS credits
creditsResponse, _, err := j.CheckSMSCredits(context.Background())
if err != nil {
log.Fatal("err")
}
fmt.Printf("%+v\n", creditsResponse)
To contribute to this work:
- Fork it here
- Create your feature branch
git checkout -b my-new-feature
- Commit your changes
git commit -am 'Add some feature'
- Push to the branch
git push origin my-new-feature
- Create a Pull Request
The package is available as open source under the terms of the MIT License.