Jump to: navigation, search

CometD notifications

You can subscribe to the /v2/me/facebooksession topic to receive CometD notifications for the Facebook Private Messaging API. This topic provides messages related to private Facebook messages, including changes to agent state, do-not-disturb, call forwarding, and supervisor monitoring. It supports the following message types:

FacebooksessionStateChangeMessage

Property Description
data The data element is present in all CometD notifications and is the root JSON element. You can use data.messageType to identify the message and determine what other properties should be present.
data.messageType This property identifies the message type, in this case FacebooksessionStateChangeMessage.
data.notificationType This property further identifies the type of notification and can have one of the following values:
  • StatusChange — The status of the facebooksession interaction has changed.
  • ParticipantsUpdated — The facebooksession participants have changed.
  • PropertiesUpdated — The facebooksession data has changed.
  • Error — This is sent when an operation on the facebooksession resource fails.
data.facebooksession A facebooksession resource with the updated state and capabilities.
data.referenceId The reference identifier is used to link the notification to the original request that created it.

Example

{  
   "data":{  
      "messageType":"FacebooksessionStateChangeMessage",
      "referenceId":17,
      "notificationType":"StatusChange",
      "facebooksession":{  
         "state":"Chatting",
         "capabilities":[  
            "Transfer",
            "Complete",
            "Leave",
            "InFocus",
            "SendMessage",
            "SendStartTypingNotification",
            "SendStopTypingNotification"
         ],
         "id":"0000Na9B26EF002X",
         "uri":"http://localhost:8080/api/v2/facebooksessions/0000Na9B26EF002X",
         "participants":[  

         ]
      }
   }
}

MessageLogUpdated

Property Description
data The data element is present in all CometD notifications and is the root JSON element. You can use data.messageType to identify the message and determine what other properties should be present.
data.messageType This property identifies the message type, in this case MessageLogUpdated.
data.notificationType This property further identifies the type of notification and has a value of NewMessages.
data.messages A list of messages/notifications that were exchanged in private messages.
data.facebooksessionUri The location of the facebooksession resource.

Example

{  
   "data":{  
      "messageType":"MessageLogUpdated",
      "notificationType":"NewMessages",
      "messages":[  
         {  
            "index":1,
            "type":"ParticipantJoined",
            "from":{  
               "type":"Customer",
               "nickname":"PersonP",
               "participantId":"009052C5E6D6004A"
            },
            "visibility":"All",
            "timestamp":"2014-01-02T14:23:18.000-0800"
         },
         {  
            "index":2,
            "type":"ParticipantJoined",
            "from":{  
               "type":"Agent",
               "nickname":"Marat",
               "participantId":"009052C5E743004C"
            },
            "visibility":"All",
            "timestamp":"2014-01-02T14:23:18.109-0800"
         },
         {  
            "index":3,
            "type":"ParticipantLeft",
            "from":{  
               "type":"Agent",
               "nickname":"Marat",
               "participantId":"009052C5E743004C"
            },
            "visibility":"All",
            "timestamp":"2014-01-02T14:23:19.909-0800"
         },
         {  
            "index":4,
            "type":"TypingStarted",
            "from":{  
               "type":"Customer",
               "nickname":"PersonP",
               "participantId":"009052C5E6D6004A"
            },
            "visibility":"All",
            "timestamp":"2014-01-02T14:23:20.121-0800"
         },
         {  
            "index":5,
            "type":"Text",
            "from":{  
               "type":"Customer",
               "nickname":"PersonP",
               "participantId":"009052C5E6D6004A"
            },
            "text":"Hello World",
            "visibility":"All",
            "timestamp":"2014-01-02T14:23:20.126-0800"
         },
         {  
            "index":6,
            "type":"ParticipantJoined",
            "from":{  
               "type":"Agent",
               "nickname":"Marat",
               "participantId":"009052C5EF51004D"
            },
            "visibility":"All",
            "timestamp":"2014-01-02T14:23:20.171-0800"
         }
      ],
      "facebooksessionUri":"http://localhost:8080/api/v2/facebooksessions/0000Na9B26EF002X"
   }
}
This page was last edited on February 15, 2024, at 19:11.
Comments or questions about this documentation? Contact us for support!