cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2845
Views
1
Helpful
7
Replies

Creating multiple chats in Socialminer from APIs

Ammara Bokhari
Level 4
Level 4

I am trying to create multiple chat contacts at a time in a single feed in Socialminer through APIs. The feed at Socialminer is of type 8 (CHAT) and is configured with UCCX. My first API request creates a chat and a notification is shown in socialminer and but subsequent requests return forbidden status (403) as long as the first contact is not handled or discarded by system. If I send two requests from two different machines, it creates two chat contacts simultaneously. It seems that Socialminer allows only one chat contacts at a time from same location(browser).

I have also tried from Java application and the behavior is same. Why it is so, how would I manage to create multiple chats from Java application for some messages is database, is this correct behavior or I am missing something ?

My request body looks like below,

<SocialContact>

<feedRefURL>http://local.socialminer/ccp-webapp/ccp/feed/100203</feedRefURL>

<author>testAuthor</author>

<title>Test</title>

</SocialContact>

and request url is http://local.socialminer/ccp/chat

1 Accepted Solution

Accepted Solutions

namahesh
Cisco Employee
Cisco Employee

Hi ammarabokhari,

SocialMiner Chat APIs authenticate and work based on HTTP sessions (represented by the session cookie value).

Because there is no identifier specifying which chat we are getting events for, API calls only work with a valid session cookie. The session cookie returned from the POST or GET should be provided on subsequent chat proxy API calls. It is only this way that you can distinguish and operate per chat session.

This has been documented in the SocialMiner Developer Guide. This is exactly the reason when you send two requests from two different machines, it creates two (different) chat contacts simultaneously, since the sessions are different.

So, if you want to pump in several chat requests, ensure that for each of them, there are separate HTTP sessions.

Hope this answers your question.

View solution in original post

7 Replies 7

namahesh
Cisco Employee
Cisco Employee

Hi ammarabokhari,

SocialMiner Chat APIs authenticate and work based on HTTP sessions (represented by the session cookie value).

Because there is no identifier specifying which chat we are getting events for, API calls only work with a valid session cookie. The session cookie returned from the POST or GET should be provided on subsequent chat proxy API calls. It is only this way that you can distinguish and operate per chat session.

This has been documented in the SocialMiner Developer Guide. This is exactly the reason when you send two requests from two different machines, it creates two (different) chat contacts simultaneously, since the sessions are different.

So, if you want to pump in several chat requests, ensure that for each of them, there are separate HTTP sessions.

Hope this answers your question.

Hi nagendra,

The chat requests I am creating using APIs are not routing to CCX agent(Finesse).

It works fine if created using chat widget HTML form in CCX.

It also works if I add below lines to HTML code from SocialMiner chat feed.

<select name="extensionField_ccxqueuetag"><br/>

        <option value="Chat_Csq8">Support</option>

</select>

The SocialMiner form code looks like below,

<style type='text/css'>span { display: inline-block; width: 100px; }</style>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<form action='https://miner11.ef.com/ccp/chat/form/100120' method='post'>

    <span>Title:</span><input id='title' type='text' name='title' /><br/>

    <span>Author:</span><input id='author' type='text' name='author' /><br/>

    <span>Description:</span><input id='description' type='text' name='description' /><br/>

    <span>Tags:</span><input id='tags' type='text' name='tags' /><br/>

    <span>Remarks:</span><input id='remarks' type='text' name='extensionField_remarks' value='sample value' /><br>

  <select name="extensionField_ccxqueuetag"><br/>

        <option value="Chat_Csq8">ExpertFlow Support</option>

    </select><br/>

    <input id='submit' type='submit' value='Submit'/>

    <input type="hidden" name="extensionField_chatLogo" value="./img/ciscoLogoColor.png">

    <input type="hidden" name="extensionField_chatWaiting" value="Welcome, please wait while we connect you with a customer care representative.">

    <input type="hidden" name="extensionField_chatAgentJoinTimeOut" value="All customer care representatives are busy assisting other clients. Please continue to wait or try again later.">

    <input type="hidden" name="extensionField_chatError" value="Sorry, the chat service is not available. Please try again later.">

</form>

I added extensionField_ccxqueuetag field to API request but it does not routes to agent, it successfully creates chat request with code 201 but it only shows on SocialMiner interface. API xml looks like below,


<SocialContact>

<feedRefURL>https://miner11.ef.com/ccp-webapp/ccp/feed/100120</feedRefURL>

<author>Test_author</author>

<title>Social contact title</title>

<extensionFields>

<extensionField>

<name>extensionField_ccxqueuetag</name>

<value>Chat_Csq8</value>

</extensionField>

</extensionFields>

</SocialContact>

Post request goes to https://miner11.ef.com/ccp/chat/


If created from the form then it routes to an agent and opens in chat gadget.

Hi sikanderhayat,

When using the chat APIs directly, just use ccxqueuetag as the extension field name, do not append the prefix extensionField_.

So, your XML should just contain

<extensionField>

    <name>ccxqueuetag</name>

    <value>Chat_Csq8</value>

</extensionField>


Now, you should be able to see that injected chat requests into SocialMiner will be queued into the specified chat queue in CCX and routed to a finesse desktop.


Please try this and let us know if you still face issues.


Thanks,

Nagendra U M

Hi namahesh,

Removing the prefix extensionField_ worked. Thanks for the quick reply.

Now back to the original post. How can I ensure that every API request is on separate HTTP session to create multiple requests from same client as you suggested in first reply. I am using Apache common HttpClient library in Java.

Thanks in anticipation.

Hi sikanderhayat,

If you create and maintain a new instance of org.apache.http.client.HttpClient each time you want to inject a chat into SocialMiner, it should just work as you expect.

Essentially, make requests to POST (create) new chats without a session cookie.

Thanks,
Nagendra U M

Thanks namahesh

I am now able to create multiple chats.

I read that I need to call Get Event API every 20 seconds for each chat request to keep them active and this is the actual

case. Currently, I call Get Event API (asynchronous spring boot call) for all chats to keep them active and get replies from agents or any any other event. Is this the correct approach to do it, what do you suggest ?

Hi Nagendra  

I have a question about webchat script. whether 1 webchat script from uccx is installed on 2 or more websites and the chat is active at the same time? without any text on web A which at the time of access to web B stick together

because I'm new in collaboration especially socialminer and ccx


regards


sandhy