Impementing Clickatell CallBack in ASP.NET using C#.NET -
I am creating a web application using C # .NET in ASP.NET which by using clickatell Sends an SMS.
I'm trying to get a position back from the click thall click Callback page Callback CallatellCallBack.aspx is the code of the page here:
Public Partial Category ClickatellCallBack: System.Web.UI. Page
(Safe sender, EventArgs e)
Recover the value from QueryString.
string apiID = Request.QueryString ["api_id"];
string = request from "Story" ["From"]; = String = to request. [String] "string" timestamp = request .QueryString ["timestamp"];
string api gid = request.QueryString ["apiMsgId"];
string cliMsgId = Request.QueryString ["cliMsgId"];
String position = Request JQueryString ["status"];
String Charge = Request. Question yString ["charge"];SMS status value in // database. Int smsStatusID = SMSManager.InsertSMSStatus (from APIID, timestamp, APIIMID, ClemGID, status, charging);
}
}
Basically, this page receives the query string value sent from clickthrough and insert them into a database table Does.
>I have registered the following callback url: With clickthold and select callback type: HTTP GET
In my 'sendmsg' command I get the delivery approval and callback request Set as follows: deliv_ack = 1 and callback = 3
The only problem is that nothing is happening. Callback URL does not appear to be accessible by clicklet.
Am I missing something? Am I doing something wrong. Do I need to use this callback URL other than ASP.Net Page?
Regards
Walter
I solved the problem by putting the callback and deliver_ack parameters with the startbatch command, and not the quicksend command If this works, then here I have the C # .NET
function that starts the batch:
protected string get_batch_id (string session_id, string message_by) { // Announce a webclant. Web client client = new webclient (); // Add a user agent header. Client.Headers.Add ("User-agent", "Mozilla / 4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR1.0.3705;)"); // add session_id to session string. Client.QueryString.Add ("session_id", session_id); // Add a template for the question string. Client.QueryString.Add ("Template", message_body); // Add a callback to the query string. Client.QueryString.Add ("callback", "3"); // Add deliv_ack to the query string. Client.QueryString.Add ("deliv_ack", "1"); // declare the basal string string = "http://api.clickatell.com/http_batch/startbatch"; // open the basal stream data = the client OpenRide (bisurral); // Recover the results of performing the startback command and declare a stream reader immediately. Streamer reader = new streamrider (data); // Divide the parse and the returned string into the returning array. String [] return_strings = reader.ReadToEnd (). Split (''); Return the batch_id from // return_strings array (the second element) string batch_id = return_string [1]. Ostring (); // close the stream data.Close (); // reader off reader.Close (); // return batch_id return (batch_id); }
Phew!
So I have successfully coded the following code which is coded in ASP.NET C # .NET
:
- The same recipient Send a message to
- Send the same message to multiple recipients;
- Send a personal message to the same recipient;
- Send a personal message to many recipients;
The way I have seen that there are not many clackettel code samples in asp.net
using C # .NET
.
Comments
Post a Comment