Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

SMS Setting for Twilio

Does any one know how to do sms setting for Twilio in ERPNEXT?

I have not been able to figure out how to do this with the info I have found. I reached out to ERPNext and Twilio for support and not too much came of it. These are the resources I have so far:

I have tried setting https://api.twilio.com/2010-04-01 as the SMS Gateway URL, setting /2010-04-01/Accounts/{AccountSid}/Messages as the Message and Receiver Parameter and replacing {AccountSid} with my SID which can be found here after logging into my Twilio account.

Lastly, I have created the following static parameters with their appropriate values in ERPNext’s SMS’s settings:

  • account_sid
  • auth_token
  • to
  • from

For the to and from parameters, I have entered my registered number with Twilio and the number they provided for me respectively with the following format: +12345678900.

I then go to ERPNext’s SMS Center and under Send To, I have chosen All Contact, for Receiver List I type in the same phone number as in the to parameter above. For Message I write TEST. After saving this and clicking Send SMS, a dialog pops up saying “SMS sent to following numbers: 12345678900”, which is the same number I have entered in the to parameter above.

Though ERPNext registers this in the SMS log, I never receive the SMS on my mobile phone.

@koshish, please let us know what you have tried. Perhaps we can piece it together.

I had to find an sms gateway that provided a http URL as I never managed to get a https URL to work. With plain http ERPNext sms worked correctly. Just make sure your phone numbers are in this format. Example:
Australian international phone code is: 00 61
Australian mobile numbers are formatted 0404 123 123.
You need to format your numbers as : 61404123123

Working solution:

The Gateway URL is https://api.twilio.com/2010-04-01/Accounts/<Account SID>/Messages.json

2 Likes

@Iguana_Dev could you please elaborate on parameters.

My messages are not going.

I worked out the twilio settings.
The Gateway URL is
https://api.twilio.com/2010-04-01/Accounts//Messages.json

Message Parameter
Body

Receiver Parameter
To

Static parameters
Parameter
Authorization
Value
Basic + “your key:value pair base64encoded” You can do this here https://www.base64encode.org/
header checked

Parameter
From
Value
Your twilio phone number properly formatted

Parameter
Content-Type
Value
application/x-www-form-urlencoded
header checked

Hopefully this helps

1 Like

@MarZah thanks for the suggestions.

I have followed your steps still getting below erroe:
requests.exceptions.HTTPError: 401 Client Error: UNAUTHORIZED for url: https://api.twilio.com/2010-04-01/Accounts/my account SID/Messages.json

First test your credentials using twilios curl example.
If it works there then you have not properly base64 encoded your authorization key:value pair
In your static parameters
Parameter
Authorization

Value
Basic space <base64 encoded key:value pair>

thanks @MarZah i will check.

@MarZah I have tried using curl but getting below error. i have mentioned proper TO phone number.

{
“code”: 21604,
“message”: “A ‘To’ phone number is required.”,
“status”: 400
}

The error message is clear. I suggest reading through twilios examples of the proper phone number format