On conversation end
You can leverage a Function as a Service (FaaS) function to implement any functionality when a conversation is finished. This advanced approach allows for tailored event customization to enhance your bot's capabilities.
Through Automatic Messages, you can create functions triggered based on selected events. A payload is sent to a function containing metadata related to the specific conversation and based on the selected event during the invocation.
Enable the automatic messages feature and Create a new function using the 'Messaging conversation end' messaging events. You can select one of the available templates for the chosen event. Currently, you can create only one function per template type for these conversational events. A deployed function on a specific messaging event can be invoked on multiple conversation events.
Create the FaaS Function
Navigate to the "Functions" section in LivePerson Conversational Builder.

Click Automate > Functions. The Functions page appears.

Click Confirm to agree to the Terms of Use and GDPR Agreement.

Click the icon to open the LivePerson Functions page.

Click Create a Function. The Create a new function wizard appears.

Provide the following information:
- Runtime: Select your runtime.
- Event: Select the event that the FaaS function will track, in this case new conversation events. Select an event to see its available templates.
- Skill trigger: Select skills which trigger to which this function reacts. It is not necessary to select any skill, since this option was managed on the Automatic Messages section.
- Greeting Template: Select a template to start your implementation. Select the code template that the FaaS function will have, which can vary depending on the event you selected.
- Access to external domains required: Enable this option if you plan to call external APIs, including the API's domain. Disable it if no external API calls are required.
- Code: Displays the code for the template selected.
Click Continue. The next page appears.

By default, access to external domains is blocked. Adding domains to the allowlist allows functions to send requests to them. If required, add domains to the field and click Continue. The next page appears.

Provide the function name and description in the fields.

Click Create function the function is added. Once the function is open you can edit the code to implement any logic needed.

With Automatic Messages selected as the trigger, you can utilize the input.payload
variable, containing conversation data, within your function code.
This data contains:
1. Level | 2. Level | 3. Level | Description | Type | Example |
end | closeReason | which role closed conversation | STRING | AGENT/CONSUMER/SYSTEM | |
general | cbotEventType | Original conversation event type | STRING | CONSUMER_OPEN_NEW_CONVERSATION_FIRST_TIME_OFF_HOURS | |
general | type | notification type | STRING | UPSERT | |
general | convId | ID of conversation | STRING | c840e51e-5f65-4ad4-8d34-5c82b99a2200 | |
general | dialogId | ID of dialog | STRING | c840e51e-5f65-4ad4-8d34-5c82b99a2200 | |
general | sessionId | ID of session | NUMBER | 1528463744580 | |
general | startTs | conversation start time as timestamp | NUMBER | 1528463744663 | |
general | effectiveTTR | timestamp when agent should be available | NUMBER | 1528464044687 | |
general | oldConvState | previous state of the dialog | STRING | CLOSE | |
general | newConvState | current state of the dialog | STRING | OPEN | |
general | contexttype | type of cotext | STRING | SharkContext | |
general | campaignInfo | id | ID of campaign | NUMBER | 2327699812 |
general | campaignInfo | engangementId | ID of engangement | NUMBER | 2327699912 |
general | clientLanguage | language of the client device | STRING | en-US | |
general | clientFeatures | list of supported client features | ARRAY | ["AUTO_MESSAGES", "MULTI_DIALOG"] | |
general | inOffHours | shift-status of the contact center | BOOLEAN | TRUE/FALSE | |
general | visitorId | ID of visitor | NUMBER | 1528463744580 | |
general | originatorId | ID of originator | NUMBER | 37607275.23 | |
general | originatorPid | Pid of originator | STRING | f39fbc5f-da77-5417-8bc7-7584efdd1a5e | |
general | originatorMetadata | id | Pid of originator of metadata change | STRING | f39fbc5f-da77-5417-8bc7-7584efdd1a5e |
general | originatorMetadata | role | Role of originator of metadata change | STRING | CONTROLLER |
general | serverTimestamp | timestamp of the server | NUMBER | 1528463781807 | |
general | clientIpAdress | IP Address of client | STRING | 172.26.138.38 | |
general | manualETTR | time to response manually updated by agent | STRING | 1541152938069 | |
general | lastMessageComposer | the role of the last composer | STRING | CONSUMER | |
general | lastMessageTs | timestamp of last message | NUMBER | 1541152938069 | |
general | lastAgentMsgTs | timestamp of last agent message | NUMBER | 1541152938069 | |
general | backToQueueTs | timestamp when the conversation was returned to queue | NUMBER | 1541152938069 | |
idle | lastConsumerMsgTs | timestamp of last consumer message | NUMBER | 1541152938069 | |
idle | agentNonResponsive | time | time that should pass after consumer's last message in order the agent to be non-responsive | NUMBER | 30 |
idle | agentNonResponsive | timeUnits | time units in which agent non-responsive time should be calculated | STRING | minutes |
idle | consumserNonResponsive | time | time that should pass after agent's last message in order the consumer to be non-responsive | NUMBER | 30 |
idle | consumserNonResponsive | timeUnits | time units in which consumer non-responsive time should be calculated | STRING | minutes |
idle | convNotTakenTime | time | time units in which conversation idle time should be calculated | STRING | minutes |
idle | convNotTakenTime | timeUnits | how long should the conversation stay in queue in order to be idle | NUMBER | 30 |
mid | openedInOffHours | indicator if the conversation was opened in off hours | BOOLEAN | TRUE/FALSE | |
participantChange | oldParticipants | array of the participants of the previous state | ARRAY | [{"id": "f9d58c57-c489-45f5-bae4-c5ebd52b3972","role": "ASSIGNED_AGENT"}] | |
participantChange | newParticipants | array of the participants of the current state | ARRAY | [{"id": "f9d58c57-c489-45f5-bae4-c5ebd52b3972","role": "ASSIGNED_AGENT"}, {"id": "f9d58c57-c489-45f5-bae4-c5ebd52b3972","role": "AGENT"}] | |
routing | oldSkillId | previous skillId of conversation | STRING | 563268 | |
routing | newSkillId | current skillId of conversation | STRING | 563267 | |
start | firstConversation | if this is the first conversation of the consumer ever | BOOLEAN | TRUE/ FALSE | |
ttr | oldTtr | ttrType | type of ttr of the previous state | STRING | NORMAL |
ttr | oldTtr | value | value of ttr of the previous state | NUMBER | 600 |
ttr | newTtr | ttrType | type of ttr of the new state | STRING | URGENT |
ttr | newTtr | value | value of ttr of the new state (after change for example to URGENT) | NUMBER | 300 |
The cbotEventType
property in the invocation payload distinguishes conversation event types. Below is the mapping of conversation event types to messaging events on functions:
Event Type | Mapped to |
AGENT_END_CONVERSATION | Messaging conversation end |
CONSUMER_END_CONVERSATION | Messaging conversation end |
SYSTEM_END_CONVERSATION | Messaging conversation end |
Deploy the Function:
Click the 3 dot menu on the created function.

Click Deploy function. The Create a deployment page appears.

Click Approve & Deploy. The function is deployed.

Your function is now deployed and ready for use. By utilizing FaaS functions, you can seamlessly customize events and enhance the functionality of your bot in Conversational Builder.