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 = “” + 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

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
result=DefineEncoding(result, Encodings.UTF8)


wholine looks like the below

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.

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 that will do that for you.