XMPP Eventing Versus Task API Polling
For applications that create many tasks at once, such as email, using the Task API to poll for status can be inefficient. Instead, you can use XMPP eventing to monitor Task campaign events.
Status Polling with the Task API
When you configure Customer Collaboration Platform for Universal Queue capability, the system creates a Task feed automatically. That feed is associated with a Task campaign. All tasks created using the Task API result in contacts associated with this campaign. The contacts IDs are the IDs at the end of the reference URLs returned when a task is submitted.
You use these reference URLs to poll for task status.
For example, this task URL:
https://[ServerIP]:[Port]/ccp/rest/task/contact/36746331100001520000014D3F57FECE
maps to this contact:
https://[ServerIP]:[Port]/ccp-webapp/ccp/socialcontact/36746331100001520000014D3F57FECE
Subscribe to XMPP Task Campaign Events
When the system creates the Task campaign, it also creates the ccp.campaign.updates.<campaignpublicId> node that allows subscribers to subscribe to XMPP events related to the campaign.
Note | This is secured using TLS 1.2 by default, but the administrator can modify its security parameters. For more information, see Cisco Customer Collaboration Platform User Guide. |
To subscribe to the node for the Task campaign, you need the campaign's public ID. First, find the Task feed ID, using the Feed GET (List) API. Then, you can find the campaign's public ID using the Campaign GET (List) API.
In this example Feed GET (List) response, the application is using the feed ID 100000.
https://[ServerIP]Port]/ccp-webapp/ccp/feed
<feeds>
...
<Feed>
<changeStamp>0</changeStamp>
<description>Feed for Universal Queuing</description>
<name>Cisco_Default_Task_Feed</name>
<pushFeedURL>https://[ServerIP]:[Port]/ccp/rest/task/feed/100000</pushFeedURL>
<refURL>https://[ServerIP]:[Port]/ccp-webapp/ccp/feed/100000</refURL>
<status>1</status>
<tags>
<tag>cisco_uq_tag</tag>
</tags>
<type>12</type>
</Feed>
...
</feeds>
In this example Campaign GET (List) response, the publicID associated with that feed is Cisco_Default_Task_Campaign. The application therefore subscribes to ccp.campaign.updates.Cisco_Default_Task_Campaign.
<campaigns>
...
<Campaign>
<changeStamp>0</changeStamp>
<description>Campaign for any type of task</description>
<feeds>
<feed>https://[ServerIP]Port]/ccp-webapp/ccp/feed/100000</feed>
</feeds>
<name>Cisco_Default_Task_Campaign</name>
<publicId>Cisco_Default_Task_Campaign</publicId>
<refURL>https://[ServerIP]:[Port]/ccp-webapp/ccp/campaign/
Cisco_Default_Task_Campaign</refURL>
<resultsURL>https://[ServerIP]:[Port]/ccp-webapp/ccp/campaign/
Cisco_Default_Task_Campaign/results</resultsURL>
<suggestedTagsURL>https://[ServerIP]:[Port]/ccp-webapp/ccp/campaign/
Cisco_Default_Task_Campaign/suggestedtags</suggestedTagsURL>
</Campaign>
...
</campaigns>
For more information, see:
-
Feed API GET (List)
-
Campaign API GET (List)
Mapping Social Contact Extension Parameters and Task API Parameters
When you use XMPP eventing, your application receives social contact data that provides the content that backs the Task API. The following table maps social contact extension fields to Task API fields.
Social Contact Extension Field |
Task API Field |
---|---|
scriptSelector |
scriptSelector |
cv_[1-10] |
variables.variable.cv_[1-10] |
user_ (eccVariableName) |
variables.variable.user_(eccVariableName) |
Sample Task Campaign XMPP Events
<SocialContact xmlns="http://jabber.org/protocol/pubsub">
<campaignPublicId>Cisco_Default_Task_Campaign</campaignPublicId>
<extensionFields>
<extensionField><name>scriptSelector</name><value>smChatIntScriptSelector</value>
</extensionField>
</extensionFields>
<id>3E5C39DE10000152000002B43F57FECE</id>
<publishedDate>1452745177552</publishedDate>
<refURL>https://[ServerIP]:[Port]/ccp-webapp/ccp/socialcontact/
3E5C39DE10000152000002B43F57FECE
</refURL>
<sourceType>task</sourceType>
<status>unread</status>
<statusReason>unknown</statusReason>
<statusTimestamp>1452745177566</statusTimestamp>
<statusUserId/>
<tags><tag>task</tag></tags>
</SocialContact>