HTTP based SMS gateway for SMS notifications

1,117 views
Skip to first unread message

jyotshna

unread,
Apr 25, 2012, 9:13:07 AM4/25/12
to pwm-general
Hi,

I am trying to use Twilio sandbox user account for SMS notifications
and I am unable to receive SMS notifications after configuring all the
parameters on SMS settings page. Just wondering if any one has used
Twilio Rest API for configuring SMS gateway. Any help is greatly
appreciated.

Thanks in advance
Regards
Jyotshna

Menno Pieters

unread,
Apr 25, 2012, 2:59:39 PM4/25/12
to pwm-g...@googlegroups.com
Hi,

It's the first time I've heard about Twilio, but reading the docs, I think you should configure it like:

  • Gateway URL: http://www.twilio.com/2010-04-01/Accounts/{AccountSid}/SMS/Messages
    (replace the {AccountSid})
  • SMS User and Password: leave empty
  • HTTP(S) Method: leave empty
  • SMS Sender ID: your phone number in international format like +31612345678
  • SMS Gateway Authentication Method: Request
  • SMS Request Data:

From=%SENDERID%&To=%TO%&Body=%MESSAGE%

  • SMS Data Content Type: application/x-www-form-urlencoded
  • SMS Data Encoding: POST with form data
  • SMS Phone Number Format: Plus

Let me know if that works. It would make a nice example for the documentation.

- Menno


Jyotshna

--
You received this message because you are subscribed to the Google Groups "pwm-general" group.
To post to this group, send email to pwm-g...@googlegroups.com.
To unsubscribe from this group, send email to pwm-general...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pwm-general?hl=en.


Anson

unread,
Apr 25, 2012, 9:05:34 PM4/25/12
to pwm-g...@googlegroups.com
Actually, the docs indicate you should provide your Twilio credentials via Basic Auth, e.g.:  
https://{AccountSid}:{AuthToken}@api.twilio.com/2010-04-01/Accounts/{AccountSid}/SMS/Messages

I'm interested to know how this turns out as well.  

Cheers,
-Anson


On Wednesday, April 25, 2012 1:59:39 PM UTC-5, Menno wrote:
Hi,

It's the first time I've heard about Twilio, but reading the docs, I think you should configure it like:

  • Gateway URL: http://www.twilio.com/2010-04-01/Accounts/{AccountSid}/SMS/Messages
    (replace the {AccountSid})
  • SMS User and Password: leave empty
  • HTTP(S) Method: leave empty
  • SMS Sender ID: your phone number in international format like +31612345678
  • SMS Gateway Authentication Method: Request
  • SMS Request Data:

From=%SENDERID%&To=%TO%&Body=%MESSAGE%

  • SMS Data Content Type: application/x-www-form-urlencoded
  • SMS Data Encoding: POST with form data
  • SMS Phone Number Format: Plus

Let me know if that works. It would make a nice example for the documentation.

- Menno


On Wed, Apr 25, 2012 at 3:13 PM, jyotshna <jyot...@gmail.com> wrote:
Hi,

I am trying to use Twilio sandbox user account for SMS notifications
and I am unable to receive SMS notifications after configuring all the
parameters on SMS settings page. Just wondering if any one has used
Twilio Rest API for configuring SMS gateway. Any help is greatly
appreciated.

Thanks in advance
Regards
Jyotshna

--
You received this message because you are subscribed to the Google Groups "pwm-general" group.
To post to this group, send email to pwm-g...@googlegroups.com.
To unsubscribe from this group, send email to pwm-general+unsubscribe@googlegroups.com.

Menno Pieters

unread,
Apr 26, 2012, 2:11:32 AM4/26/12
to pwm-g...@googlegroups.com
On Thu, Apr 26, 2012 at 3:05 AM, Anson <hent...@gmail.com> wrote:
Actually, the docs indicate you should provide your Twilio credentials via Basic Auth, e.g.:  
https://{AccountSid}:{AuthToken}@api.twilio.com/2010-04-01/Accounts/{AccountSid}/SMS/Messages

I'm interested to know how this turns out as well.  

You don't have to add the {AccountSid}:{AuthToken}@ to the URL. Instead actually fill in the username and password fields in the configuration and select Basic for the authentication method. That should do it.

Regards,

Menno

 
To view this discussion on the web visit https://groups.google.com/d/msg/pwm-general/-/UJfufz4t9hIJ.

To post to this group, send email to pwm-g...@googlegroups.com.
To unsubscribe from this group, send email to pwm-general...@googlegroups.com.

jyotshna

unread,
Apr 26, 2012, 11:35:19 AM4/26/12
to pwm-general
Hi MEnno,

I am unable to receive SMS on my device with the below configured
settings on PWM.

sms.userSmsAttribute=telephoneNumber
sms.gatewayURL=https://api.twilio.com/2010-04-01/Accounts/ACxxx/SMS/
Messages.xml
sms.gatewayUser=ACxxx
sms.gatewayPassword=**removed**
sms.gatewayAuthMethod=HTTP
sms.requestData={"":"From\u003d%2B14155992671\u0026To
\u003d9413219441\u0026Body\u003dtwilio+testing+9"}
sms.maxTextLength=160
sms.senderID=+1415xxxx
sms.phoneNumberFormat=PLUS

where ACXX is my Twilio Account ID.

I also see in the logs that the SMS request has been sent but it
doesn't seem to be delivered.

2012-04-26 11:31:16, TRACE, servlet.ForgottenPasswordServlet, {4g}
successful validation of ldap value for 'sn' [192.168.4.65]
2012-04-26 11:31:16, DEBUG, servlet.ForgottenPasswordServlet, {4g}
generated token code for session: CCCRXLGQB7Q5TE4R [192.168.4.65]
2012-04-26 11:31:16, DEBUG, servlet.ForgottenPasswordServlet, {4g}
token SMS added to send queue for 9413219441 [192.168.4.65]
2012-04-26 11:31:17, TRACE, util.SmsQueueManager, SMS data: From=
%2B1415xxx&To=9413219441&Body=twilio+testing+9
2012-04-26 11:31:17, INFO , util.SmsQueueManager, SMS sent

Thanks
Jyotshna


On Apr 25, 2:59 pm, Menno Pieters <menno.piet...@gmail.com> wrote:
> Hi,
>
> It's the first time I've heard about Twilio, but reading the docs, I think
> you should configure it like:
>
>    - Gateway URL:http://www.twilio.com/2010-04-01/Accounts/*{AccountSid}*
>    /SMS/Messages
>    (replace the {AccountSid})
>    - SMS User and Password: leave empty
>    - HTTP(S) Method: leave empty
>    - SMS Sender ID: your phone number in international format like
>    +31612345678
>    - SMS Gateway Authentication Method: Request
>    - SMS Request Data:
>
> From=%SENDERID%&To=%TO%&Body=%MESSAGE%
>
>    - SMS Data Content Type: application/x-www-form-urlencoded
>    - SMS Data Encoding: POST with form data
>    - SMS Phone Number Format: Plus
>
> Let me know if that works. It would make a nice example for the
> documentation.
>
> - Menno
>

Menno Pieters

unread,
Apr 26, 2012, 4:01:38 PM4/26/12
to pwm-g...@googlegroups.com
On Thu, Apr 26, 2012 at 5:35 PM, jyotshna <jyotshna....@gmail.com> wrote:
Hi MEnno,

I am unable to receive SMS on my device with the below configured
settings on PWM.

sms.userSmsAttribute=telephoneNumber
 sms.gatewayURL=https://api.twilio.com/2010-04-01/Accounts/ACxxx/SMS/
Messages.xml

 sms.gatewayUser=ACxxx
 sms.gatewayPassword=**removed**
 sms.gatewayAuthMethod=HTTP
 sms.requestData={"":"From\u003d%2B14155992671\u0026To
\u003d9413219441\u0026Body\u003dtwilio+testing+9"}
 sms.maxTextLength=160
 sms.senderID=+1415xxxx
 sms.phoneNumberFormat=PLUS

where ACXX is my Twilio Account ID.


OK, first of all checkout the LATEST svn release... I just fixed some issues with the authentication.

I have it working, basically with the config above, except that is now complains that I have to pay in order to send overseas.... Note that the password is not your normal account password, but  a special authentication token that you can retrieve from your dashboard.

To debug a bit better, set the Response Regular Expressions to ^.*$. This accepts anything, but will log the response from the web service. When you have to running correctly, change it into a proper regex that actually checks the response.

Regards,

Menno

jyotshna

unread,
Apr 26, 2012, 4:31:10 PM4/26/12
to pwm-general
Can you please let me know how to build the war file. I am completely
new to this project and was only deploying .war files until now.

Regards
Jyotshna

On Apr 26, 4:01 pm, Menno Pieters <menno.piet...@gmail.com> wrote:
> On Thu, Apr 26, 2012 at 5:35 PM, jyotshna <jyotshna.cheruk...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > Hi MEnno,
>
> > I am unable to receive SMS on my device with the below configured
> > settings on PWM.
>
> > sms.userSmsAttribute=telephoneNumber
> >  sms.gatewayURL=https://api.twilio.com/2010-04-01/Accounts/ACxxx/SMS/
> > Messages.xml<https://api.twilio.com/2010-04-01/Accounts/ACxxx/SMS/%0AMessages.xml>

Menno Pieters

unread,
Apr 26, 2012, 4:46:03 PM4/26/12
to pwm-g...@googlegroups.com
On Thu, Apr 26, 2012 at 10:31 PM, jyotshna <jyotshna....@gmail.com> wrote:
Can you please let me know how to build the war file. I am completely
new to this project and was only deploying .war files until now.

Easy: check out the code (instructions on google code). Go to trunk/pwm/servlet and run "ant". You'll find pwm.war in the build directory. I usually put my existing PwmConfiguration.xml in trunk/pwm/servlet/web/WEB-INF before building.

Menno
 

bec...@adelphi.edu

unread,
May 31, 2013, 4:14:41 PM5/31/13
to pwm-g...@googlegroups.com
On Thursday, April 26, 2012 2:11:32 AM UTC-4, Menno wrote:
> On Thu, Apr 26, 2012 at 3:05 AM, Anson <hent...@gmail.com> wrote:
>
>
> Actually, the docs indicate you should provide your Twilio credentials via Basic Auth, e.g.:  
> https://{AccountSid}:{AuthToken}@api.twilio.com/2010-04-01/Accounts/{AccountSid}/SMS/Messages
>
>
>
>
> I'm interested to know how this turns out as well.  
>
> You don't have to add the {AccountSid}:{AuthToken}@ to the URL. Instead actually fill in the username and password fields in the configuration and select Basic for the authentication method. That should do it.
>
>
>
> Regards,
>
> Menno
>

I have my pwm SMS config set according to the suggestions here, but what happens is the token looks like it's been encoded. The result is I see a bunch of gibberish coming over the SMS gateway:

Sent from your Twilio trial account - Your activation token is H4sIAAAAAAAAAAEQAe_-1fzll9FRfwVD0QIR4tduDwI4DnE_Mwfakk_ZumP vNvKP01i4RSlsSeHH7jx3Q-9i8GZwQ8U-Ke 4:08 PM
Sent from your Twilio trial account - KTDvZkRaf9tWRTHlpEMcznoc KsNlhxnkIRIcd_A4HttR404zNpagAThAtnDsYewuvUuFwlHp16-KFQPpv7n oP3S8wxpUY7tug3RcxeJvN3eCVAswE4aPoQ 4:08 PM
Sent from your Twilio trial account - 1t24PkHPR6gIfig4EtKeD4tT i3OeEeE6WXZir962JaBrO3PoPkNpJBKRcP3n-8TSxehqB5PSScYSpINPbbn 2Aq1uB39mNaJzsEpfIVz3CQsbK0qHCVnGkv 4:08 PM

Has anyone else run into a similar problem and gotten the token to send as plain text? Setting SMS Data Content Type to anything other than "application/x-www-form-urlencoded" stops messages from being sent, but changing SMS Data Content Encoding doesn't seem to make a difference.

--Don

Menno Pieters

unread,
May 31, 2013, 4:24:11 PM5/31/13
to pwm-g...@googlegroups.com
Hi Don,

Go to Settings > Token and select another storage method than "Crypto". Crypto results in those long tokens, for other types, you can select the length, like 6 or 8 characters, which are more likely to fit into a single SMS and can be easily entered by a user. The "Crypto" type is useful for email but definitely not for SMS.

Regards,

Menno



--
You received this message because you are subscribed to the Google Groups "pwm-general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pwm-general...@googlegroups.com.

To post to this group, send email to pwm-g...@googlegroups.com.

Marlow Leon

unread,
Jan 24, 2025, 10:10:46 PMJan 24
to pwm-general
Just wondering, How do you guys have twilio configured? For the most part i think i have everything correct but does not seem to get it to work
Reply all
Reply to author
Forward
0 new messages