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 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.

1 Like

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<Account SID>/Messages.json


@Iguana_Dev could you please elaborate on parameters.

My messages are not going.

I worked out the twilio settings.
The Gateway URL is

Message Parameter

Receiver Parameter

Static parameters
Basic + “your key:value pair base64encoded” You can do this here
header checked

Your twilio phone number properly formatted

header checked

Hopefully this helps


@MarZah thanks for the suggestions.

I have followed your steps still getting below erroe:
requests.exceptions.HTTPError: 401 Client Error: UNAUTHORIZED for url: 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

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

Worked perfectly, thank you very much!

Can you please elaborate on Value
Basic space <base64 encoded key:value pair>

I have updated settings as below:

In the Authorization Parameter the Value is entered as "Basic " Header checked

@MarZah any help pls

can you please elobrate basic64 encoded key:value pair?

Hello Sir,

Mujhe Twilio aur ERPNext integration chahiye. If any customer Call on a given number Lead will create it automatically in ERPNext.
Can u help me in this all process from scratch.

Thanks in advance,

can u help me for Twilio Integration with ERPNext from Scratch.

Thanks in advance,

@Dwarkanath_Bari, @RAHUL_JADHAV, @Aditya_Bagarka and for those still struggling to get this working, I will try to provide a clear explanation in the context of a US based implementation. I will use example values to help make it a bit more clear which information to use, where to put it and how to implement it in the interface. Some of the concepts can be confusing and if unfamiliar with API’s and certain terms, working through this for your situation can be frustrating and difficult. Hopefully this will clear up a few things for you and get you on your way to tapping into the true power of the ERPNext Platform…

Step 1: Gather Information

Before configuring something, it’s always a good idea to understand what information is needed and to gather it ahead of time. So let’s start with a list of the pieces of information you need to gather first:

  1. Your Twilio Account SID. This can be found by logging into Twilio, choosing the Account you are going to use for your text messages and looking on the main account screen for “ACCOUNT SID”
  2. Your Auth Token: Right Below your Account SID you should see a field for your AuthToken
  3. Phone number you will be sending “From” in the correct format. For the US, that looks like the following: +11234567890 Where the first two characters “+1” is the country code.
  4. The Gateway URL: This is the API “Endpoint” that Twilio provides and can be found by going to “Messaging > Try it out > Send an SMS” in the right you will see a url that looks like the following…Copy this piece of information.

Now that you’ve gathered that information, let’s use an example to make it clear how this works.

Example using fake data:

Account SID: BB987287ih98209c895d88098eb
Auth Token: caGhxZ5avge9XfwHucZqBlPKp890ssaf3d
Phone Number: +11234567890
Gateway URL:

Now that we have this information above, the next step is to generate the “Base64 Encoded” value, which is made up of your Account SID and the Auth Token in the following format: AccountSID:AuthToken.

Let’s browse to and in the Box Labeled “Encode to Base64 format” enter your Account SID then a colon and then the Auth Token like this…


Here’s what it looks like with our fake data above:

Okay, now that we have that information, click the the ENCODE Button and then copy the entire result from the box below the Encode Button:

So in our example, we now have a Base64 encoded string we can add to the list of information we need to configure our SMS Settings in ERPNext:


Now, what do we do with this information above? We add one little Word plus a space:

Basic QkI5ODcyODdpaDk4MjA5Yzg5NWQ4ODA5OGViOmNhR2h4WjVhdmdlOVhmd0h1Y1pxQmxQS3A4OTBzc2FmM2Q=

Step 2: Configure SMS Settings

Now that we’ve gathered all the pieces of information, let’s go into ERP Next and add this information, along with a few other pieces describe already in this thread. We will go step by step.

Log into your ERPNext Instance. Search for “SMS Settings” in the search bar and click on the “SMS Settings” result. This will bring you to the SMS settings screen.

SMS Gateway URL

Copy the SMS Gateway URL into the box labeled SMS Gateway URL, like this…

As you can see we copied our Gateway url with our Account SID as documented above.

Note: The wrapping of the text in the image above is done automatically based on the box and is not actually a break. DO NOT ADD a carriage return. Just copy and paste and move on.


Next, in the Message Parameter Field, type the word “Body”:


In the Receiver Parameter field, type the word “To”:

Static Parameters

Now we need to add our “Static Parameters” one by one. For the next screen shots, I will be clicking on the “Edit” icon for each row of the Static Parameters table to show you the individual row settings.

VALUE 1: Authorization

Let’s start with the first parameter, the “Authorization” parameter. For this we are going to use the “Basic BASE64ENCODEDACCOUNTSID:AUTHTOKEN” string that we created above. So that looks like the following:

Note, in the “Value” field in the picture above, you do not see the entire string, but you want to make sure you copy and paste the entire string, which in our example was this value:

Basic QkI5ODcyODdpaDk4MjA5Yzg5NWQ4ODA5OGViOmNhR2h4WjVhdmdlOVhmd0h1Y1pxQmxQS3A4OTBzc2FmM2Q=

VALUE 2: From

Next, we’re going to add the phone number that we are using from our Twilio account to send the text messages. So click “Add Row” if you do not already have another row in the Static Parameters field and fill in the details as such:

VALUE 3: Content-Type

Finally, we add another row for the last value we need which is “Content-Type” like so…

Use Post and All Together Now

Before saving we need to make sure the “Use Post” checkbox is “Checked” and then we can click save. So putting it all together with our sample data, your setup should look similar to the following screen shot:

Step 3: Testing, Testing, 1…2…3

To make sure all is working, we can test by using the “SMS Center” which we can get to by searching in the search bar and selecting it. Once we are there:

  • Enter a mobile number to send a message to in the “Receiver List”
  • Type a “Message” in the message box on the right and then
  • Click the “Send SMS” button

That’s it. I hope this detailed walk-through helped folks figure this out for Twilio. If you’re still having issues, most likely it’s a problem with your Twilio setup. Make sure the number you’re using is enabled for sending SMS messages.

Please consult the Twilio documentation, which is very good, regarding SMS enabled numbers:

Thanks and good luck.


Thank you for that… worked perfectly, first try… which is something for myself.
Likely one of the most thorough help articles that I have found… was almost suprised when my phone sounded off with a text message after hitting send in ERPnext.
I have looked for further info on recieving message responses through twilio to ERPnext… and have not found definitive help.
Would you be able to shed some light on the topic?

Hello @plumber I believe at the moment, ERPNext has out of the box support for sending, not receiving. You could probably use Webhooks to push incoming messages from Twilio to ERPNext. Not sure if someone has already done that before, maybe someone viewing this response could offer suggestions?