Source language: Translate to:

Twilio SMS

General questions about NeoBook

Moderator: Neosoft Support

Twilio SMS

Postby ajhunt » Fri Apr 22, 2016 9:31 am

Hi Guys and Gals, has anyone yet used the SMS feature of Twilio.com and intergrated it into any NeoBook App to send an SMS to mobile phone? I can't seem to get the params correct for the "InternetPost" command and any help would be greatly appreciated. Many thanks all.
ajhunt
 
Posts: 222
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom

Re: Twilio SMS

Postby Gaev » Fri Apr 22, 2016 10:02 am

ajhunt:

1) Please post here details of the parameters you specified for the InternetPost command you are using (just change any sensitive values).

2) What kind of response did you get ?

3) If you are planning to have your publication used by others, note that it would be dangerous to have them use your credentials. It is for this reason that Twilio does not show any examples of using their APIs from a client side (like Javascript) ... just server side (like node.js, java, php etc.).
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Twilio SMS

Postby ajhunt » Sat Apr 23, 2016 12:38 am

Hello Geav, thank you for your time yet again with helping. I have looked at the twilio website (https://www.twilio.com/docs/api/rest/sending-messages) at the Curl code but I just can't convert it for use with InternetPost. I have tried playing with it with the following:
https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages [To] [From] ][MessagingServiceSid] [BodyText] [MediaUrl] - and get a 401:UNAUTHORIZED return.
I've looked at the other examples like PHP but still can't work out how to use it within InternetPost.

I would like to be able to give uses option for sending either SMS or MMS (USA and Canada only) but not sure. They would be required to set it up with there own;
Twilio Phone#, Twilio AccountSID, Twilio AccountToken, Message and Country Code. The [BodyText] and [MediaUrl] I would add through the application.

Really hope you can help again Geav, but my skill set is definately not with api's. Many many thanks again Geav for any help or suggestions to help me achieve this.

Best regards Anthony.
ajhunt
 
Posts: 222
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom

Re: Twilio SMS

Postby Gaev » Sat Apr 23, 2016 7:07 am

ajhunt:

I too had looked at the Curl code before my previous posting ... just wanted to make sure you did not have access to some other documentation.

I do not think that you can use NeoBook's InternetPost command to access Twilio's services. Looking at their Node.js, PHP, Python and Ruby code example, it looks like Twilio provides a custom "script library" for each of the platforms (your Application code then makes calls to functions within these libraries) ... with the NeoBook command, there is no way to specify these libraries.

You might be able to send simple (text only) messages with some work. Looking at the relevant lines in the cURL example they provide ...
Code: Select all
curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/AC5ef872f6da5a21de157d80997a64bd33/Messages.json' \
--data-urlencode 'To=+16518675309'  \
--data-urlencode 'From=+14158141829'  \
--data-urlencode 'Body=Hey Jenny! Good luck on the bar exam!'
-u AC5ef872f6da5a21de157d80997a64bd33:[AuthToken]

... even if there are NeoBook plugins that will do the "urlencode" of the "From, To and Body" parameters ... I am not sure how to pass the equivalent of the "-u AC5ef872f6da5a21de157d80997a64bd33:[AuthToken]" line ... you might be able to pass them as separate "user=" and "password=" parameters ... or specify them as part of the url (see https://en.wikipedia.org/wiki/Uniform_Resource_Locator ).

I think you will have a better chance of success if you choose to interact with the website using the WebBrowser facility of NeoBook ... usually, libraries that are used with Node.js (server side) are usable on the client side (javascript) ... but only the people at Twilio can tell if this is the case with their library.

If you choose to go the WebBrowser route, you could ask their support people to provide you with a sample html file ... after that, it would be a simple case to have Neobook substitute the variable parameters and invoke an HTTPS request (using the POST method).

Otherwise, they could tell you if there was an alternative to the -u method for specifying your credentials (as I mentioned above).
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Twilio SMS

Postby ajhunt » Sat Apr 23, 2016 8:34 am

Hi again Geav, many many thanks for your trying to help. I will contact Twilio support and see what they can suggest. I was hoping it would be straight forward but obviously not. Thanks again Geav for your expert time. Best regards Anthony.
ajhunt
 
Posts: 222
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom

Re: Twilio SMS

Postby TMcD » Tue Aug 22, 2017 5:53 pm

ajhunt wrote:Hi again Geav, many many thanks for your trying to help. I will contact Twilio support and see what they can suggest. I was hoping it would be straight forward but obviously not. Thanks again Geav for your expert time. Best regards Anthony.


Anthony,

What did they say? Where did this end up?

Thanks
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: Twilio SMS

Postby ajhunt » Wed Aug 23, 2017 1:24 am

Hi TMcD, found a solution by installing and using C++ runtime and Curl. Basically upload file to FTP site location so hosted, then send the text message via Curl to number tapped in by user. User receives SMS in about 30 seconds. Cut out of action commands as below.

1. SetVar "[FilenameToSend]" "[DateTimeStamp].mp4"

2. fmCopyTo "FTPConnection" "[TempFolder][FilenameToSend]" "GetConfirmation=No;ShowProgress=No"

3. SetVar "[DownloadLink]" "[FTPWebAddress]/[FTPFolder]/[EventTitle]/[FilenameToSend]"

4. FileWrite "[TempFolder]Batch.bat" "All" "[PubDir]Tools\curl.exe -s -XPOST https://api.twilio.com/2010-04-01/Accounts/[TwilioAccountNum]/Messages.json -d [#34]Body=[TwilioMessage] [DownloadLink][#34] -d [#34]To=+[CountryCode][SMSNumber][#34] -d [#34]From=[TwilioCountryCode][TwilioFromNum][#34] -u [TwilioAccountNum]:[TwilioAuthCode]"

You can download my photobooth app to see it working after setting up your own FTP and Twilio account.
www.easyboothderby.co.uk/multicam

Hope this helps and anyone who wants to do the same.

Best regards
Anthony
ajhunt
 
Posts: 222
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom

Re: Twilio SMS

Postby Tony Kroos » Thu Aug 24, 2017 2:48 am

Have you read this?
Note: If your use case require API Keys to access the /Accounts or /Keys endpoint, a Master Key needs to be used, which can be created in the Console.


I think you messed up api key, AccountSid and Token. If you provide access to your account I think I could take a look at your account setup and get your InternetPost request working.
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Re: Twilio SMS

Postby ajhunt » Thu Aug 24, 2017 3:21 am

Hi Tony, works perfectly -u [TwilioAccountNum]:[TwilioAuthCode] (I got this from the Twilio Support Team for use with curl)
ajhunt
 
Posts: 222
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom

Re: Twilio SMS

Postby Tony Kroos » Thu Aug 24, 2017 8:09 am

If it works with curl it must be working with InternetPost
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Re: Twilio SMS

Postby ajhunt » Thu Aug 24, 2017 8:53 am

More than likely it does Tony, but I just could not find the correct sequence - this worked so I though best leave it as working lol. If you can get it working with Internetpost then would be really great as would not have to install curl. Thanks for your time and replys Tony.
ajhunt
 
Posts: 222
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom

Re: Twilio SMS

Postby Tony Kroos » Fri Aug 25, 2017 12:10 am

I got an account but now I have to buy Twilio phone number to be able to send sms from it ?
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Re: Twilio SMS

Postby TMcD » Fri Aug 25, 2017 12:29 am

Tony Kroos wrote:I got an account but now I have to buy Twilio phone number to be able to send sms from it ?


Yes, you have to use their phone #. You can use your own, but you have to pay a fee for that.
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: Twilio SMS

Postby ajhunt » Fri Aug 25, 2017 2:38 am

Yes need to buy a phone number to use Twilio and then you use your TwilioAccountNum and TwilioAuthCode to send sms.
ajhunt
 
Posts: 222
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom

Re: Twilio SMS

Postby TMcD » Mon Aug 28, 2017 12:49 pm

ajhunt wrote:Hi TMcD, found a solution by installing and using C++ runtime and Curl. Basically upload file to FTP site location so hosted, then send the text message via Curl to number tapped in by user. User receives SMS in about 30 seconds. Cut out of action commands as below.

1. SetVar "[FilenameToSend]" "[DateTimeStamp].mp4"

2. fmCopyTo "FTPConnection" "[TempFolder][FilenameToSend]" "GetConfirmation=No;ShowProgress=No"

3. SetVar "[DownloadLink]" "[FTPWebAddress]/[FTPFolder]/[EventTitle]/[FilenameToSend]"

4. FileWrite "[TempFolder]Batch.bat" "All" "[PubDir]Tools\curl.exe -s -XPOST https://api.twilio.com/2010-04-01/Accounts/[TwilioAccountNum]/Messages.json -d [#34]Body=[TwilioMessage] [DownloadLink][#34] -d [#34]To=+[CountryCode][SMSNumber][#34] -d [#34]From=[TwilioCountryCode][TwilioFromNum][#34] -u [TwilioAccountNum]:[TwilioAuthCode]"

You can download my photobooth app to see it working after setting up your own FTP and Twilio account.
http://www.easyboothderby.co.uk/multicam

Hope this helps and anyone who wants to do the same.

Best regards
Anthony


Anthony,

Where are you getting the "curl.exe" software to run this from the desktop?

I too would like to use SMS. If we can't figure out Internet Post yet, then I don't have a problem using "curl.exe".

Thanks
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Next

Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 1 guest