ClickaTell api

Testing out the ClickaTell API but is unable to get pass the “POST” section.

[code]Dim FromTel, Totel as string
FromTel = fldFromTelNum.text // Use your Twilio-assigned phone number here
ToTel = fldToTelNum.text // A phone number to send the test message to

Dim kapiKey As Text = fldApiKey.Text.ToText

// Set the URL
Dim url as TEXT = “https://platform.clickatell.com/messages/http/send?apiKey=” + kapiKey +"&to=" + ToTel.ToText + “&content=” + fldMessage.text.ToText
TextField1.text = str(url)

MsgBox url

// Send Request, results (including any errors) are in MySocket.PageReceived event handler
MySocket.Send(“POST”, url)[/code]

If I copied the generated url and paste it into the browser, the sms api delivers it perfectly.
Please advice.

Does the API actually expect a POST? The documentation doesn’t actually say https://www.clickatell.com/developers/api-documentation/http-api-send-message/

For giggles try a GET request.

I certainly don’t have any issues posting to clickatell using their HTTP API? I have been using them in a desktop app for 7+ years. I do note the different syntax of the HTTP SOCKET in your code.

[code]dim wholeline, messagetxt, result as string
messagetxt=ReplaceAllB(txtFld.text," “,”%20") 'spaces replaced
wholeline=http_line+numbers+"&text="+messagetxt

result=httpsocket1.post(wholeline,3)
result=DefineEncoding(result, Encodings.UTF8)

[/code]

wholine looks like the below

http://api.clickatell.com/http/sendmsg?user=username&password=userpass&api_id=apiID&cliMSgId=username_20180622082445000004470&concat=3&from=4477712345678&to=4477798765432&text=Test%20Message%20text

This line adds the extra bits to give the message a reference of username, datetime and random number but a UUID or similar would work that I can later check to confirm it has been received which you may not require, the whole line is URL_Encoded as you would expect.

The line may look slightly different now as they have changed their API a little in the last couple of years so check the documentation at the bottom. The above works for me today but you may have a different type of account.

Try a line in a web browser with your username and api details, a number and message to yourself by text and see if it works.

https://www.clickatell.com/developers/api-documentation/http-api-request-parameters/

Thank you will look at it again.

It seems you aren’t percent encoding the message.

Your browser will do this automatically which explains why it works from the browser.

There is a Xojo function http://documentation.xojo.com/index.php/EncodeURLComponent that will do that for you.