Africas Talking.
A fast lightweight and minimalist wrapper around the Africas Talking api
Installation
Add this line to your application's Gemfile:
gem 'africas_talking'
And then execute:
$ bundle
Or install it yourself as:
$ gem install africas_talking
Setup
Obtain a Client ID and Secret
- Go to Africas Talking website. (https://account.africastalking.com/register)
- In the sidebar on the left, select Settings > Api Key
- If you haven't generated your key already, generate a new api key credentials by clicking Generate My Api Key
Usage
Sending a message
AfricasTalking::Message.new.deliver(recipients, , username)
Recipients: This are the numbers that you want to send to, If you want to send to many people delimit the numbers using commas(',') for example: "0700000000, 0710000000, 0720000000"
Message: This is the message content A message is by default 160 characters If your message is 161-320 it will be sent as two messages and so on
Username: This is your username on AfricasTalking.com [If you do not have one signup and use it to send messages]
Sending message using sender id or shortcode parameter
AfricasTalking::Message.new.deliver_with_shortcode(recipients, , from, username)
Specify your AfricasTalking shortCode or sender id, sender = "shortCode or senderId"
Enqueue messages
AfricasTalking::Message.new.()
Enqueue flag is used to queue messages incase you are sending a high volume.
sender = nil # sender = "shortCode or sender id" bulkSMSMode = 1 # This should always be 1 for bulk messages The default value for enqueue is 0.
So as to send/enqueue a message, build a hash with the following options: "", message: "", sender: "", enqueue: "", bulkSMSMode: "", username: ""
Contributing
- Fork it ( https://github.com/[my-github-username]/africas_talking/fork )
- 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 new Pull Request