Django | twilio to send SMS
Posted
by MMRUser
on Stack Overflow
See other posts from Stack Overflow
or by MMRUser
Published on 2010-05-19T05:59:35Z
Indexed on
2010/05/19
7:00 UTC
Read the original article
Hit count: 444
I'm using twilio as for a mobile verification mechanism, I have no prior experience in using twilio but looking at the sample PHP code I used this one in my code but apparently it's giving me an 400 Bad request
HTTP error. Here's the code:
d = {
'TO' : '*** *** ****',
'FROM' : '415-555-1212',
'BODY' : 'Hello user, please verify your device using this code %s' % verNumber
}
try:
print account.request('/%s/Accounts/%s/SMS/Messages' % \
(API_VERSION, ACCOUNT_SID), 'POST', d)
except Exception, e:
return HttpResponse('Error %s' % e)
verNumber
is randomly generated and the receiver's number is validated in twilio.
Thanks.
© Stack Overflow or respective owner