How to Get Chat Visitors & Operators information in ASP.NET Using Cloud APIs

LANE COVE, Australia -- The new blog post from Banckle explains how .NET developers can get online and queued chat visitors information along with the chat operators’ information using Banckle.Chat for Cloud API. Developers can easily embed this functionality in their own .NET application and can easily modify the VisitorsResponse class to get more detailed information e.g. City, State, Time Zone, Last Accessed time etc. as required. To view .NET code and other detailed information please visit this page: http://banckle.com/blog/get-chat-visitors-and-operators-information-with-banckle-chat-for-cloud-api.html (http://banckle.com/blog/get-chat-visitors-and-operators-information-with-banckle-chat-for-cloud-api.html)

Prerequisites

You can easily access Banckle.Chat API by using Swagger API Explorer: http://chat.banckle.com/api/v3.0/

In order to use Swagger API Explorer, you must have:

A valid Banckle Account. You can create new Banckle Account by using this link: https://apps.banckle.com/action/signup
A valid Banckle API key. You will get API key from your Dashboard after successful login
A Valid Banckle Authorize Token which you can get from this url: https://apps.banckle.com/api/v2/doc/#%21/auth/login_POST
Get permission to access Banckle.Chat API Service. See Create New Session for more information.

Application Details
This application is developed in ASP.NET and will you a solution of how to get the details regarding online visitors, visitors in queue and details of operators by using a valid API Key and Authorized Token. You can get API Key from your application dashboard once you have logged in and below is the code to get authorized token using the combination of your username and password.

Get Authorized Token
protected void Get_Authorized_Token()

{

// Create JSON object to be sent

JObject request_json = new JObject();

request_json.Add("userEmail", new JValue(txtEmail.Text));

request_json.Add("password", new JValue(txtPassword.Text));

string request_body = request_json.ToString();

string request_url = "https://apps.banckle.com/api/v2/auth/token";

// Create request object

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(request_url));

// Add custom headers for authentication

request.Headers.Add("banckle-client-api-key", api_key);

// request.Headers.Add("X-Resource", session_resource);

// Set request parameters

request.Method = "POST";

request.ContentType = "application/json";

request.ContentLength = request_body.Length;

// Add the required JSON to request object

StreamWriter request_writer = new StreamWriter(request.GetRequestStream());

request_writer.Write(request_body);

request_writer.Close();

// Retrieve response object

WebResponse response = request.GetResponse();

Stream response_stream = response.GetResponseStream();

// Fetch response as string

string response_body = new StreamReader(response_stream).ReadToEnd();

// Close response stream to release resources

response_stream.Close();

// Parse response as JSON object

JObject response_json = JObject.Parse(response_body);

auth_token = response_json["authorization"]["token"].ToString();

}

Create New Session
After providing a valid key and getting an authorized token, a new session is created which is used to get the information from Cloud. We need to pass a valid token to get the session information. Below is the code to create new session by passing authorized token in request url.

protected string Generate_Session()


Contact
Andrea Croft
12143291520
social@banckle.com

  • Issue by:Banckle
  • Web:http://
  • City:Lane Cove - New South Wales - Australia
  • About Viv-Media|Free Add URL|Submit Press Release|Submit How To|SiteMap|Advertise with Us|Help|Contact Viv-Media |China Viv-Media
  • Copyright© 2010-2020 viv-media.com Corporation.
    Use of this web constitutes acceptance of Terms of Service and Privacy Policy. All rights reserved.  Poetry Online :Ancient Chinese Poetry