This guide explains how to enable LivePerson Functions for post conversation survey events.
With Messaging Conversation Survey you are able to invoke lambdas
before & after a conversation survey. Along with the invocation, the function is sent a payload containing metadata related to the conversation survey which invoked the function. This payload can then be used in the function for further processing and referencing.
In comparison to the chat post survey this integration will not send any automated emails.
However, a similar scenario might be implemented by simply connecting LivePerson Functions to your external SMTP server and triggering the email via an API call from within the lambda
.
Messaging Conversation Survey events for Function Invocation
-
Messaging Survey Started
-
Messaging Survey Ended
Step 1 - Create function
Create a new function using one of the messaging survey templates.
Currently, only one function per template type can be created. If there are multiple types of functionality needed that stem from the same event invocation, these should be coded into the same lambda
.
Step 2 - Edit the Function
Adjust the code in the template according to your needs by modifying the function. On the right side you can see an example of the payload (in the sidebar, which you might need to open).
As mentioned above, the function can return a series of commands back to the invoker. In the template code you can see the current available commands.
In the event of the function not being threaded by the calling system, the function can simply return ok
within the callback.
Step 4 - Deploy the function
Just like any other function, this function must be deployed before it can be used. Please see this document for more information on how to deploy your function. At this point, you can also test your function.
Payload details
1. level | 2. level | 3. level | description | type | example |
---|---|---|---|---|---|
conversationId | ID of conversation | STRING | c840e51e-5f65-4ad4-8d34-5c82b99a2200 | ||
accountId | ID of account | STRING | 12345678 | ||
surveyId | ID of survey | NUMBER | 3387141511 | ||
surveyRevision | Revision of survey | NUMBER | 2 | ||
skillId | ID of skill | STRING | 563267 | ||
effectiveTTR | timestamp when agent should be available | NUMBER | 1528464044687 | ||
lastContentEventNotification | originatorId | ID of originator | NUMBER | 37607275.23 | |
lastContentEventNotification | originatorPId | Pid of originator | STRING | f39fbc5f-da77-5417-8bc7-7584efdd1a5e | |
lastContentEventNotification | sequence | sequence of conversation (starting by 0) | NUMBER | 1 | |
lastContentEventNotification | serverTimestamp | timestamp of the server | NUMBER | 1528463781807 | |
lastContentEventNotification | event | contentType | contenttype of last event | STRING | text/plain |
lastContentEventNotification | event | message | message of last event | STRING | Thank you for messaging us. Our contact center is currently closed. An agent should reply within 11 hours and 40 minutes. |
lastContentEventNotification | event | type | type of last event | STRING | ContentEvent |
lastContentEventNotification | originatorClientProperties | Information about client | OBJECT | {"type":".ClientProperties","appId":"webAsync","ipAddress":"127.0.0.1","deviceFamily":"DESKTOP","os":"OSX","osVersion":"10.14.3","integration":"WEB_SDK","integrationVersion":"3.0.25","browser":"CHROME","browserVersion":"72.0.3626.119","features":["PHOTO_SHARING","CO_BROWSE","QUICK_REPLIES","AUTO_MESSAGES","MULTI_DIALOG","RICH_CONTENT"]}, | |
campaignInfo | campaignId | ID of campaign | NUMBER | 2451931211 | |
campaignInfo | engagementId | ID of engagement | NUMBER | 2451931311 | |
closeReason | close reason of conversation | STRING | CONSUMER | ||
context | clientProperties | Information about client | OBJECT | {"type":".ClientProperties","appId":"webAsync","ipAddress":"127.0.0.1","deviceFamily":"DESKTOP","os":"OSX","osVersion":"10.14.3","integration":"WEB_SDK","integrationVersion":"3.0.25","browser":"CHROME","browserVersion":"72.0.3626.119","features":["PHOTO_SHARING","CO_BROWSE","QUICK_REPLIES","AUTO_MESSAGES","MULTI_DIALOG","RICH_CONTENT"]} | |
context | interactionContextId | ID of context | STRING | 5 | |
context | lang | language | STRING | en-US | |
context | sessionId | ID of session | STRING | iGY4vsiETB-Zsyi7IGlIk1 | |
context | type | type of context | STRING | SharkContext | |
context | visitorId | ID of visitor | STRING | hjMTk3ZTcwZmFhZjc3NDk2 | |
dialogs | array with information about the dialogs of the conversation | OBJECT-ARRAY | [{"dialogId":"efSg0XbnTkmg8OXaSyaz81","participantsDetails":[{"id":"49b673cb7d08168a9f14640346340237054482174d65ff8c70e0f4d0d9bfa911","role":"CONSUMER","state":"ACTIVE"}],"dialogType":"POST_SURVEY","channelType":"MESSAGING","metaData":{"appInstallId":"829d951a-777e-46a3-98db-c06214e3f401"},"state":"OPEN","creationTs":1551702854131,"metaDataLastUpdateTs":1551702854131},{"dialogId":"fb84c76d-0daa-46c7-b02d-eb6130c022c1","participantsDetails":[{"id":"49b673cb7d08168a9f14640346340237054482174d65ff8c70e0f4d0d9bfa911","role":"CONSUMER","state":"ACTIVE"}],"dialogType":"MAIN","channelType":"MESSAGING","state":"CLOSE","creationTs":1551702813391,"endTs":1551702854131,"metaDataLastUpdateTs":1551702854131,"closedBy":"CONSUMER","closedCause":"Closed by consumer"}], | ||
firstConversation | if this is the frist conversation of the consumer ever | BOOLEAN | TRUE/FALSE | ||
participants | array of the participants of the current state | OBJECT-ARRAY | [{"id": "f9d58c57-c489-45f5-bae4-c5ebd52b3972","role": "ASSIGNED_AGENT"}, {"id": "f9d58c57-c489-45f5-bae4-c5ebd52b3972","role": "AGENT"}] | ||
state | state of the dialog | STRING | OPEN | ||
startTs | conversation start time as timestamp | NUMBER | 1528463744663 | ||
ttr | ttrType | type of ttr | STRING | URGENT | |
ttr | value | value of ttr | NUMBER | 300 | |
lastQuestionId | ID of last question | STRING | 2741eea2-e184-4cd4-abbe-e8f6e1d26681 |