- Greeting Bot
- Agent Bot
- Survey Bot
- File Sharing Bot
- Return To Same Agent Bot
- Bot Cluster
- Extending the Agent Class
The greeting bot is a very simple implementation of the SDK in which the bot joins every conversation as a manager and sends the line "welcome from bot".
Pre-requisites:
- A LivePerson Account with Messaging
- A user with Agent Manager permissions
To run the greeting bot example:
-
Provide the following
envvariables:LP_ACCOUNT- Your LivePerson account IDLP_USER- Your LivePerson agent usernameLP_PASS- Your LivePerson agent password
-
Run:
- Unix Shell
LP_ACCOUNT=1234567 LP_USER=BotUserName LP_PASS=b0tpa55word node examples/greeting-bot/greeting-bot.js
- Windows Shell
set LP_ACCOUNT=1234567 set LP_USER=BotUserName set LP_PASS=b0tpa55word node examples/greeting-bot/greeting-bot.js
- Unix Shell
The agent bot is an example SDK implementation in which the bot accepts incoming conversations as the assigned agent. It listens for messages from the consumer and upon receipt marks them as read and echos them back to the consumer. This example extends the Agent class, which you can read more about below.
Pre-requisites:
- A LivePerson Account with Messaging
- A user with Agent permissions
To run the agent bot example
-
Provide the following
envvariables:LP_ACCOUNT- Your LivePerson account IDLP_USER- Your LivePerson agent usernameLP_PASS- Your LivePerson agent password
-
Run:
- Unix Shell
LP_ACCOUNT=1234567 LP_USER=BotUserName LP_PASS=b0tpa55word node examples/agent-bot/main.js
- Windows Shell
set LP_ACCOUNT=1234567 set LP_USER=BotUserName set LP_PASS=b0tpa55word node examples/agent-bot/main.js
- Unix Shell
The survey bot is an example SDK implementation in which the bot waits on a survey dialog, validates the application id with its own and joins the dialog. It automatically starts a survey of one question, listens on responses and upon correct response, closes the dialog. This example extends the Agent class, which you can read more about below.
Pre-requisites:
- A LivePerson Account with Messaging
- A user with Agent permissions
- Application installation id with
ms_surveycapability (ask your LivePerson account representative to create one for you and provide you with the id) - Assign your application installation id to a specific skill(s) that if the conversation ends on your bot will start operating - not your bot skill (ask your LivePerson account representative to assign it for you)
To run the survey bot example
-
Provide the following
envvariables:LP_ACCOUNT- Your LivePerson account IDLP_USER- Your LivePerson agent usernameLP_PASS- Your LivePerson agent passwordAPP_INST- Your bot app installation id
-
Run:
- Unix Shell
APP_INST=1234-3454-34657 LP_ACCOUNT=1234567 LP_USER=BotUserName LP_PASSWORD=b0tpa55word node examples/survey-bot/main.js
- Windows Shell
set APP_INST=1234-3454-34657 set LP_ACCOUNT=1234567 set LP_USER=BotUserName set LP_PASSWORD=b0tpa55word node examples/survey-bot/main.js
- Unix Shell
The file sharing bot is an example SDK implementation which showcases file sharing capabilities. The bot performs the following actions:
- Listens for any incoming conversation.
- Joins the main dialog as an agent manager.
- Generate an upload token.
- Uploads the image to url specificed in the previous steps.
- Publishes the image message to the conversation (publish hosted file).
- Generates a download url for the file shared.
- Validates that the download url is received (can only happen when file is uploaded successfuly).
- Publishes a regular message.
This example extends the Agent class, which you can read more about below.
Pre-requisites:
- A LivePerson Account with Messaging enabled.
- Account should be enable ac-feature:
Messaging.Agent_File_Sharing - Account site settings should enable:
messaging.agent.file.sharing.enable
- Account should be enable ac-feature:
- A user with Agent permissions. These permissions also need to be edited. To edit the agent permission:
- Login to your account using administrator/agent manager permissions.
- Navigate to the users tab.
- Click the Profiles option and then click the Agent profile or create a new profile based on the Agent role and there enable the following:
Send files to consumers from local file browserand/orSend files to consumers from custom widgets
To run the file sharing bot example
-
Provide the following
envvariables:LP_ACCOUNT- Your LivePerson account IDLP_USER- Your LivePerson agent usernameLP_PASS- Your LivePerson agent password
-
Run:
- Unix Shell
LP_ACCOUNT=1234567 LP_USER=BotUserName LP_PASSWORD=b0tpa55word node examples/filesharing-bot/filesharing-bot.js
- Windows Shell
set LP_ACCOUNT=1234567 set LP_USER=BotUserName set LP_PASS=b0tpa55word node examples/filesharing-bot/filesharing-bot.js
- Unix Shell
The Return to Same Agent bot is an example SDK implementation which showcases transfer to agent capabilities. The bot performs the following actions:
- Listens for any incoming conversations, on a pre-configured skill.
- Acceps the conversation.
- Waits for a notification which says that a bot has joined the conversation.
- The bot then uses the Messaging Interactions API method, Get Conversations by Consumer id, in order to get all conversation for the current consumer.
- The conversation with the best MCS record is retrieved.
- From that conversation the bot extracts the agent id.
- Using the Agent Metrics API method, Agent Status, the bot checks if that agent is ONLINE.
- In case the answer is yes, it transfers the conversation to that agent.
This example extends the Agent class, which you can read more about below.
Pre-requisites:
- A LivePerson Account with Messaging enabled.
- Account should have the ac-feature
Messaging.Transfer_To_Agentenabled.
- Account should have the ac-feature
- A user with Agent permissions. These permissions also need to be edited. To edit the agent permission:
- Login to your account using administrator/agent manager permissions.
- Navigate to the users tab.
- Click the Profiles option and then click the Agent profile or create a new profile based on the Agent role and there enable the following:
Transfer messaging conversations to a specific agent in 'online' or 'back soon' state
To run the return to same agent bot example
-
Provide the following
envvariables:LP_ACCOUNT- Your LivePerson account IDLP_USER- Your LivePerson agent usernameLP_PASS- Your LivePerson agent password
-
Run:
- Unix Shell
LP_ACCOUNT=1234567 LP_USER=BotUserName LP_PASSWORD=b0tpa55word node examples/transfer2same-agent-bot/main.js
- Windows Shell
set LP_ACCOUNT=1234567 set LP_USER=BotUserName set LP_PASS=b0tpa55word node examples/transfer2same-agent-bot/main.js
- Unix Shell
The best way to use the SDK is to extend the Agent class with your own logic and then instantiate this object in your projects, as demonstrated in a very basic way in the agent bot example.
For more extensive bot examples, all of which extend the Agent class, check out the extended messaging bot samples repository.