You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
932 B
34 lines
932 B
7 years ago
|
#!/usr/bin/env python
|
||
|
|
||
|
import pprint
|
||
|
import os
|
||
|
import json
|
||
|
import random
|
||
|
import string
|
||
|
from flowroutenumbersandmessaging.flowroutenumbersandmessaging_client import FlowroutenumbersandmessagingClient
|
||
|
|
||
|
basic_auth_user_name = os.environ.get('FR_ACCESS_KEY')
|
||
|
basic_auth_password = os.environ.get('FR_SECRET_KEY')
|
||
|
|
||
|
mobile_number = os.environ.get('TO_NUMBER')
|
||
|
from_number = os.environ.get('FROM_NUMBER')
|
||
|
|
||
|
# Instantiate API client and create controllers for Messages
|
||
|
client = FlowroutenumbersandmessagingClient(basic_auth_user_name, basic_auth_password)
|
||
|
messages_controller = client.messages
|
||
|
|
||
|
request_body = '{ \
|
||
|
"data": { \
|
||
|
"type": "message", \
|
||
|
"attributes": { \
|
||
|
"to": "' + str(mobile_number) + '", \
|
||
|
"from": "' + str(from_number) + '", \
|
||
|
"body": "Try me", \
|
||
|
"is_mms": "false" \
|
||
|
} \
|
||
|
} \
|
||
|
}'
|
||
|
|
||
|
print ("---Send A Message")
|
||
|
result = messages_controller.send_a_message(request_body)
|
||
|
pprint.pprint(result)
|