Created
July 31, 2013 16:31
-
-
Save callemall/6123645 to your computer and use it in GitHub Desktop.
The following example invites a phone number to join the text messaging group identified by the keyword "RAMBLES". The SendOptInvitation function is used for this purpose.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# The suds SOAP client is not included in the default Python | |
# distribution and must be installed manually either by manual | |
# download or easy_install. | |
from suds.client import Client | |
url = 'http://staging-api.call-em-all.com/webservices/ceaapi_v2.asmx?WSDL' | |
# If access to CEA is via proxy define the following and | |
# use as an option in the Client call | |
#- proxyOpts = dict() | |
#- proxyOpts['http'] = 'http://proxy.domain.com:3128' | |
#- client = Client(url, proxy=proxyOpts) | |
client = Client(url) | |
# Create a factory based on the WSDL | |
request = client.factory.create('SendOptInvitationRequestType') | |
# Setup the factory based on the WSDL specs | |
request.username = 99919991 | |
request.pin = 9991 | |
request.firstName = "PersonTo" | |
request.lastName = "Invite" | |
request.invitePhonenumber = "9725551212" | |
request.keyword = "RAMBLES" | |
request.message = "Follow instructs to join my group!" | |
result = client.service.SendOptInvitation(request) | |
if result.errorCode > 0: | |
print "Request Failed" | |
print result.errorCode | |
print result.errorMessage | |
print result.response | |
print result.keyword | |
print result.message | |
else: | |
print "Request Sent Successfully" | |
print result.errorCode | |
print result.errorMessage | |
print result.response | |
print result.keyword | |
print result.message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment