Snippets

Team Zoom Python - bulk send using json

Created by Terence Foxcroft
# Post request to bulk send multiple messages using json
# This script makes use of the Requests Library: http://docs.python-requests.org/en/latest/

import json
import requests

email_address = 'YOUR_EMAIL_ADDRESS'
rest_api_token = 'YOUR-API-TOKEN'
base_url = 'https://www.zoomconnect.com/app/api/rest/v1/'

message1 = {}
message1['message'] = 'Test message 1'
message1['recipientNumber'] = '27821234567'

message2 = {}
message2['message'] = 'Test message 2'
message2['recipientNumber'] = '+27821234568'

data = {}
data['sendSmsRequests'] = [message1, message2]
json_data = json.dumps(data)

response = requests.post(base_url + 'sms/send-bulk.json', 
    data=json_data,
    headers={"Content-Type": "application/json"},
    auth=(email_address, rest_api_token))

if (response.ok):
    print 'Response: ' + str(response.json())
else:
    print 'Request failed with response code' + str(response.status_code)

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.