• Help Needed
  • ►HowTo◄ Executing a CURL command - POSTing data

(making a new thread - BWALK asked this Q in another thread and I didn't want to cutter that)

Had a phone conversation with Bill. In his app, he can start using CURL to accomplish what he wants.
You could also use Aware's REST ability to do this, but this is pretty easy for Bill to get running quickly.

Jaymer, I'm trying to get Twilio working in AwareIM, I have a few questions if you would be so kind.
1- how do you execute the Curl Command once you have built and saved it?
2- What is in SystemSetting.DQ?
It would be great to get Twilio working in AwareIM
Thanks, Bill

CREATE tempCurl WITH
tempCurl.theCommand=curl -XPOST+
https://api.twilio.com/2010-04-01/Accounts/AC95xx655d2cbe4764ee90eb23f78/Messages.json+
-d ~Body= + YourBO.theSMSMessage +~ +
-d ~To=+1 + REPLACE_PATTERN(Contacts.Phone,'-','') +~ +
-d ~From=+18005551212 +~ +
-u AC95d46334f6xxxx4ee90eb23f78:2d8b0eb3bxxxx4f9e5c147b1

NOTE: Am using a squiggle ~ instead of referring to SystemSetting.DQ, for readability. As an example, this makes the "from" line become this:
-d From=+18005551212~ which will become this:
-d "From=+18005551212" after the REPLACE_PATTERN below.

Then, replace all the squiggles with real double quotes, and execute. Examine the Server Output window to see the execution and possible any error msgs or return data.

tempCurl.theCommand = REPLACE_PATTERN( tempCurl.theCommand,'~', SystemSettings.DQ )

EXECUTE PROGRAM tempCurl.theCommand

Misc Notes:

1) The REPLACE on the TO # is needed in the event you store mask characters in your phone #. So you need to remove the dashes.

2) There are a few characters that will mess up an outgoing SMS message. I think one is a $. If you send a message like:
"The cost is $12"
I think the send will fail. There were a few gotchas I found and can't remember them all right now. I think you have to escape the $ with a '\', but thats not straightforward either. For now, I'd add a link to strip out any $ characters just in case.

3) If you bring up a popup window like "Enter the Message:" and allow the user to enter text, I think a CR to start a new line will also fail on a SMS.

4) SystemsSettings.DQ and .SQ hold double and single quote characters, respectively.

6 years later