Skip to content

Instantly share code, notes, and snippets.

@timkofu
Last active November 3, 2015 08:33
Show Gist options
  • Save timkofu/a67490c6f437e7d9e4d3 to your computer and use it in GitHub Desktop.
Save timkofu/a67490c6f437e7d9e4d3 to your computer and use it in GitHub Desktop.
Python code to send SMS via the Sematime API
# Code to send SMS via the Sematime API
# API Doc: https://s3.amazonaws.com/api.sematime.com/Sematime+API+Docs.pdf
import json
import requests
def send_message(recipients, message):
user_id = "" # your user id
api_key = "" # your api key
url = "https://api.sematime.com/v1/{}/messages".format(user_id)
headers = {
"ApiKey": api_key,
"Content-Type": "application/json"
}
post_body = json.dumps({
"message": message,
"recipients": ",".join(recipients)
})
return requests.post(
url,
data = post_body,
headers = headers
)
if __name__ == '__main__':
print(send_message(['0722000000','0723000000'], "Hi :)").content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment