Skip to content

Instantly share code, notes, and snippets.

@kelvinndmo
Created August 26, 2019 17:42
Show Gist options
  • Save kelvinndmo/b5e6c3a2f4cdc375a346224a9d1e4165 to your computer and use it in GitHub Desktop.
Save kelvinndmo/b5e6c3a2f4cdc375a346224a9d1e4165 to your computer and use it in GitHub Desktop.
import africastalking
username = "sandbox" # use 'sandbox' for development in the test environment
# use your sandbox app API key for development in the test environment
api_key = "f873c8ed57eba5f24617beed4ea843449e2f48a12f4f0bece742d6faae1203a2"
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
print(response)
numbers = ['+254799935239']
def send_sms(message, numbers):
sms = africastalking.SMS
sms.send(message, numbers, callback=on_finish)
send_sms('Heello there am novak', numbers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment