Sending messages through Clickatell
Clickatell no longer provides direct access to an SMPP server. Instead they offer a REST API that consumes JSON or XML. They also offer an HTTP API that accepts query parameters. The component's from IPWorks can be used to integrate with both. Below is a short example using the JSON and HTTP components to send a message through the REST API.
Http http = new Http();
http.OnTransfer += (obj, ev) =>
{
if (ev.Direction == 1)
Debug.WriteLine("Response:\r\n" + ev.Text);
};
Json json = new Json();
json.StartObject();
json.PutProperty("content", "Hi! This is a test message.", 2);
json.PutName("to");
json.StartArray();
json.PutValue("15555555555", 2);
json.EndArray();
//json.PutProperty("from", "15555555555", 2); // If your integration supports two-way messaging, set the from number here.
json.PutProperty("binary", "false", 4);
json.PutProperty("clientMessageId", "uuid", 2);
json.EndObject();
json.Flush();
string request = json.OutputData;
Debug.WriteLine(json.OutputData);
http.Authorization = "Your API Key Here";
http.ContentType = "application/json";
http.Accept = "application/json";
http.PostData = request;
http.Post("https://platform.clickatell.com/messages");
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.