On non responsive or in queue
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 stuck queue idle' 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.
Automatic Messages can trigger different conversation events, these events can be triggered by skills and can be managed by FaaS functions to customize the experience of the bot based on the event triggered.
Set Events Configuration
To access the Automatic Messages settings, you should select the Engage icon and select Campaign Builder section.

Click Engage > Campaign Builder. The Campaign Builder page appears.

Click Automatic Messages. The Automatic Messaging Library page appears.

Click Messaging. The Messaging tab appears.

The events that can be triggered on the conversation idle are:
- Agent non-responsive message
- Consumer non-responsive message
- Waiting in queue message
Customize event settings by selecting desired skills, defining languages, activating or deactivating events, and setting message content and timing.

Provide the required information:
- Skill trigger: Specify triggering skills; if none are added, the event activates for all available skills.
- Language: Customize messages for different languages.
- Message: Customize a message for the customer post-event, with further customization possible using a FaaS function.
- Repeat Message: Edit the number in the field to define the number of times the message can be repeated.
- Active/In-Active: This indicates if the event is Active or not. Gray indicates not active. Yellow indicates active.
- Time Delay: Set the time delay for event triggering.
- Override: Activate to override with the expected response time if it's longer.
Click Save. The settings are saved.
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 idle 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.

- Send a message. The default automatic message can be overwritten with.
- Transfer Conversation to a different Agent.
- Close conversation, noting potential race conditions. For instance, combining "Message" and "Close" commands may result in closure before the message is sent. Similarly, duplicate commands (e.g., two transfers) execute only the first.

The input.payload
variable contains real-time conversation data usable within the 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 within the invocation payload distinguishes the conversation event type. Below is a table mapping these event types to messaging events in functions:
Event Type | Mapped to |
CONV_AWAITING_IN_QUEUE | Messaging conversation idle, Messaging conversation stuck idle |
AGENT_NON_RESPONSIVE | Messaging conversation idle, Messaging agent idle |
CONSUMER_NON_RESPONSIVE | Messaging conversation idle, Messaging consumer idle |
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.
javascript:
function lambda(input, callback) {
// Set conversation data.
let conversation = input.payload;
let skillId = conversation.routing.newSkillId;
let conversationId = conversation.general.convId;
let lastMessageFrom = conversation.general.lastMessageComposer;
const wmBot = process.env.wmBot; // Ensure you set the variable on the Environment Variables section
const smsBot = process.env.smsBot; // Ensure you set the variable on the Environment Variables section
console.info(`${conversationId} - Conversation Idle`);
console.info(`${conversationId} - Last message is from ${lastMessageFrom}`);
const wmService = process.env.wmService; // Ensure you set the variable on the Environment Variables section
const smsService = process.env.smsService; // Ensure you set the variable on the Environment Variables section
const generalService = process.env.generalService; // Ensure you set the variable on the Environment Variables section
const botSkillArray = [wmBot, smsBot];
let transferSkill;
if (skillId == wmBot) {
transferSkill = wmService;
} else if (skillId == smsBot) {
transferSkill = smsService;
} else {
transferSkill = generalService;
}
let result = [
{
type: "systemMessage", // Returns a system message into the conversation.
text: "Something went wrong with the chatbot. I'm going to connect you with a live associate for more assistance."
},
{
type: "transfer", // Transfers the conversation.
skillId: transferSkill, // Transfer to different skill.
}
];
if (lastMessageFrom == "CONSUMER" && botSkillArray.includes(skillId)) {
console.info(`${conversationId} - Bot is not responding, transfering to fallback skill - ${transferSkill}`);
callback(null, result);
} else {
console.info(`${conversationId} - Customer is not responding`);
callback(null, null);
}
}
