Skip to content

Instantly share code, notes, and snippets.

@kelvinndmo
Last active July 6, 2020 07:09
Show Gist options
  • Save kelvinndmo/e23baf8c3555035b46cacd95be050082 to your computer and use it in GitHub Desktop.
Save kelvinndmo/e23baf8c3555035b46cacd95be050082 to your computer and use it in GitHub Desktop.
import africastalking
username = "africa username" # use 'sandbox' for development in the test environment
# use your sandbox app API key for development in the test environment
api_key = "africa's talking api key"
africastalking.initialize(username, api_key)
# # Use the service synchronously
# response = sms.send("Hello Message!", ["+2547xxxxxx"])
# print(response)
# Or use it asynchronously
def on_finish(error, response):
if error is not None:
raise error
# write to the logs
print(response)
numbers = []
def send_sms(message, numbers):
sms = africastalking.SMS
sms.send(message, numbers, callback=on_finish)
message = "Your message goes here"
send_sms(message, numbers)
@Murathe
Copy link

Murathe commented Jan 27, 2020

Should be making use of it soon, thanks.

Also, on the message area, you might need to correct the part of placeholder from ''hoes' to 'goes'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment