Skip to content

Instantly share code, notes, and snippets.

@labohkip81
Forked from kelvinndmo/sendtext.py
Created January 26, 2020 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save labohkip81/2863e6d1c6f43fea0e8523eeb9bbc6c1 to your computer and use it in GitHub Desktop.
Save labohkip81/2863e6d1c6f43fea0e8523eeb9bbc6c1 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 hoes here"
send_sms(message, numbers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment