Skip to content

azeezolaniran2016/jusibe-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jusibe-go

Build Status codecov

Jusibe API Go package

A Go package which wraps Jusibe API

Usage

// 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)

Contributing

To contribute to this work:

  1. Fork it here
  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 a Pull Request

or create an issue

License

The package is available as open source under the terms of the MIT License.