From 8975ad314aa82f693dfde8d9341e1e34c96792ce Mon Sep 17 00:00:00 2001 From: Linden Crandall Date: Tue, 21 Jan 2025 23:10:07 +0000 Subject: [PATCH] Update ERPNext SMS Twilio Settings --- ERPNext-SMS-Twilio-Settings.md | 110 ++++++++++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 1 deletion(-) diff --git a/ERPNext-SMS-Twilio-Settings.md b/ERPNext-SMS-Twilio-Settings.md index a643507..1574fff 100644 --- a/ERPNext-SMS-Twilio-Settings.md +++ b/ERPNext-SMS-Twilio-Settings.md @@ -1,2 +1,110 @@ Reference: -[SMS Setting for Twilio](https://discuss.frappe.io/t/sms-setting-for-twilio/28106/18) \ No newline at end of file +[SMS Setting for Twilio](https://discuss.frappe.io/t/sms-setting-for-twilio/28106/18) + + + +# 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: + +- 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” +- Your Auth Token: Right Below your Account SID you should see a field for your Auth Token +- 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. +- 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. + + https://api.twilio.com/2010-04-01/Accounts/ACCOUNTSID/Messages.json + +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: https://api.twilio.com/2010-04-01/Accounts/BB987287ih98209c895d88098eb/Messages.json 6 + +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 https://www.base64encode.org/ 35 and in the Box Labeled “Encode to Base64 format” enter your Account SID then a colon and then the Auth Token like this… + + accountsid:authtoken + +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: + + QkI5ODcyODdpaDk4MjA5Yzg5NWQ4ODA5OGViOmNhR2h4WjVhdmdlOVhmd0h1Y1pxQmxQS3A4OTBzc2FmM2Q= + +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… + +image +image792×348 20.2 KB + +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. +Message + +Next, in the Message Parameter Field, type the word “Body”: + +image +image763×137 7.23 KB + +Receiver + +In the Receiver Parameter field, type the word “To”: + +image +image776×147 6.63 KB + +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 + + +# 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: Hosted Numbers FAQ | Twilio 7 + +Thanks and good luck. \ No newline at end of file