SMS integration - issue with auth

Hi All,
I am trying to integrate twilio with erpnext for sending SMS. It fails due to the auth issue
Below is frappe code where it fails link
gateway_url = https://[API KEY]:[TOKEN][API KEY]/Messages.json
headers = {u’From’: u’+1234567890’, u’Accept’: u’text/plain, text/html, /‘}
params = {u’Body’: ‘Example Message’, u’To’: u’91987654321’}
response =, headers=headers, data=params)
This fails with following error

‘HTTPError: 400 Client Error: BAD REQUEST for url’

To make it work, auth has to be corrected , following code worked
gateway_url=‘[API KEY]/Messages.json’
data = [(‘To’,‘+91987654321’),(‘From’,‘+1234567890’),(‘Body’,‘Success Test’),]

response =,data=data, auth=([API KEY],[TOKEN]))

To things required is To number has to have ‘+’ and auth to be passed to

My question, (a) How can i override of frappe link from my custom app
(b) Is there any way to correct frappe’s

@revant_one, any suggestions?! thanks


Try stringify the post params instead of sending dict.

Also add header for content type x-www-form-urlencoded if necessary.

1 Like

Greetings, I have successfully bought an SMS enabled number and SMS credit from Twilio.
Now I’m failing to integrate as I’m not sure what to fill out at SMS Settings in ERPNext. [Newbie]

Welcome to ERPNext,

These may help

@clarkej I tried following the tutorial and this is what happens. There is no even an error of SMS sending attempt on my Twilio dashboard but ERPNext has logged that an SMS has been sent.

See attached.

@jayfiro did you end up managing to implement Twilio?
@System19 You mentioned you switched providers, mind sharing which one is it?

To troubleshoot, access to report logs on either end will give clues and eliminate guesswork!

HI @ashish-greycube may you share SMS settings Twilio.?