<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>LivePerson Developer Center</title>
    <link>https://developers.liveperson.com</link>
    <atom:link href="https://developers.liveperson.com/feed.xml" rel="self" type="application/rss+xml" />
    <description>The LivePerson Developer Center is the main hub for documentation of LivePerson APIs and SDKs.</description>
    <lastBuildDate>Fri, 19 Jun 2026 11:56:25 +0000</lastBuildDate>
    <generator>Jekyll v3.9.3</generator>
    <item>
      <title>Your Iterative Workflow</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-your-iterative-workflow.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-your-iterative-workflow.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>Syntrix’s simulation and training studio operates on a powerful, iterative simulation cycle that allows you to continuously test, learn, and optimize. It’s a closed-loop system designed for maximum efficiency and accuracy. Here's a simplified overview of the core simulation process.</p>

<h3 id="step-1---create-synthetic-customer-profiles">Step 1 - Create synthetic customer profiles</h3>

<p>In this step, you <a href="work-in-the-simulation-and-training-studio-synthetic-customer-profiles-manage-synthetic-customer-profiles.html">create one or more synthetic customer profiles</a> that each focus on a specific area: testing fraud scenarios, new agent onboarding, an upcoming product launch, etc.</p>

<p>Profile creation is an <strong>AI-powered process</strong> that gets you up and running quickly: It can generate scenarios for you and draw from the predefined personas that come with Syntrix. This makes setup fast. But a more manual approach to individual asset creation is also possible.</p>

<h3 id="step-2---run-the-simulation">Step 2 - Run the simulation</h3>

<p>With your synthetic customer profile ready, you <a href="work-in-the-simulation-and-training-studio-simulations-manage-simulations.html">run a simulation</a>. During a simulation, the synthetic customer interacts with your agent(s). These are real-time, multi-turn conversations, mimicking actual customer interactions.</p>

<p>As conversations conclude, Syntrix evaluates the interactions against the scenario's agent goals and the scorecard.</p>

<p>Next, Syntrix's interpretive and diagnostic work begins. It identifies causal factors, correlates behavioral patterns with business outcomes, and generates narratives and prescriptive recommendations.</p>

<h3 id="step-3---review-the-report">Step 3 - Review the report</h3>

<p>Syntrix generates detailed reports on goal completion, conversational flows, and performance metrics. <a href="work-in-the-simulation-and-training-studio-reports-get-started-with-reports.html">Review these reports</a> for key insights into agent effectiveness.</p>

<h3 id="step-4---optimize-by-training-and-tuning">Step 4 - Optimize by training and tuning</h3>

<p>Optimization ensures that your conversational AI and live agents are always learning, improving, and ready for whatever your real customers bring.
This final, critical step closes the loop of the simulation cycle. Integrate the actionable feedback and detailed performance insights into your operational systems:</p>

<ul>
  <li><strong>For Conversational AI solutions</strong>, this means you tune your AI agents or conventional bots.</li>
  <li><strong>For live agents</strong>, you transform the data into targeted, prescriptive coaching that addresses specific areas of weakness.</li>
  <li>You might also need to iterate on your synthetic customer assets in Syntrix for continuous improvement to your testing and validation solution. For example, you might decide that you need an "obstructive" persona or additional scenarios and add them to the synthetic customer profile.</li>
</ul>

<p>By implementing these changes, you ensure that the next simulation cycle tests an improved version of your solution, continuously raising the bar for customer experience.</p>

<h3 id="related-topics">Related topics</h3>

<ul>
  <li><a href="get-started-at-a-glance.html">Get started - At a glance</a></li>
  <li><a href="work-in-the-simulation-and-training-studio-testing-rollout-test-roll-out-on-conversational-cloud.html">Test &amp; roll out on Conversational Cloud</a></li>
  <li><a href="work-in-the-simulation-and-training-studio-testing-rollout-test-roll-out-on-genesys-cloud.html">Test &amp; roll out on Genesys Cloud</a></li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Warnings &amp; Constraints</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-warnings-constraints.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-warnings-constraints.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="deleting-assets">Deleting assets</h3>

<p>If you delete an asset, such as a scenario or persona, and that asset is used in a synthetic customer profile, you'll see an error for that profile. Also, the system won't let you run any simulations using that profile.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Troubleshooting</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-troubleshooting.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-troubleshooting.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note">Don't see your issue here? Contact your LivePerson representative.</p>

<h3 id="cant-find-skill-in-dropdown-in-scenario">Can't find skill in dropdown in scenario</h3>

<p>Don't see a skill (routing target) that you need? You must import them into Syntrix. (<a href="get-started-manage-skills.html">Learn about managing skills.</a>)</p>

<h3 id="agent-with-wrong-skill-receives-simulated-conversation">Agent with wrong skill receives simulated conversation</h3>

<p>As mentioned in our <a href="work-in-the-simulation-and-training-studio-simulations-best-practices.html">simulation best practices</a>, before running a simulation, ensure the agents on the skills specified in the scenarios are logged in. If they aren't and you have <a href="https://community.liveperson.com/kb/articles/1269-fallback-configuration-per-skill">fallback routing</a> in place, it can happen that agents that you don't intend to receive simulation conversations actually do receive them. Check whether the targeted agents are online.</p>

<h3 id="simulation-appears-to-have-stalled">Simulation appears to have stalled</h3>

<p>If it appears that the simulation is progressing <strong>slowly</strong> and you're using predefined identities, this might be due to the number of simulations that are running and how they are configured. The system ensures that each predefined identity is used in only one active conversation at a time, so simulations using predefined identities can take longer to complete than you might expect. <a href="key-concepts.html#predefined-identities-are-synchronized-to-prevent-collisions">Learn about automatic identity synchronization.</a></p>

<h3 id="simulation-has-failed">Simulation has failed</h3>

<p>Simulations running longer than four hours are regarded as "stuck" and terminated automatically, along with all active conversations. When this happens, the status of the conversations and the overall simulation appear as <strong>Failed</strong> in the UI.</p>

<p>Stuck conversations can happen for various reasons: the live agent failed to respond, the AI agent has a bug, a performance issue within the contact center prevented a message from reaching Syntrix, etc.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Test &amp; Roll Out on Genesys Cloud</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-testing-rollout-test-roll-out-on-genesys-cloud.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-testing-rollout-test-roll-out-on-genesys-cloud.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="ai-agent-validation---rollout-process">AI agent validation - Rollout process</h3>

<p>Ready to validate the performance of your <strong>AI agents</strong>? In this section, we describe the end-to-end rollout process that bridges the gap between Syntrix simulations and the Genesys Cloud agent workspace.</p>

<p>As per our best practices, verify beforehand that the AI agent can effectively handle its total conversation load, accounting for both live customer traffic (if the bot is already in use in Production) and the additional load that will be generated by simulations.</p>

<ol>
  <li>In Genesys Cloud:
    <ol>
      <li>Navigate to <strong>Architect &gt; Digital Bot Flows</strong>, and open the "Syntrix_Bot_Connector" flow.</li>
      <li>In the <strong>Switch</strong> action block, add a new case, and provide the name of your bot. This will be the RoutingTarget value you can use in Syntrix to target your bot.
 <img class="fancyimage" style="width:400px" src="img/syntrix/genesys_addCase.png" alt="Adding a new case and specifying the bot name" /></li>
      <li>In the new path under the Case block that corresponds to your new RoutingTarget value, add a Call Guide, Call Agentic Virtual Agent, or Transfer to Bot Flow action, as desired.
 <img class="fancyimage" style="width:700px" src="img/syntrix/genesys_addAIAgent.png" alt="Adding an Agenetic Virtual Agent" /></li>
      <li>In the call or transfer block, set any required input variables for your bot.</li>
    </ol>

    <p>The simulated conversations handled by your AI agent will not be escalated to your production queues, even if your AI agent is handling production traffic. The conversations will always use the "routing target" defined in the <strong>Skill</strong> field in the Syntrix scenario. If that routing target is an AI Agent, then any escalations will use the <code class="language-html highlighter-rouge">Syntrix_Default</code> queue.</p>
  </li>
  <li>In Syntrix, define the synthetic customer assets (a scenario and a persona at a minimum) that you need to run the simulation. Then configure and start the simulation.</li>
  <li>In the contact center solution, wait for a conversation between the synthetic customer and the AI agent to begin, and monitor its progress.</li>
  <li>In Syntrix, review the results (go to <strong>Simulation workshop</strong>), and click the simulation. You can even watch the results in real time as conversations are completed.</li>
</ol>

<h3 id="agent-training---play-the-agent-before-rollout">Agent training - Play the agent before rollout</h3>

<p>Want to see how your scenarios hold up <strong>before</strong> trying them out with your <strong>live agents</strong>? This section covers the end-to-end testing process—a crucial step where you bridge the gap between Syntrix simulations and the contact center solution's agent workspace.</p>

<p>Instead of waiting for your agents to find a flaw in your setup, you’ll step into the agent’s role and interact with a synthetic customer. It’s the best way to ensure your scenarios and personas feel authentic and work well before rollout to your agents.</p>

<ol>
  <li>In the contact center solution, create a "test" routing target (queue, etc.). Assign this "test" routing target to your own agent user. Also verify that your agent user is available to receive incoming conversations.</li>
  <li>In Syntrix, define the synthetic customer assets (a scenario and a persona at a minimum) that you need to run the simulation. Then configure and start the simulation.</li>
  <li>In the contact center solution, wait for an incoming conversation and accept it. Assume the role of the agent, and chat with the synthetic customer. Close the conversation when appropriate.</li>
  <li>In Syntrix, review the results (go to <strong>Simulation workshop</strong>).</li>
</ol>

<p class="attn-note">When you're ready for your agents to participate in simulations, in the relevant scenarios, replace the "test" routing target (called a "skill" in the UI) with one that's in use in Production. Then begin your simulations as per your requirements.</p>

<h3 id="related-topics">Related topics</h3>

<ul>
  <li><a href="work-in-the-simulation-and-training-studio-your-iterative-workflow.html">Your iterative workflow</a> in the simulation and training studio</li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Test &amp; Roll Out on Conversational Cloud</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-testing-rollout-test-roll-out-on-conversational-cloud.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-testing-rollout-test-roll-out-on-conversational-cloud.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="ai-agent-validation---rollout-process">AI agent validation - Rollout process</h3>

<p>Ready to validate the performance of your AI agents? In this section, we describe the end-to-end rollout process that bridges the gap between Syntrix simulations and the Conversational Cloud agent workspace.</p>

<ol>
  <li>As per our best practices, verify beforehand that the AI agent can effectively handle its total conversation load, accounting for both live customer traffic (if the bot is already in use in Production) and the additional load that will be generated by simulations. You might need to add additional agent connectors. <a href="work-in-the-simulation-and-training-studio-simulations-best-practices.html#scale-ai-agents-for-high-availability-and-load">See the best practice.</a></li>
  <li>In Conversational Cloud:
    <ol>
      <li>Create a skill that's dedicated for simulations, that is, the skill will only be used by Syntrix. (<strong>Manage &gt; Users &amp; Skills &gt; Skills</strong>).</li>
      <li>Assign the skill to your AI agent's bot user (<strong>Manage &gt; Users &amp; Skills &gt; Users</strong>).</li>
    </ol>

    <p>Even if the AI agent is handling live traffic, simulations will only be generated on the skill you specify in the scenario in Syntrix. You do this next.</p>
  </li>
  <li>In Syntrix, <a href="work-in-the-simulation-and-training-studio-synthetic-customer-profiles-manage-synthetic-customer-profiles.html">define the synthetic customer assets</a> (<a href="work-in-the-simulation-and-training-studio-scenarios-manage-scenarios.html">scenario</a> and <a href="work-in-the-simulation-and-training-studio-personas-manage-personas.html">persona</a> at a minimum) that you need to run the simulation. Then configure and start the simulation.</li>
  <li>In Conversational Cloud: On the <strong>All Conversations</strong> tab in the <strong>Agent Workspace</strong>, wait for a conversation between the synthetic customer and the AI agent to begin, and monitor its progress.</li>
  <li>In Syntrix, review the results (go to <strong>Simulation workshop</strong>), and click the simulation. You can even watch the results in real time as conversations are completed.</li>
</ol>

<h3 id="agent-training---play-the-agent-before-rollout">Agent training - Play the agent before rollout</h3>

<p>Want to see how your scenarios hold up <strong>before</strong> trying them out with your live agents? This section covers the end-to-end testing process—a crucial step where you bridge the gap between Syntrix simulations and the Conversational Cloud agent workspace.</p>

<p>Instead of waiting for your agents to find a flaw in your setup, you’ll step into the agent’s role and interact with a synthetic customer. It’s the best way to ensure your scenarios and personas feel authentic and work well before rollout to your agents.</p>

<ol>
  <li>In Conversational Cloud, create a "test" skill (<strong>Manage &gt; Users &amp; Skills &gt; Skills</strong>). Assign the test skill to your own user. Make sure your user is assigned the <strong>Agent</strong> role. (<a href="get-started-manage-skills.html">Learn how to import skills.</a>)</li>
  <li>In Syntrix, define the synthetic customer assets (scenario and persona at a minimum) that you need to run the simulation. Then configure and start the simulation.</li>
  <li>In Conversational Cloud:
    <ol>
      <li>If your account is using "Manual mode," listen for the ring that signals an incoming conversation, and accept the conversation. Or, if it's using "Auto accept," just check your conversation list in <strong>My Conversations</strong>. (<a href="https://community.liveperson.com/kb/articles/1566-agent-workspace-user-guide#managing-messaging-conversations">Learn more about these modes.</a>)</li>
      <li>Assume the role of the agent, and chat with the synthetic customer via the <strong>My Conversations</strong> tab.</li>
      <li>Close the conversation when appropriate.</li>
    </ol>
  </li>
  <li>In Syntrix, review the results (go to <strong>Simulation workshop</strong>).</li>
</ol>

<p class="attn-note">When you're ready for your agents to participate in simulations, in the relevant scenarios, replace the "test" skill with one that's in use in Production. Then begin your simulations as per your requirements.</p>

<h3 id="related-topics">Related topics</h3>

<ul>
  <li><a href="work-in-the-simulation-and-training-studio-your-iterative-workflow.html">Your iterative workflow</a> in the simulation and training studio</li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage the Contact Center</title>
      <link>https://developers.liveperson.com/get-started-manage-the-contact-center.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/get-started-manage-the-contact-center.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>Syntrix is designed to support the configuration of one contact center at a time, although you can delete the existing one and set up a different contact center whenever necessary.</p>

<p>You can create synthetic customer assets in Syntrix at any time. However, you can only run simulations <strong>after</strong> you add your contact center to Syntrix.</p>

<h3 id="prerequisites">Prerequisites</h3>

<p>To request to onboard to Syntrix, contact your LivePerson representative.</p>

<p>In turn, your LivePerson representative will contact the onboarding team. They'll create an account with a single user for your brand. <a href="get-started-manage-your-account-and-users.html#invite-a-user-to-join">Invite others</a> as needed.</p>

<h3 id="add-a-liveperson-conversational-cloud-contact-center">Add a LivePerson Conversational Cloud contact center</h3>

<ol>
  <li>Log into Syntrix.</li>
  <li>On the left navigation bar, click <strong>Settings</strong>, and then click <strong>Contact center</strong>.</li>
  <li>From the dropdown, select "LivePerson Conversational Cloud."</li>
  <li>
    <p>Specify the following:</p>

    <p><img class="fancyimage" style="width:800px" src="img/syntrix/setup_convCloud_inSyntrix.png" alt="The form to complete in Syntrix to add Conversational Cloud as a contact center" /></p>

    <ul>
      <li><strong>Name</strong>: Enter an arbitrary name to identify the contact center within Syntrix.</li>
      <li><strong>Account ID</strong>: The Conversational Cloud account (brand) ID that routes inbound open messages to this contact center.</li>
      <li><strong>Client ID</strong>: OAuth2 credentials are used to authenticate Syntrix with Conversational Cloud and generate a bearer token to perform agent name lookups. So, in Conversational Cloud, you need to create an OAuth2 app for Syntrix, specify its scope, and enter here the OAuth2 app's client ID. Need help creating the app and obtaining the client ID? See the subsection that follows for help with this.</li>
      <li><strong>Client secret</strong>: The client secret for the client ID that you specified. See the subsection that follows for help with this.</li>
    </ul>

    <p class="attn-note">If the client ID and client secret that you specify are invalid, use of Syntrix with Conversational Cloud will work, but the system won't be able to resolve agent names. This will impact all reporting views.</p>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h4 id="obtain-the-client-id-and-client-secret">Obtain the client ID and client secret</h4>

<ol>
  <li>In Conversational Cloud, click <strong>Manage &gt; Management Console</strong>.</li>
  <li>Search for "Application Management."</li>
  <li>Select <strong>App Install Administration</strong> from the search results.</li>
  <li>Click <strong>Proceed to configure</strong>.</li>
  <li>Scroll down to Application Management, and click <strong>Create Application</strong>.</li>
  <li>
    <p>Under General, specify the following:</p>

    <p><img class="fancyimage" style="width:800px" src="img/syntrix/setup_convCloud_appName.png" alt="Specifying an application name and description for the OAuth application" /></p>

    <ul>
      <li><strong>Application name</strong>: Enter a name to identify the application, for example, "Syntrix-Application."</li>
      <li><strong>Description</strong>: Enter a description, for example, "An application that enables Syntrix to use API calls to map agent IDs to agent names, and skill IDs to skill names."</li>
    </ul>
  </li>
  <li>
    <p>Under <strong>API Permissions &gt; Administration</strong>, select the following:</p>

    <p><img class="fancyimage" style="width:300px" src="img/syntrix/setup_convCloud_permissions.png" alt="Specifying read permissions for users and skills" /></p>

    <ul>
      <li><strong>Users &gt; Read</strong></li>
      <li><strong>Skills &gt; Read</strong></li>
    </ul>
  </li>
  <li>Click <strong>Create</strong>.</li>
  <li>In the Application Management table, beside the application name, click the 3-dot icon, and click <strong>Edit</strong>.</li>
  <li>
    <p>Scroll down to <strong>Authentication details</strong>, and copy both the <strong>Client ID</strong> and <strong>Client secret</strong> to a location of your choosing.</p>

    <p><img class="fancyimage" style="width:800px" src="img/syntrix/setup_convCloud_clientIDandSecret.png" alt="Copying the client ID and client secret for the app" /></p>

    <p>You can now return to the Contact Center configuration form in Syntrix, and paste in these credentials.</p>
  </li>
</ol>

<h3 id="add-a-genesys-cloud-contact-center">Add a Genesys Cloud contact center</h3>

<h4 id="before-you-begin">Before you begin</h4>

<p>The onboarding team will configure your Genesys account to support Syntrix. They'll also communicate with you about related steps and important details, for example, how to share client secrets securely. Once their work is completed, they'll engage your LivePerson representative with the details that you need to add the contact center to Syntrix. This info includes OAuth credentials and a webhook token that are then shared with you.</p>

<p>The onboarding process automatically creates a default routing queue in Genesys, assigning it a name that's prepended with "Syntrix_Default." Its purpose is to handle invalid routing targets from Syntrix. (In Syntrix, you specify a routing target in the <strong>Skill</strong> field in a scenario.) Once Genesys setup is complete, you can add test users to this fallback queue.</p>

<h4 id="add-the-genesys-cloud-contact-center">Add the Genesys Cloud contact center</h4>

<ol>
  <li>On the left navigation bar, click <strong>Settings</strong>, and then click <strong>Contact center</strong>.</li>
  <li>From the dropdown, select "Genesys Cloud."</li>
  <li>
    <p>Specify the following:</p>

    <p><img class="fancyimage" style="width:800px" src="img/syntrix/setup_genesys.png" alt="The form to complete in Syntrix to add Genesys Cloud as a contact center" /></p>

    <ul>
      <li><strong>Name</strong>: Enter an arbitrary name to identify the contact center within Syntrix.</li>
      <li><strong>Account ID</strong>: The Genesys integration ID that routes inbound open messages to this contact center.</li>
      <li><strong>Region</strong>: The AWS region where your Genesys Cloud organization is hosted, for example, "ap-southeast-2," "us-east-1," and so on.</li>
      <li><strong>Domain</strong>: The Genesys Cloud domain for the region, for example, "mypurecloud.com.au," "mypurecloud.com," and so on.</li>
      <li><strong>Client ID</strong>, <strong>Client secret</strong>, and <strong>Webhook secret</strong>: These will be shared with you by the onboarding team.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="delete-a-contact-center">Delete a contact center</h3>

<p>You can delete a contact center as long as there isn't a simulation that's in progress.</p>

<ol>
  <li>On the left navigation bar, click <strong>Settings</strong>, and then click <strong>Contact center</strong>.</li>
  <li>In the lower-left corner, click <strong>Delete</strong>.</li>
  <li>In the confirmation dialog, click <strong>Delete</strong> to confirm the action.</li>
</ol>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage Your Account and Users</title>
      <link>https://developers.liveperson.com/get-started-manage-your-account-and-users.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/get-started-manage-your-account-and-users.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="log-in">Log in</h3>

<ol>
  <li>Navigate to the login URL for your region: <a href="https://usea1.syntrixplatform.com/">NA URL</a>, <a href="https://euwe1.syntrixplatform.com/">EMEA URL</a>, or <a href="https://ause1.syntrixplatform.com/">APAC URL</a></li>
  <li>Enter your email address and password.</li>
  <li>Click <strong>Continue</strong>.</li>
</ol>

<h3 id="user-roles">User roles</h3>

<p>In the current release, only the role of <strong>Admin</strong> is supported; this role has full privileges. Importantly, this means that user A can edit the synthetic customer assets (scenarios, personas, etc.) of user B.</p>

<h3 id="invite-a-user-to-join">Invite a user to join</h3>

<p>Invitations to join an account expire after a week.</p>

<ol>
  <li>On the left navigation bar, click <strong>Settings</strong>, and then click <strong>Invite user</strong>.</li>
  <li>
    <p>Enter the user’s email address.</p>

    <p class="attn-alert">The email address cannot be changed, so take care when specifying it.</p>
  </li>
  <li>
    <p>Click <strong>Invite</strong>.</p>

    <p>A message is displayed to confirm that an invitation email has been sent to the user.</p>
  </li>
</ol>

<h3 id="accept-an-invite-to-join">Accept an invite to join</h3>

<ol>
  <li>In the invitation email that you received, click <strong>Accept invitation</strong>.</li>
  <li>On the Syntrix login page, specify a password that you’ll use to log in.</li>
</ol>

<h3 id="resend-an-invitation">Resend an invitation</h3>

<p>If for some reason the user no longer has their invitation email, you can quickly and easily resend it.</p>

<ol>
  <li>On the left navigation bar, click <strong>Settings</strong>, and then click the <strong>Resend invitation</strong> icon beside that user.</li>
  <li>Click <strong>Resend</strong>.</li>
</ol>

<h3 id="remove-a-user">Remove a user</h3>

<ol>
  <li>On the left navigation bar, click <strong>Settings</strong>, move the cursor over the user's row, and click the <strong>Remove from organization</strong> icon that appears.</li>
  <li>Click <strong>Remove</strong>.</li>
</ol>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage Tags</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-tags-manage-tags.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-tags-manage-tags.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="create-a-tag">Create a tag</h3>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder &gt; Tags</strong>.</li>
  <li>Click <strong>Add</strong>.</li>
  <li>Specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a short name for the tag, for example, "High urgency - Retention" or "Support team."</li>
      <li><strong>Description</strong>: Provide a brief explanation of what the tag represents and when it should be applied. This provides context for the tag’s purpose, ensuring consistent categorization of assets in Syntrix and helping users to understand the training focus (e.g., technical vs. emotional) associated with the label.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="delete-a-tag">Delete a tag</h3>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder &gt; Tags</strong>.</li>
  <li>Move the cursor over the row for the tag that you want to delete, and click the delete icon that appears.</li>
  <li>Click <strong>Delete</strong>.</li>
</ol>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage Synthetic Customer Profiles</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-synthetic-customer-profiles-manage-synthetic-customer-profiles.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-synthetic-customer-profiles-manage-synthetic-customer-profiles.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note"><a href="work-in-the-simulation-and-training-studio-synthetic-customer-profiles-best-practices.html">Learn about best practices for synthetic customer profiles.</a></p>

<h3 id="create-a-synthetic-customer-profile-using-ai">Create a synthetic customer profile using AI</h3>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder</strong>.</li>
  <li>
    <p>On the <strong>Synthetic customers</strong> tab, click <strong>Add</strong>.</p>

    <p><img class="fancyimage" style="width:800px" src="img/syntrix/profile_new.png" alt="The new synthetic customer profile form" /></p>
  </li>
  <li>
    <p>Enter a minimum of 1 - 3 sentences that describe the general area of brand-to-consumer interaction and several related queries or issues.</p>

    <p><strong>Example</strong>: An online shopper contacting customer service about common post-purchase issues. Please include scenarios such as: a delayed shipment that hasn't arrived by the promised date, a return request for an item that didn't match the description, and a promo code that failed to apply at checkout.</p>
  </li>
  <li>
    <p>Click <strong>Generate</strong>.</p>

    <p><img class="fancyimage" style="width:800px" src="img/syntrix/profile_new2.png" alt="The form in which to select from AI-generated scenarios and the account's personas" /></p>

    <p>The system generates a title and a description for the profile. It also finds or generates the synthetic customer assets as follows:</p>

    <p><strong>Scenarios</strong>: The system uses the description that you provided in step 3 to generate 3 - 5 scenarios. Then it discards any AI-generated scenarios that match your existing ones (titles are compared). This prevents duplication within the profile and ensures any relevant scenarios that you defined are incorporated.</p>

    <p><strong>Personas</strong>: The system randomly selects up to 5 personas from your acount based on availability. These include both the predefined scenarios that are provided by default and any custom personas that you've created.</p>

    <p>These scenario and persona "candidates" are then shown to you for review and selection.</p>
  </li>
  <li>Select the scenarios and personas to include in the profile. You must select at least one of each. You can also edit any AI-generated scenarios at this point.</li>
  <li>
    <p>For each selected scenario, select the skill (routing target) that gets this scenario to the proper live agents or AI agents.</p>

    <p>The scenario's skill is required info. If you try to proceed without completing step 6, the system shows a warning:</p>

    <p><img class="fancyimage" style="width:500px" src="img/syntrix/profile_new3.png" alt="Validation messsage on the Skill field for a scenario; skill is required" /></p>
  </li>
  <li>
    <p>Click <strong>Start with this synthetic customer</strong>.</p>

    <p>You are free to add more scenarios and personas to the profile at this point if desired.</p>
  </li>
</ol>

<h3 id="create-a-synthetic-customer-profile-manually">Create a synthetic customer profile manually</h3>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder</strong>.</li>
  <li>On the <strong>Synthetic customer</strong> tab, click <strong>Add</strong>.</li>
  <li>In the lower-left corner of the window that appears, click <strong>Skip and create manually</strong>.</li>
  <li>Specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a meaningful name for the profile.</li>
      <li><strong>Description</strong>: Describe the profile's purpose or objective.</li>
      <li><strong>Tags</strong>: Optionally, associate tags with the profile. <a href="work-in-the-simulation-and-training-studio-tags-manage-tags.html">Tags</a> facilitate rapid filtering and organization, allowing you to quickly identify profiles based on specific technical topics, difficulty levels, teams or departments, and more.</li>
      <li><strong>Personas</strong>: Select the personas to include in the profile.</li>
      <li><strong>Scenarios</strong>: Select the scenarios to include in the profile.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="delete-a-synthetic-customer-profile">Delete a synthetic customer profile</h3>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder</strong>.</li>
  <li>On the <strong>Synthetic customer</strong> tab, move the cursor over the row for the profile that you want to delete, and click the delete icon that appears.</li>
  <li>Click <strong>Delete</strong>.</li>
</ol>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage Skills</title>
      <link>https://developers.liveperson.com/get-started-manage-skills.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/get-started-manage-skills.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>In a contact center, a "routing target" is a foundational building block that's used to direct an incoming conversation to the most appropriate agent based on area of expertise (Sales, Support, VIP customers, etc.). This destination has different names in different contact center solutions: In LivePerson's Conversational Cloud, it's called a "skill." In other contact centers, it might be referred to as a "routing target" or "queue."</p>

<p>Within Syntrix, the routing target or destination is referred to as a "skill," so this documentation follows suit.</p>

<p>When you <a href="work-in-the-simulation-and-training-studio-scenarios-manage-scenarios.html">create a scenario</a>, you must select the skill that the agent must be assigned in order to receive a conversation with a synthetic customer about the scenario. So, before you get started with building your synthetic customer assets, you need to populate Syntrix with your skills (routing targets).</p>

<h3 id="important-notes">Important notes</h3>

<ul>
  <li>The <strong>Skills</strong> tab under <strong>Settings</strong> is hidden until you <a href="get-started-manage-the-contact-center.html">add a contact center</a> to the account.</li>
  <li>If you alter the skills that are defined outside of Syntrix (rename, delete, etc.), take care to update Syntrix accordingly. Re-import the skills into Syntrix (described below), and update impacted scenarios accordingly.</li>
</ul>

<h3 id="create-the-csv-file-of-skills">Create the CSV file of skills</h3>

<p>To import skills into Syntrix, you need to use a CSV file. This import file must contain the following required columns:</p>

<ul>
  <li><strong>Skill ID</strong>: The unique identifier for the routing target</li>
  <li><strong>Skill name</strong>: The display name of the routing target</li>
</ul>

<p><img class="fancyimage" style="width:300px" src="img/syntrix/skills_csv.png" alt="An illustration of valid import file with two required columns" /></p>

<p class="attn-tip"><strong>Conversational Cloud users</strong>: You can quickly and easily generate the import file by exporting your skills from Conversational Cloud: Click <strong>Manage &gt; Users &amp; Skills</strong>, and click the <strong>Skills</strong> tab. In the upper-right corner, select <strong>Actions &gt; Export all</strong>. This downloads a ZIP containing several CSVs, including a <code class="language-html highlighter-rouge">Skills.csv</code>. Extract the <code class="language-html highlighter-rouge">Skills.csv</code> to a location of your choice.</p>

<h3 id="import-skills-into-syntrix">Import skills into Syntrix</h3>

<ol>
  <li>On the left navigation bar, click <strong>Settings</strong>.</li>
  <li>Select the <strong>Skills</strong> tab.</li>
  <li>Click <strong>Import Skills</strong>.</li>
  <li>
    <p>Click <strong>Select CSV file</strong>, navigate to and select the import file that you created. Click <strong>Import</strong>.</p>

    <p>This imports the skills into Syntrix, so you can use them when creating scenarios.</p>

    <p class="attn-note">You'll need to import skills whenever you add new ones to your contact center. Learn more below.</p>
  </li>
</ol>

<h3 id="update-skills">Update skills</h3>

<p>The import of skills does a <strong>complete replacement</strong> of your skills in Syntrix. That is, in Syntrix all existing skills are deleted, and then the skills in the CSV file are added.</p>

<p>Consider the following workflow:</p>

<ol>
  <li>You delete Skill A in your contact center application.</li>
  <li>You perform an import of your current skills into Syntrix.</li>
</ol>

<p>In this case, Skill A will be deleted from Syntrix.</p>

<p>If you have any scenarios using Skill A, the system shows an error for those scenarios: Check <strong>Synthetic customer builder &gt; Scenarios</strong>. Replace Skill A with another suitable skill.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage Simulations</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-simulations-manage-simulations.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-simulations-manage-simulations.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="run-a-simulation-immediately">Run a simulation immediately</h3>

<p class="attn-note"><a href="work-in-the-simulation-and-training-studio-simulations-best-practices.html">Learn about best practices.</a></p>

<ol>
  <li>On the left navigation bar, click <strong>Simulation workshop</strong>, and then click <strong>New simulation</strong>.</li>
  <li>
    <p><strong>Simulation type</strong>: Choose the type of simulation. While this field doesn't currently affect simulation behavior, make an accurate selection, so your data is meaningful when options based on this value are introduced. Types include:</p>

    <ul>
      <li><strong>Test AI agents</strong> - This is for testing AI agents or conventional bots.</li>
      <li><strong>Train live agents</strong> - The process is transparent and for skill-building and practice.</li>
      <li><strong>Audit live agents</strong> - You're discreetly evaluating agents' performance without their knowledge.</li>
    </ul>
  </li>
  <li><strong>Synthetic customer</strong>: Do either of the following:
    <ul>
      <li>Select <strong>Use existing</strong> to use an existing synthetic customer profile. This is fastest. In this case, select the profile from the dropdown.</li>
      <li>Select <strong>Choose scenarios and personas</strong> to manually select the ones you want to use for only this simulation. Then select the relevant scenarios and personas from the dropdowns.</li>
    </ul>
  </li>
  <li>
    <p><strong>Customer identity</strong>: Choose the type of identity to use:</p>

    <ul>
      <li><strong>Generate random identity</strong>: The identities of all synthetic customers in the simulation are generated randomly. This is the case even if you have predefined identities specified in the scenarios; those predefined identities are not used.</li>
      <li><strong>Make customer anonymous</strong>: The synthetic customer is assigned only a random consumer ID.</li>
      <li><strong>Use predefined identity</strong>: The synthetic customer is assigned one of the predefined identities that's specified in the scenario. (Learn <a href="key-concepts.html#predefined-identities-are-synchronized-to-prevent-collisions">how and why identities are synchronized automatically</a> to ensure each predefined identity is used in only one active conversation at a time.)</li>
    </ul>

    <p class="attn-alert">If you use predefined identities, but some of the scenarios don't have any associated, the system warns you of this. Random identities are then used only for those scenarios.</p>
  </li>
  <li>
    <p><strong>Routing details</strong>: Choose how to route the conversations:</p>

    <ul>
      <li><strong>Start each conversation on scenario's skill</strong>: This keeps the initial routing more targeted.</li>
      <li><strong>Start all conversations on same skill</strong>: This override's the scenario's setup. It's useful for end-to-end testing or training, where conversations should start on an initial skill.</li>
    </ul>
  </li>
  <li>
    <p><strong>Name</strong>: Enter a name for the simulation.</p>

    <p class="attn-tip">We recommend you surface in the name a short descriptor for the target AI agent or live agent group. Also consider including your team or line of business, the specific use case, and a version or date. This makes it easy to identify your simulations at a glance and avoid confusion when multiple teams are working in the same environment. Strategies like these help you to remember why you ran the simulation.</p>
  </li>
  <li><strong>Description</strong>: Optionally enter a short description of the simulation's objective or purpose.</li>
  <li><strong>Total conversations</strong>: Specify the total number of conversations in the simulation.</li>
  <li><strong>Max. concurrent conversations</strong>: Specify the maximum number of concurrent conversations overall in the simulation, <strong>not</strong> per agent. The upper limit is determined by the <strong>Total conversations</strong> setting or the predefined system maximum, whichever is lower. Actual concurrency can vary if you're using predefined identities; <a href="key-concepts.html#predefined-identities-are-synchronized-to-prevent-collisions">learn more</a>.</li>
  <li>
    <p><strong>Max. conversation turns</strong>: Specify the maximum number of turns in each conversation. If this limit is reached, the conversation is closed by the system.</p>

    <p>A turn is a series of responses by the same participant; it ends when the participant changes.</p>
  </li>
  <li>
    <p>Click <strong>Run simulation</strong>.</p>

    <p class="attn-note">After a simulation is completed, it takes a few minutes for the assessment to appear.</p>
  </li>
</ol>

<h3 id="stop-a-simulation">Stop a simulation</h3>

<p>You can stop a simulation for any reason. For example, you might realize there's a mistake in the configuration, and you don't want the simulation to continue to run. Stopping a simulation closes all in-progress simulations in the agent workspace.</p>

<p><strong>Transcripts</strong>: When you stop a simulation, you have access to the conversation transcripts for all conversations that were completed before the simulation was stopped. However, transcripts for any conversations that were in progress at the time of the stop are discarded and are not available.</p>

<p><strong>Assessments</strong>: No overall summary, simulation assessment, or agent assessment results are available for a stopped simulation, as these reports are only generated once a simulation has reached its natural completion. While conversation assessments are provided, they are only available for the specific conversations that were completed before the simulation was stopped.</p>

<h4 id="to-stop-a-simulation">To stop a simulation</h4>

<ol>
  <li>On the left navigation bar, click <strong>Simulation workshop</strong>.</li>
  <li>Highlight the row for the simulation that you want to stop, and click the stop icon that appears.</li>
  <li>Click <strong>Stop</strong> again to confirm the action.</li>
</ol>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage Scenarios</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-scenarios-manage-scenarios.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-scenarios-manage-scenarios.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note"><a href="work-in-the-simulation-and-training-studio-scenarios-best-practices.html">Learn about scenario best practices.</a></p>

<h3 id="create-a-scenario-using-ai">Create a scenario using AI</h3>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder &gt; Scenarios</strong>.</li>
  <li>
    <p>Click <strong>Add</strong>.</p>

    <p><img class="fancyimage" style="width:800px" src="img/syntrix/scenario_new.png" alt="The new scenario form" /></p>
  </li>
  <li>
    <p>In 1-3 sentences briefly define why the customer is contacting you and what they want from their perspective. Also optionally define how you measure your agent's success in this case. AI will generate the scenario and many details.</p>

    <p><strong>Example</strong>: You signed up for the Premium Plan a couple of weeks ago. You were charged $49.99 but your account still shows the Free Plan features. You want this resolved immediately — either activate the features you paid for or give you a full refund.</p>
  </li>
  <li>
    <p>Click <strong>Generate</strong>.</p>

    <p><img class="fancyimage" style="width:800px" src="img/syntrix/scenario_new2.png" alt="The new scenario form with details populated" /></p>
  </li>
  <li>Review the scenario details to ensure they meet your requirements. Make any desired changes.</li>
  <li><strong>Tags</strong>: Optionally associate tags with the scenario. <a href="work-in-the-simulation-and-training-studio-tags-manage-tags.html">Tags</a> facilitate rapid filtering and organization, allowing you to quickly identify scenarios based on specific technical topics, difficulty levels, teams or departments, and more.</li>
  <li>
    <p><strong>Skill</strong>: Select the routing target that the agent must be assigned to interact with a synthetic customer about this scenario. (<a href="get-started-manage-skills.html">Learn more about skills.</a>)</p>

    <p>Don't see the skill that you need in the list? Click <strong>Assign unlisted skill</strong> to associate the skill, but be aware that this doesn't add the skill to your list of skills in <strong>Settings</strong>. Alternatively, you can <a href="get-started-manage-skills.html">import the skill into Syntrix</a>, so it will appear in the list.</p>

    <p class="attn-alert">Make an accurate skill selection or entry; the system doesn't perform any validation to ensure the skill exists.</p>
  </li>
  <li>
    <p><strong>Identities</strong>: Optionally select one or more identities to associate them with the scenario. (<a href="key-concepts.html#identities-are-distributed-across-conversations">Learn how identities are distributed across conversations in a simulation.</a>)</p>

    <p class="attn-note">You can reuse identities in multiple scenarios.</p>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="create-a-scenario-manually">Create a scenario manually</h3>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder &gt; Scenarios</strong>.</li>
  <li>Click <strong>Add</strong>.</li>
  <li>In the lower-left corner of the window that appears, click <strong>Skip and create manually</strong>.</li>
  <li>
    <p>Specify the following:</p>

    <ul>
      <li><strong>Name</strong>: Briefly describe the main topic or situation.</li>
      <li><strong>Description</strong>: Describe in detail the customer’s case and needs, and provide all important context. Put the customer's goals here; <strong>don't</strong> put them in the scenario's agent goals.</li>
      <li><strong>Tags</strong>: Optionally associate tags with the scenario. <a href="work-in-the-simulation-and-training-studio-tags-manage-tags.html">Tags</a> facilitate rapid filtering and organization, allowing you to quickly identify scenarios based on specific technical topics, difficulty levels, teams or departments, and more.</li>
      <li><strong>Agent goals</strong>: Define the benchmarks that determine agent success in this specific scenario. Goals should be scenario-specific, so, for example, "Agent was empathetic" isn't appropriate. Add at least one goal.</li>
      <li>
        <p><strong>Skill</strong>: Select the routing target that the agent must be assigned to interact with a synthetic customer about this scenario. (<a href="get-started-manage-skills.html">Learn more about skills.</a>)</p>

        <p>Don't see the skill that you need in the list? Click <strong>Assign unlisted skill</strong> to associate the skill, but be aware that this doesn't add the skill to your list of skills in <strong>Settings</strong>. Alternatively, you can <a href="get-started-manage-skills.html">import the skill into Syntrix</a>, so it will appear in the list.</p>
      </li>
    </ul>

    <p class="attn-alert">Make an accurate skill selection; the system doesn't perform any validation to ensure the skill exists.</p>

    <ul>
      <li><strong>Identities</strong>: Optionally select one or more identities to associate them with the scenario. (<a href="key-concepts.html#identities-are-distributed-across-conversations">Learn how identities are distributed across conversations in a simulation.</a>)</li>
    </ul>

    <p class="attn-note">You can reuse identities in multiple scenarios.</p>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="delete-a-scenario">Delete a scenario</h3>

<p>Before deleting a scenario, ensure it isn't being used in a profile. If it is, this will render the profile unusable, so update the profile as needed beforehand.</p>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder &gt; Scenarios</strong>.</li>
  <li>Move the cursor over the row for the scenario that you want to delete, and click the delete icon that appears.</li>
  <li>Click <strong>Delete</strong>.</li>
</ol>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage Personas</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-personas-manage-personas.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-personas-manage-personas.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note"><a href="work-in-the-simulation-and-training-studio-personas-best-practices.html">Learn about persona best practices.</a></p>

<h3 id="create-a-persona-using-ai">Create a persona using AI</h3>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder &gt; Personas</strong>.</li>
  <li>
    <p>Click <strong>Add</strong>.</p>

    <p><img class="fancyimage" style="width:800px" src="img/syntrix/persona_new.png" alt="The new persona form" /></p>
  </li>
  <li>Enter a few sentences that describes the personality with a focus on the communication style. You can include patience level, vocabulary complexity, emotional volatility, behavioral cues, how they escalate (or don't), whether or not they provide info proactively, etc. AI will generate the persona and all details.</li>
  <li>
    <p>Click <strong>Generate</strong>.</p>

    <p><img class="fancyimage" style="width:800px" src="img/syntrix/persona_new2.png" alt="The new persona form with details populated" /></p>
  </li>
  <li>Review the persona details to ensure they meet your requirements. Make any desired changes.</li>
  <li><strong>Tags</strong>: Optionally associate tags with the persona. <a href="work-in-the-simulation-and-training-studio-tags-manage-tags.html">Tags</a> facilitate rapid filtering and organization, allowing you to quickly identify personas based on specific technical topics, difficulty levels, teams or departments, or emotional complexity.</li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="create-a-persona-manually">Create a persona manually</h3>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder &gt; Personas</strong>.</li>
  <li>Click <strong>Add</strong>.</li>
  <li>In the lower-left corner of the window that appears, click <strong>Skip and create manually</strong>.</li>
  <li>
    <p>Specify the following:</p>

    <ul>
      <li><strong>Name</strong>: This isn’t a person’s name, such as Jane Doe. It’s a name for the persona, such as “Angry Customer.”</li>
      <li><strong>Description</strong>: Provide a robust description of the persona.</li>
      <li><strong>Tags</strong>: Optionally associate tags with the persona. <a href="work-in-the-simulation-and-training-studio-tags-manage-tags.html">Tags</a> facilitate rapid filtering and organization, allowing you to quickly identify personas based on specific technical topics, difficulty levels, teams or departments, or emotional complexity.</li>
      <li><strong>Traits</strong>: Enter typical characteristics of a person of this type.</li>
      <li><strong>Typical responses</strong>: Enter a series of typical comments made by the persona.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="delete-a-persona">Delete a persona</h3>

<p>Before deleting a persona, ensure it isn't being used in a profile. If it is, this will render the profile unusable, so update the profile as needed beforehand.</p>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder &gt; Personas</strong>.</li>
  <li>Move the cursor over the row for the persona that you want to delete, and click the delete icon that appears.</li>
  <li>Click <strong>Delete</strong>.</li>
</ol>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage Identities</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-identities-manage-identities.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-identities-manage-identities.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="create-an-identity">Create an identity</h3>

<p class="attn-note"><a href="work-in-the-simulation-and-training-studio-identities-best-practices.html">Learn about best practices.</a></p>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder &gt; Identities</strong>.</li>
  <li>Click <strong>Add</strong>.</li>
  <li>
    <p>Specify values for at least the required fields. In some cases, a <strong>Generate</strong> button is available, so you can use AI to quickly generate a value instead.</p>

    <ul>
      <li><strong>First name</strong>: Enter a name.</li>
      <li><strong>Last name</strong>: Enter a name.</li>
      <li><strong>Email</strong>: Enter an email address.</li>
      <li><strong>Customer ID</strong>: If you're setting up your backend training or CRM system with a fictitious customer record for this identity, enter the corresponding ID.</li>
      <li>
        <p><strong>Phone number</strong>: Enter a phone number.</p>

        <p class="attn-alert">LivePerson can't perform a check to ensure the email or phone number doesn't belong to an actual person, so if your workflows require agents to contact customers via email, SMS, or voice, ensure all contact data is technically valid and monitored by your team.</p>
      </li>
      <li><strong>Description</strong>: Enter any customer-specific details that the synthetic customer should know and be able to relay to the agent. This info is included in the prompt that's sent to the LLM to guide synthetic customer generation. Examples include preferred nickname (for rapport-building), birthday (for "surprise and delight"), and lead source (referral, social media ad, etc.). <strong>Don't</strong> specify scenario-specific info in this field; keep those details in the scenario's definition.</li>
      <li><strong>Tags</strong>: Optionally, associate tags with the identity. <a href="work-in-the-simulation-and-training-studio-tags-manage-tags.html">Tags</a> facilitate rapid filtering and organization, allowing you to quickly identify identities based on specific technical topics, difficulty levels, teams or departments, and more.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="delete-an-identity">Delete an identity</h3>

<ol>
  <li>On the left navigation bar, click <strong>Synthetic customer builder &gt; Identities</strong>.</li>
  <li>Move the cursor over the row for the identity that you want to delete, and click the delete icon that appears.</li>
  <li>Click <strong>Delete</strong>.</li>
</ol>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Language Support</title>
      <link>https://developers.liveperson.com/language-support.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/language-support.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>A synthetic customer is a polyglot by design, but refer to <a href="https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/google-models#expandable-1">this Google page</a> for the list of languages supported by the underlying Gemini model.</p>

<p>LLMs have a strong bias towards English for instructions and internal reasoning, so we recommend that you <a href="work-in-the-simulation-and-training-studio-personas-manage-personas.html">create the persona</a> as follows:</p>

<ul>
  <li><strong>Name</strong> and <strong>Description</strong>: Enter these in English. Using English for this data leverages the LLM's core logic and instruction-following strengths.</li>
  <li><strong>Traits</strong>: Here again, enter these in English for the same reasons. Importantly, provide the language-related instructions, for example, "This persona is a native of Madrid and speaks Castilian Spanish with local idioms."</li>
  <li><strong>Typical responses</strong>: Provide these examples in the actual, target language (e.g., Castilian Spanish) to set the correct tone, syntax, and cultural "flavor."</li>
</ul>

<p>Traits are instructions to the LLM (how it should behave), while typical responses are examples of output (what it should sound like). These operate at different layers of the LLM's processing, thus the different language recommendations.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Key Terms</title>
      <link>https://developers.liveperson.com/key-terms.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/key-terms.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="synthetic-customer">Synthetic customer</h3>

<p>A synthetic customer is an AI agent designed to simulate real-world interactions and stress-test your customer service systems. Think of it as an "always ready" tester that can constantly probe for potential failures. Unlike traditional, rigid test scripts, a synthetic customer is dynamic. It adapts its conversation flow based on the responses it receives, mimicking the unpredictability and nuance of a human.</p>

<p><img class="fancyimage" style="width:550px" src="img/syntrix/conv_w_synthetic_customer.png" alt="An example conversation with a synthetic customer" /></p>

<h4 id="why-use-synthetic-customers">Why use synthetic customers?</h4>

<p>Synthetic customers provide a safe, scalable, and tireless way to evaluate your AI and live agents. Use them to identify gaps in your service without ever risking real customer satisfaction or compromising sensitive privacy data.</p>

<h4 id="the-anatomy-of-a-synthetic-customer">The anatomy of a synthetic customer</h4>

<p>At a fundamental level, every synthetic customer is built from a few core ingredients:</p>

<ul>
  <li><strong>A scenario</strong>: This provides the specific reason the customer is reaching out to your brand, as well as important context.</li>
  <li><strong>An identity</strong>: This is optional. If provided, it gives the synthetic customer fixed, identifying attributes, such as a name and an email address.</li>
  <li><strong>A persona</strong>: This defines the customer's communication style, personality, and behavior, for example, a frustrated long-term member versus a polite first-time caller.</li>
</ul>

<h4 id="how-the-simulation-works">How the simulation works</h4>

<p>When you run a simulation, the system creates unique experiences by combining these elements. Here’s what happens behind the scenes for each simulated conversation:</p>

<ol>
  <li><strong>Scenario and persona selection</strong>: A scenario and a persona are retrieved from the simulation's configuration. (<a href="key-concepts.html#scenarios-and-personas-are-distributed-across-conversations">Learn how scenarios and personas are distributed across conversations.</a>)</li>
  <li><strong>Optional identity generation or selection</strong>: Depending on the simulation's configuration, the customer is given no identity (i.e., made anonymous), assigned a random identity (name, email, phone number, etc.), or assigned a <strong>predefined</strong> identity that's selected from the chosen scenario. (<a href="key-concepts.html#identities-are-distributed-across-conversations">Learn how predefined identities are distributed across conversations.</a>)</li>
  <li><strong>Creation</strong>: The specific combination—the scenario, the persona, and optionally the identity—becomes the synthetic customer for the conversation.</li>
</ol>

<p class="attn-note">If your agent workflows require agents to contact customers via email or phone—including SMS or voice-—use <strong>predefined</strong> identities with <strong>fixed</strong> contact data. They allow you to use real emails or phone numbers that you own and monitor.</p>

<h3 id="scenario">Scenario</h3>

<p>A scenario mirrors a real customer journey, outlining the specific objective that the synthetic customer is trying to achieve and the expected path of the conversation. It includes clear success criteria in the form of agent goals. "Business Line Blackout" or "Failed Fiber Upgrade" might be the names of two such scenarios.</p>

<p>Scenarios provide the structure and goals for your simulations, allowing you to test specific customer journeys and identify where your agents might deviate or fail.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/scenario_tableOfScenarios.png" alt="A list of example scenarios for a telco brand" /></p>

<h4 id="example-scenario">Example scenario</h4>

<p><em>You signed up for the Premium Plan a couple of weeks ago. You were charged $49.99 but your account still shows the Free Plan features. You've already tried logging out and back in. You want this resolved immediately - either activate the features you paid for or give you a full refund.</em></p>

<h3 id="identity">Identity</h3>

<p>Identities assign fictitious, <strong>fixed</strong> attributes—like names and emails—to synthetic customers. This allows a synthetic customer to appear in the agent's workspace as an authenticated user during a simulation.</p>

<p>You can create identities and assign them to specific scenarios based on the type of customer validation needed. While you can specify only a single identity in a scenario, you can reuse an identity across multiple scenarios.</p>

<p>Identities are a crucial requirement for running simulations where you want to discreetly audit live agent performance without disrupting your daily operations (e.g., mystery shopping). You can create an identity that matches a fictitious customer record in your CRM or training system—like "Jane Smith" at jsmith@outlook.com—and link the identity to a specific scenario, such as "Inquiring about Internet packages." When the conversation begins, your agent can pull up Jane’s data just as they would for a real customer, ensuring a seamless and authentic test of their skills.</p>

<h3 id="persona">Persona</h3>

<p>A persona gives the synthetic customer a distinct personality, communication style, and set of behaviors. Rather than just a label, a persona dictates how a synthetic customer reacts, phrases questions, and interacts with agents. By adjusting traits like tone (e.g., urgent, confused) or linguistic styles (e.g., brief sentences, frequent clarification), you can rigorously test an agent's ability to de-escalate conflict and handle diverse communication preferences.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/personas_tableOfPersonas.png" alt="A list of example personas for a telco brand" /></p>

<h4 id="the-core-objective-variance">The core objective: Variance</h4>

<p>Personas are used primarily to introduce necessary variance into testing and training environments. This ensures realism and builds resilience in three key areas:</p>

<ul>
  <li><strong>Authentic interaction</strong>: Without personas, synthetic customers often default to a bland, perfectly polite tone that is unrealistic. Personas introduce the quirks and inconsistencies of real people, better preparing your agent for actual customers.</li>
  <li><strong>Stress-testing AI quality</strong>: While most AI agents handle straightforward inquiries well, personas test performance against vague, frustrated, or non-native speakers. This moves testing beyond the "happy path" to ensure the technology works in unpredictable, real-world conditions.</li>
  <li><strong>Human-centric agent readiness</strong>: In reality, customers can be impatient or confused. Training agents with varied personas ensures they are equipped to handle the full spectrum of human temperament from day one.</li>
</ul>

<h4 id="personas-versus-scenarios">Personas versus scenarios</h4>

<p>If a scenario is the plot in the story, the persona is the actor. While the plot remains constant, the persona changes the interaction entirely. Combining these elements creates unique conversational paths that test agents in distinct ways.</p>

<p>For example, in a "negative" scenario like an internet outage, the persona dictates the energy of the resolution process:</p>

<ul>
  <li><strong>The friendly pragmatist</strong>: Focuses on the fix. Though inconvenienced, they remain professional, follow troubleshooting steps, and ask for logical timelines.</li>
  <li><strong>The rude impatient</strong>: Leads with hostility. They frame delays as personal affronts and demand immediate answers instead of cooperating with a troubleshooting plan, adding emotional pressure to the technical problem.</li>
</ul>

<p>While the agent goals (identifying the outage and providing a workaround) are the same, the soft skills required to manage each customer are worlds apart.</p>

<h3 id="synthetic-customer-profile">Synthetic customer profile</h3>

<p>A synthetic customer profile is a curated combination of scenarios and personas that are packaged together for a specific simulation task. It’s essentially a test suite that’s ready for use in simulations.</p>

<p>Synthetic customer profiles allow for easy reuse and management of simulation setups. You can create one and quickly reuse it whenever needed.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/profiles_tableOfProfiles.png" alt="A list of example profiles for a telco brand" /></p>

<h3 id="scorecard">Scorecard</h3>

<p>The scorecard is the evaluation rubric used across the Syntrix platform. It defines how agent performance is measured with regard to <strong>universal goals</strong> that are applicable across scenarios. (Scenarios have agent goals too, but they're specific to each scenario.)</p>

<p>For example, the scorecard is used to evaluate whether:</p>

<ul>
  <li>The agent communicated in a polite and courteous manner.</li>
  <li>The agent delivered a warm and friendly welcome.</li>
  <li>The agent actively listened, that is, they demonstrated a clear understanding of the customer's concern before proposing a solution.</li>
  <li>And more</li>
</ul>

<p>Scorecards are integral to the Syntrix assurance platform for several critical functions:</p>

<ul>
  <li><strong>Evaluation and consistency</strong>: Scorecards define the rubrics used during evaluation, ensuring consistent and explainable assessments that remain aligned with enterprise policies.</li>
  <li><strong>Simulation and training</strong>: Scorecards are attached automatically to simulations to define evaluation criteria, aligning scoring with business priorities.</li>
  <li><strong>Audit and governance</strong>: Scorecards define the criteria for generating compliance and performance findings.</li>
  <li><strong>Conversation assessment</strong>: They facilitate scoring for each conversation. These scores are aggregated to generate comprehensive readiness scores.</li>
</ul>

<h4 id="liveperson-scorecard">LivePerson scorecard</h4>

<p>In the current release, there is a single, <strong>non-customizable</strong> <a href="work-in-the-simulation-and-training-studio-scorecards-get-started-with-scorecards.html">scorecard</a> that's used behind the scenes to assess the performance of both AI and live agents. It's attached automatically to every simulation, offering a standardized benchmark of excellence.</p>

<p>Currently, it’s not possible to create custom scorecards.</p>

<h3 id="simulation">Simulation</h3>

<p>A simulation is the actual execution of a synthetic customer profile (or an explicitly selected scenario and persona). It's a real-time conversation between a synthetic customer and an agent (whether a live agent, an AI agent, or a conventional bot). These are the core events where your configurations come to life and interactions are recorded for analysis.</p>

<p>Simulations generate the valuable data and transcripts that allow you to analyze performance, identify issues, and validate improvements.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/sims_new sim_partOfTable.png" alt="The simulations list, showing one simulation that's in progress" /></p>

<h3 id="report">Report</h3>

<p>The report is the result of using the evaluation rubric (the scorecard plus the agent goals defined in the scenario) to evaluate the conversations included in the simulation.</p>

<p>Whenever you run a simulation, you get a report.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_summaryPage_completed.png" alt="The summary page of a report for a completed simulation" /></p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_agentPerformanceDetails.png" alt="The agent performance details page for an example report" /></p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_reviewConversation.png" alt="The Review conversation window of a report, where the user can view the transcript and assessment side by side" /></p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Key Concepts</title>
      <link>https://developers.liveperson.com/key-concepts.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/key-concepts.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="test-ai-agents-live-agents-and-conventional-bots">Test AI agents, live agents, and conventional bots</h3>

<p>You can use Syntrix to test not just non-deterministic AI agents and live agents, but also conventional bots that don’t make use of LLMs.</p>

<h3 id="live-agents-may-know-customers-are-synthetic">Live agents may know customers are synthetic</h3>

<p>Whether or not your agents are aware that the customers are synthetic depends largely on whether you make this known to your agents. You can choose between transparent collaboration as a part of a training program, or total discretion where agents are audited during standard, daily operations. The former creates a low-stakes environment that's ideal for skill building and practice. The latter allows you to monitor performance and quality assurance.</p>

<p>It is important to note that tech-savvy agents might still identify a synthetic customer through specific metadata or flags visible within their workspace.</p>

<h3 id="scenarios-and-personas-are-distributed-across-conversations">Scenarios and personas are distributed across conversations</h3>

<p>When running a limited number of conversations (as you do in any simulation), you want maximum variety. Each conversation should explore a combination of scenario and persona that hasn't been used before. Novel combinations give you the most differentiation and the most useful data.</p>

<p>Syntrix ensures this coverage by creating a matrix of every possible scenario/persona pairing at the start of a simulation. For example, if the simulation includes 5 scenarios and 4 personas, the matrix includes 20 unique pairings.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/distro1.png" alt="An example matrix of all unique pairings of scenario and persona combinations" /></p>

<p>Then, for a conversation, the system <strong>randomly selects</strong> a pairing from the matrix. Importantly, to maximize coverage, pairings are not repeated until all combinations in the matrix have been exhausted.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/distro2.png" alt="An illustration of the matrix, showing some pairings as used and some as not used" /></p>

<h3 id="identities-are-distributed-across-conversations">Identities are distributed across conversations</h3>

<p class="attn-note">Identity distribution depends on the scenario/persona matrix described in the preceding section; review that section first.</p>

<p>You can choose to run a simulation in one of three ways:</p>

<ul>
  <li>Use <strong><a href="key-terms.html#identity">predefined identities</a></strong> that you've created, for example, John Smith with email jsmith9915@gmail.com, etc.</li>
  <li>Use <strong>random</strong> identities generated at runtime; this is useful when an identity is required, but specific details are not a priority.</li>
  <li>Use <strong>anonymous</strong> synthetic customers, where no identity data is used.</li>
</ul>

<p>With <strong>anonymous</strong> customers, identities are excluded from the generation process, and all synthetic customers are represented as "Unknown."</p>

<p>When using <strong>random</strong> identities, the system selects a scenario/persona pairing and then generates a random identity for it. Together, these three elements comprise the synthetic customer.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/distro1_identity.png" alt="An illustration of the matrix, with a callout to one identity as random for a unique scenario and persona pairing" /></p>

<p>When using <strong>predefined identities</strong>, assignment focuses on "scenario sets." A scenario set is that subset of the matrix that includes a single scenario paired with every available persona.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/distro2_identity.png" alt="An illustration of the matrix, with a callout to the scenario set for Scenario 1" /></p>

<p>When the scenario in the scenario set is used in a conversation, the system randomly selects one of the identities associated with that specific scenario.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/distro3_identity.png" alt="An illustration of the matrix, with a callout to the scenario set for Scenario 1 and the random association of one of Scenario 1's identities" /></p>

<p>To maximize coverage of identities, an identity can’t be repeated within the scenario set until all identities are exhausted. This facilitates an even distribution of identities <strong>for a single scenario</strong>, independent of persona, and across a simulation with enough total conversations to exhaust the identity pool.</p>

<p>Note, however, that the system <strong>doesn't</strong> guarantee that a <strong>scenario/persona pairing</strong> always uses a different identity. Consider the following example:</p>

<ul>
  <li>A simulation of 40 total conversations</li>
  <li>The simulation involves 5 scenarios (all using the same 3 identities) and 4 personas</li>
</ul>

<p>In a simulation of 40 conversations, each of the 20 pairings (5 scenarios x 4 personas) is used twice. However, the identity assigned to those two instances may vary, making any of the following outcomes possible:</p>

<ul>
  <li>2 conversations that both use {Scenario 1 + Persona A + Identity I} …Or…</li>
  <li>2 conversations that both use {Scenario 1 + Persona A + Identity II} …Or…</li>
  <li>2 conversations that both use {Scenario 1 + Persona A + Identity III} …Or…</li>
  <li>2 conversations, each using any one of {Scenario 1 + Persona A + Identity I},  {Scenario 1 + Persona A + Identity II}, or {Scenario 1 + Persona A + Identity III}</li>
</ul>

<h3 id="predefined-identities-are-synchronized-to-prevent-collisions">Predefined identities are synchronized to prevent collisions</h3>

<p>You can link <strong><a href="key-terms.html#identity">predefined identities</a></strong> to scenarios to run realistic simulations, such as mystery shopping, without disrupting operations. Identities provide synthetic customers with fixed, fictitious attributes (names, emails, etc.) that match your CRM or training records.</p>

<h4 id="collision-prevention">Collision prevention</h4>

<p>To prevent data "collisions"—where multiple agents attempt to access the same CRM record simultaneously—Syntrix ensures each identity is used in only one active conversation at a time.</p>

<h4 id="concurrency-constraints">Concurrency constraints</h4>

<p>This "one-at-a-time" rule introduces two key constraints:</p>

<ul>
  <li><strong>Identity-limited concurrency</strong>: The number of available identities acts as a hard cap on active conversations. If a simulation is set to a "Max. concurrent conversations" of 40, but there are only 10 identities that it can use, then no more than 10 conversations can run at once.</li>
  <li><strong>Cross-simulation sharing</strong>: When the system ensures that an identity can be used in only one conversation at a time, it does this with a view across all simulations that are in progress. So, if you're running 2 or more simulations at a time that use the same identities, this can further limit the number of concurrent conversations that are possible.</li>
</ul>

<p>Due to these intentional constraints, simulations using predefined identities may take longer to complete than you expect, or longer than those using randomized or anonymous data.</p>

<h3 id="success-criteria-for-agents-is-scenario-specific-or-universal">Success criteria for agents is scenario-specific or universal</h3>

<p>Agent performance criteria is defined within two spots in the simulation and training studio:</p>

<ul>
  <li>Within the scenario</li>
  <li>Within the scorecard</li>
</ul>

<p>While both are essential for evaluating performance, they serve distinct, yet complementary purposes.</p>

<p>To ensure your evaluation is both specific and comprehensive, it helps to break them down by scope, purpose, and content.</p>

<h4 id="at-a-glance-the-key-differences">At a glance: The key differences</h4>

<table>
  <thead>
    <tr>
      <th>Feature</th>
      <th>Agent goals in a scenario</th>
      <th>Agent goals in a scorecard</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Scope</td>
      <td>Specific and local: Applies only to a single, specific scenario.</td>
      <td>Generic and global: Applies to every conversation, regardless of the topic.</td>
    </tr>
    <tr>
      <td>Purpose</td>
      <td>Defines the specific outcome and customer requirements for the interaction.</td>
      <td>Defines core agent behaviors and universal quality standards: empathy, professionalism, etc.</td>
    </tr>
    <tr>
      <td>Focus</td>
      <td><strong>The "What"</strong>: Did the agent actually solve the specific problem and in the right way?</td>
      <td><strong>The "How"</strong>: Did the agent follow the broader rules and treat the customer well?</td>
    </tr>
  </tbody>
</table>

<h4 id="examples">Examples</h4>

<p>Imagine a customer calling to change a flight.</p>

<p>The scenario's agent goals check the business outcome:</p>

<ul>
  <li>Was the flight date modified to the requested date?</li>
  <li>Is the price difference of the new ticket less than or equal to $100?</li>
  <li>Was the confirmation email sent to the verified address?</li>
</ul>

<p>In contrast, the scorecard's agent goals check the agent's behavior:</p>

<ul>
  <li>Did the agent maintain a professional demeanor throughout the interaction?</li>
  <li>Did the agent communicate in a polite and courteous manner?</li>
</ul>

<p>Keep this distinction in mind when defining agent goals in your scenarios. When you ensure that agent goals are scenario-specific, you target what’s necessary to succeed in that context.</p>

<p class="attn-note">Stay tuned for a future update that will allow scorecard customization, giving you even more flexibility to track agent behavior across all your scenarios.</p>

<h3 id="transcript-review-is-optional-and-efficient">Transcript review is optional and efficient</h3>

<p>Syntrix brings great news here: When evaluating a report, and in specific the simulated customer conversations, you don’t need to read every transcript. The primary deliverable is the AI analysis or summary, which provides quick, actionable insights.</p>

<p>However, for thorough quality assurance or deeper investigation, you can, indeed, review the full transcripts side-by-side with the AI's findings to gain deeper insights.</p>

<h3 id="synthetic-customer-assets-are-reusable">Synthetic customer assets are reusable</h3>

<p>The true power of the synthetic customer assets (scenarios, personas, etc.) lies in their reusability across different training and evaluation needs. For example, a single persona, such as the "Busy parent," can be paired with various scenarios to test multiple customer goals.</p>

<p>Assume for a moment that you’re setting up simulations for Acme Telco, a fictional telecommunications company. You could apply the "Busy parent" persona to the "Report service outage" scenario to evaluate the call center agent's speed and efficiency. The same "Busy parent" persona could be used for the entirely different "Upgrade data plan" scenario to test the sales agent's product knowledge and upselling technique.</p>

<p>This modularity allows you to efficiently test a wide range of customer interactions.</p>

<h3 id="starter-packs-accelerate-deployment">Starter packs accelerate deployment</h3>

<p>To get you up and running quickly, Syntrix includes a number of prebuilt profiles, scenarios and personas created by LivePerson for common cases. Take advantage of these. You'll find them front and center in the UI on relevant pages.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Introduction</title>
      <link>https://developers.liveperson.com/introduction.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/introduction.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="realizing-readiness-for-ai-and-agent-operations">Realizing readiness for AI and agent operations</h3>

<p>In high-stakes customer experience (CX) environments, testing AI and live agents directly in production is a major liability. When "learning on the fly" risks AI hallucinations or compliance violations, manual oversight is no longer enough to manage the high cost of failure.</p>

<p>Syntrix provides a predictive sandbox that replaces high-risk live testing with automated simulations at scale. It uses Generative AI to orchestrate high-fidelity synthetic customers that mirror the emotional volatility and complex escalation paths of the real world. This allows you to stress-test your guardrails and forecast performance under pressure <strong>before</strong> a single real interaction occurs.</p>

<p><img class="fancyimage" style="width:550px" src="img/syntrix/conv_w_synthetic_customer.png" alt="An example conversation with a synthetic customer" /></p>

<p>By turning potential failures into immediate tuning and training opportunities in a controlled environment, Syntrix provides the essential oversight required for modern contact centers. It enables you to move beyond the promise of AI and deliver the proof of responsible, trustworthy engagement.</p>

<h3 id="key-features">Key features</h3>

<h4 id="hyper-realistic-synthetic-customers">Hyper-realistic synthetic customers</h4>

<p>Forget static scripts. Syntrix utilizes Generative AI to create synthetic customers that mirror real-world emotional ranges and complex customer journeys.</p>

<ul>
  <li><strong>Realistic chaos</strong>: Test how agents handle high-pressure interactions and diverse personalities.</li>
  <li><strong>Streamlined authoring</strong>: Quickly build <a href="key-terms.html#scenario">scenarios</a> and <a href="key-terms.html#persona">personas</a> (archetypes) to reuse across your training modules.</li>
</ul>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/scenario_tableOfScenarios.png" alt="A list of example scenarios for a telco brand" /></p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/personas_tableOfPersonas.png" alt="A list of example personas for a telco brand" /></p>

<h4 id="orchestration-and-bulk-validation">Orchestration and bulk validation</h4>

<p>Why test one by one when you can test many at once?</p>

<ul>
  <li><strong>Validation at scale</strong>: Simulate conversations at scale to continuously evaluate agent performance across a myriad of permutations.</li>
  <li><strong>Targeted skill assignments</strong>: Instantly map specific scenarios to relevant agent skill sets to ensure specialized readiness.</li>
</ul>

<h4 id="intelligence-loop">Intelligence loop</h4>

<p>Syntrix is a feedback engine that provides an intelligent iterative cycle for building AI agents and training live agents.</p>

<ul>
  <li><strong>Adaptive coaching and tuning recommendations</strong>: Get immediate, context-aware feedback about AI and live agents on goal completion, and nuances like empathy and compliance.</li>
</ul>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_agentPerformanceDetails.png" alt="The agent performance details page for an example report" /></p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_reviewConversation.png" alt="The Review conversation window of a report, where the user can view the transcript and assessment side by side" /></p>

<h3 id="core-use-cases">Core use cases</h3>

<p>Syntrix is a critical toolkit for minimizing risk and accelerating the deployment of your conversational customer experience solutions. Currently, its leading use cases fall into two primary categories.</p>

<h4 id="quality-assurance-and-optimization-of-ai-agents">Quality assurance and optimization of AI agents</h4>

<p>Replace labor-intensive testing with scalable solutions built for modern AI architectures.</p>

<ul>
  <li><strong>Accelerated optimization</strong>: Test and validate end-to-end AI agent performance, including handoffs to other agents.</li>
  <li><strong>High-fidelity testing</strong>: Eliminate manual bottlenecks by generating multi-turn conversations at scale to ensure your AI agents are tested, evaluated, verified, and validated before ever speaking to a customer.</li>
</ul>

<h4 id="enablement-training-and-audit-of-live-agents">Enablement, training, and audit of live agents</h4>

<p>Accelerate an agent's time-to-proficiency for the most complex, emotionally charged conversations.</p>

<ul>
  <li><strong>Risk-free roleplay</strong>: Let agents practice against edge cases and non-compliant paths using synthetic data in a safe environment.</li>
  <li><strong>Certification paths</strong>: Build structured onboarding where new hires progress through AI-driven scenarios to verify readiness before going live.</li>
  <li><strong>Targeted coaching</strong>: Deliver objective feedback on empathy and brand compliance based on simulation outcomes.</li>
  <li><strong>Live agent audits</strong>: Discreetly audit your live agents using high-fidelity synthetic customers that are indistinguishable from real customers. Supports mystery shoppers and similar use cases.</li>
</ul>

<h3 id="primary-audiences">Primary audiences</h3>

<ul>
  <li><strong>Training and QA teams</strong>: Training managers, simulation designers, QA teams, and supervisors.</li>
  <li><strong>Technical leads</strong>: AI designers, bot builders, and bot managers.</li>
  <li><strong>Frontline staff</strong>: Live agents practicing in a risk-free environment.</li>
</ul>

<h3 id="ccaas-support">CCaaS support</h3>

<p>Syntrix can be integrated with:</p>

<ul>
  <li>LivePerson Conversational Cloud</li>
  <li>Genesys Cloud</li>
</ul>

<h3 id="were-building-the-future-with-you">We're building the future with you</h3>

<p>We’ve launched Syntrix as a cutting-edge application for realizing AI and live agent readiness, but what you see now is just step one in our vision. Our roadmap is packed with innovations designed to redefine how you scale and secure your AI ecosystem.</p>

<p>We want to hear about your AI testing and live agent training requirements. Please reach out to your LivePerson representative to share your thoughts. We’re dedicated to evolving our platform and growing right alongside your testing and training needs.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>High-Level FAQs</title>
      <link>https://developers.liveperson.com/high-level-faqs.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/high-level-faqs.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="what-can-synthetic-customers-do">What can synthetic customers do?</h3>

<p>Synthetic customers can do a few things:</p>

<ul>
  <li>Send an initial message to the agent</li>
  <li>Reply to agent messages</li>
  <li>Wait for a response from the agent</li>
  <li>Close a conversation</li>
</ul>

<h3 id="can-i-upload-historical-data-or-connect-syntrix-to-external-systems">Can I upload historical data or connect Syntrix to external systems?</h3>

<p>To get the most out of Syntrix today, it is helpful to keep the following current architectural boundaries in mind:</p>

<ul>
  <li><strong>Historical data ingestion</strong>: Currently, Syntrix generates scenarios based on the specific personas and parameters you configure within the tool. There isn't yet the ability to ingest or "learn" from your organization's existing historical conversations. (To learn more about our product roadmap, contact your LivePerson representative.)</li>
  <li><strong>External system connectivity</strong>: Syntrix operates as a standalone environment. There isn't a way to integrate with external systems, such as training “sandbox” systems, your CRM, etc.</li>
</ul>

<p>As LivePerson continues to develop Syntrix, these boundaries will expand, allowing for deeper customization and more seamless integration into your existing technical stack.</p>

<h3 id="can-data-flow-from-external-systems-into-the-simulated-conversation">Can data flow from external systems into the simulated conversation?</h3>

<p>The synthetic customer is only aware of two things: 1) the scenario and 2) the conversation in which they are participating.</p>

<p>While the agent may interact with an external system (like a CRM or a billing sandbox), there is no feedback mechanism that allows an external system to send information back to the synthetic customer in real time.</p>

<h4 id="example-adding-a-mobile-data-top-up">Example: Adding a mobile data top-up</h4>

<ul>
  <li><strong>The scenario</strong>: A synthetic customer is configured to ask the agent to add a 10GB data "bolt-on" to their account because they’ve run out of data.</li>
  <li><strong>The action</strong>: The agent opens an external telco provisioning sandbox (a mock version of the billing and network system) and successfully applies the data pack to the customer's account.</li>
  <li><strong>The gap</strong>: The provisioning system generates a transaction ID (e.g., TXN-9982X) and updates the "Current Data Balance" field to 10GB.</li>
  <li><strong>The result</strong>: There is currently no way for that external telco system to "push" that new balance or transaction ID back into the synthetic customer’s knowledge.</li>
</ul>

<p>While the agent can type "I've added that 10GB for you, your transaction ID is TXN-9982X" to the customer, the synthetic customer won't "know" or "verify" that the system update actually occurred. The simulation remains independent of the external system's state.</p>

<p>In a live production environment, systems often talk to each other. But in a simulation, the synthetic customer's "brain" is isolated from the results of actions taken in external tools.</p>

<h3 id="are-the-prompts-used-by-syntrix-customizable">Are the prompts used by Syntrix customizable?</h3>

<p>While prompts aren't directly editable, Syntrix is designed for deep customization. We expose the most critical parts of the prompt through scenarios and personas. By customizing these, you can shape the synthetic customer's behavior to meet your specific requirements, without needing to manage the complex, interlocking pieces that make the AI agents work.</p>

<p>Looking ahead, you'll also be able to tailor your evaluations with customizable scorecards, so stay tuned.</p>

<h3 id="related-topics">Related topics</h3>

<ul>
  <li><a href="work-in-the-simulation-and-training-studio-scorecards-get-started-with-scorecards.html#faqs">Scorecard FAQs</a></li>
  <li><a href="work-in-the-simulation-and-training-studio-simulations-get-started-with-simulations.html#faqs">Simulation FAQs</a></li>
  <li><a href="work-in-the-simulation-and-training-studio-reports-get-started-with-reports.html#faqs">Report FAQs</a></li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Get Started with Simulations</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-simulations-get-started-with-simulations.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-simulations-get-started-with-simulations.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="faqs">FAQs</h3>

<h4 id="during-a-simulation-do-agents-have-access-to-all-of-the-features-they-can-use-during-real-conversations">During a simulation, do agents have access to all of the features they can use during real conversations?</h4>

<p>Yes, provided those features are enabled for the skills assigned to the simulation. Since many features are skill-specific, ensure that your scenarios use the correct skills to allow for full feature access.</p>

<h4 id="how-are-conversations-closed">How are conversations closed?</h4>

<p>Conversations that involve synthetic customers can be closed in several ways:</p>

<ul>
  <li>By the synthetic customer</li>
  <li>By the agent (whether live or AI)</li>
  <li>If the conversation has reached the maximum number of turns (set in the simulation), it is closed by the system. You specify this limit when you configure the simulation.</li>
  <li>Simulations running longer than four hours are regarded as "stuck" and terminated, along with all active conversations. Stuck conversations can happen for various reasons: the live agent failed to respond, the AI agent has a bug, a performance issue within the contact center prevented a message from reaching Syntrix, etc.</li>
</ul>

<p>Keep in mind that, in the <a href="work-in-the-simulation-and-training-studio-scorecards-get-started-with-scorecards.html">implicit LivePerson scorecard</a>, the agent is evaluated on how they closed the conversation, so the manner in which the conversation was closed can impact the agent's performance score.</p>

<h4 id="how-does-the-system-evaluate-conversations-that-include-transfers">How does the system evaluate conversations that include transfers?</h4>

<p>Currently, only the <strong>last</strong> agent involved in the conversation is evaluated and appears in the report. This agent is evaluated based on the <strong>entire</strong> conversation. Stay tuned for more detailed reporting.</p>

<h4 id="can-i-schedule-a-simulation-for-a-future-date-and-time">Can I schedule a simulation for a future date and time?</h4>

<p>No, not in this release.</p>

<h4 id="can-i-assign-a-scenario-to-specific-live-agents-or-ai-agents">Can I assign a scenario to specific live agents or AI agents?</h4>

<p>No, not in this release. Currently, it's only possible to assign a scenario to a skill.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Get Started with Scorecards</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-scorecards-get-started-with-scorecards.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-scorecards-get-started-with-scorecards.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="implicit-scorecards">Implicit scorecards</h3>

<p>In the current release, there is a single, <strong>non-customizable</strong> <a href="key-terms.html#scorecard">scorecard</a> that's used behind the scenes to assess the performance of both AI and live agents. It's attached automatically to every simulation.</p>

<p>Agents are evaluated against the following goals that apply to all scenarios:</p>

<ul>
  <li><strong>Professionalism</strong>: Maintained a professional demeanor throughout the interaction.</li>
  <li><strong>Politeness</strong>: Communicated in a polite and courteous manner.</li>
  <li><strong>Greeting</strong>: Delivered a warm and friendly welcome.</li>
  <li><strong>Closing</strong>: Provided a proper and appropriate farewell.</li>
  <li><strong>Active listening</strong>: Demonstrated a clear understanding of the customer's concern before proposing a solution.</li>
</ul>

<p>In addition to these universal goals, <strong>scenario-specific</strong> agent goals are <a href="work-in-the-simulation-and-training-studio-scenarios-manage-scenarios.html">defined within the scenario</a>. Agents are evaluated based on these goals too.</p>

<p>Both types of goals—along with the <a href="work-in-the-simulation-and-training-studio-reports-get-started-with-reports.html#report-scores">scoring rubric</a>—are sent to the LLM, which determines a score for the agent's performance in the conversation.</p>

<h3 id="faqs">FAQs</h3>

<h4 id="can-i-create-custom-scorecards">Can I create custom scorecards?</h4>

<p>No, not in this release.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Get Started with Reports</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-reports-get-started-with-reports.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-reports-get-started-with-reports.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="access-a-report">Access a report</h3>

<ol>
  <li>On the left navigation bar, click <strong>Simulation workshop</strong>.</li>
  <li>Choose a simulation, and click <strong>Insights</strong>.</li>
</ol>

<h3 id="data-retention-policy">Data retention policy</h3>

<p>The transcripts of simulated conversations are only available for <strong>13 months</strong>, but associated reports on those simulations are available <strong>indefinitely</strong>.</p>

<h3 id="report-components">Report components</h3>

<p>The report contains three components:</p>

<ul>
  <li>Summary</li>
  <li>Agent performance</li>
  <li>Conversations</li>
</ul>

<p>The <strong>Summary</strong> tab provides an overview of how the agents performed overall. Review this to learn about the issues that were found and how to address them.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_summaryPage_completed.png" alt="The Summary tab of a completed report" /></p>

<p>The <strong>Agent performance</strong> tab displays the performance results per agent.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_agentPerformanceTab.png" alt="The Agent Performance tab of a completed report" /></p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_agentPerformanceDetails.png" alt="The Agent Performance Details tab of a completed report" /></p>

<p>The <strong>Conversations</strong> tab surfaces the list of conversation transcripts from the simulation. Dive into a conversation to view the transcript and assessment side-by-side, to easily validate the evaluation and diagnose issues with agent performance.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_conversationsTab.png" alt="The Conversations tab of a completed report" /></p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_reviewConversation.png" alt="The Review conversation window in a completed report" /></p>

<h3 id="report-scores">Report scores</h3>

<p>To evaluate an agent's performance in a conversation, both <a href="work-in-the-simulation-and-training-studio-scenarios-manage-scenarios.html">scenario-specific</a> and <a href="work-in-the-simulation-and-training-studio-scorecards-get-started-with-scorecards.html">universal</a> agent goals—along with the following scoring rubric—are sent to the LLM. The LLM then determines the score.</p>

<table>
  <thead>
    <tr>
      <th>Score</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>10</td>
      <td>The agent flawlessly achieves all success criteria, perfectly maintains instructions across all turns without breaking character, and demonstrates exemplary empathy and professionalism.</td>
    </tr>
    <tr>
      <td>9</td>
      <td>All success criteria are met and professionalism is excellent; there are only negligible instruction slip-ups or slightly generic (rather than deeply tailored) empathy.</td>
    </tr>
    <tr>
      <td>8</td>
      <td>The agent successfully meets most success criteria, handles instructions well overall, and maintains a coherent, polite, and professional tone.</td>
    </tr>
    <tr>
      <td>7</td>
      <td>Most goals are met, but the agent may sound slightly robotic or experience minor drops in character/instructions, though it remains completely acceptable and non-defensive.</td>
    </tr>
    <tr>
      <td>6</td>
      <td>The core issue is only partially resolved; the agent struggles to maintain instructions across multiple turns and relies on a cold, script-heavy tone that ignores customer emotions.</td>
    </tr>
    <tr>
      <td>5</td>
      <td>Despite maintaining a calm and professional tone, the agent fundamentally fails the specific action in the success criteria and misses key prompt requirements. (Note: This acts as the ceiling for polite failures.)</td>
    </tr>
    <tr>
      <td>4</td>
      <td>The agent fails the success criteria, misunderstands core instructions, and displays a reactive, curt, or defensive tone.</td>
    </tr>
    <tr>
      <td>3</td>
      <td>The agent meets zero goals, completely fails to follow instructions from the start, and frequently misses the point of the customer's query.</td>
    </tr>
    <tr>
      <td>2</td>
      <td>Completely unacceptable; the agent fails all tasks, ignores instructions entirely, and becomes hostile, offensive, or actively escalates the conflict.</td>
    </tr>
    <tr>
      <td>1</td>
      <td>A catastrophic failure where the agent actively subverts instructions and uses severely inappropriate language or is entirely incoherent, requiring immediate human intervention.</td>
    </tr>
  </tbody>
</table>

<h3 id="high-performance-vs-needs-training">High performance vs. Needs training</h3>

<p>Each agent receives a performance rating <strong>for every scenario</strong>: either "High performance" or "Needs training." These ratings are determined by an LLM. To reach a reasoned conclusion, the LLM analyzes the collective feedback (the assessment narratives and assessment scores) from all of an agent's conversations involving that specific scenario.</p>

<p><img class="fancyimage" style="width:800px" src="img/syntrix/report_highPerf_vs_trainingNeeded.png" alt="The Agent performance details window in a report, with a callout to the training needed and high performance metrics" /></p>

<h3 id="faqs">FAQs</h3>

<h4 id="do-the-performance-metrics-reveal-which-agents-used-which-specific-tools-like-conversation-assist-or-copilot-rewrite">Do the performance metrics reveal which agents used which specific tools (like Conversation Assist or Copilot Rewrite)?</h4>

<p>This is an important question. We know brands want to understand how the use of different agent tools impacts performance. However, currently, our performance metrics do not provide insights into which specific agents used which tools.</p>

<h4 id="can-i-download-a-report">Can I download a report?</h4>

<p>No, not in this release.</p>

<h4 id="conversations-can-be-transferred-from-agent-to-agent-which-agents-are-reflected-in-a-report">Conversations can be transferred from agent to agent. Which agents are reflected in a report?</h4>

<p>The name of the agent who was last involved in the conversation is reflected in the report.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Get Started with Personas</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-personas-get-started-with-personas.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-personas-get-started-with-personas.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="starter-pack">Starter pack</h3>

<p>To accelerate your setup process and help you quickly get to the process of analyzing outcomes, Syntrix provides a starter pack of prebuilt personas. The starter pack includes a set of realistic yet behaviorally diverse archetypes.</p>

<p>Find the starter pack right where you create and manage personas: <strong>Synthetic customer builder &gt; Personas page</strong>.</p>

<p>While the prebuilt personas are ready for immediate use, they are also fully editable. You can use one as a baseline and customize individual aspects to better align with your specific organizational requirements.</p>

<p class="attn-alert">Take care when deleting a prebuilt persona; this can't be undone.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Get Started with Identities</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-identities-get-started-with-identities.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-identities-get-started-with-identities.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="deciding-on-use-of-identities">Deciding on use of identities</h3>

<p>The classic use case for identities is testing conversational flows that require specific customer data. Examples include:</p>

<ul>
  <li><strong>AI agent flows</strong> that need to look up a customer ID in a backend system.</li>
  <li><strong>Live agent audits</strong> where the live agent needs to find the synthetic customer (e.g., a mystery shopper) in your system of record.</li>
  <li>Any live agent processes that require verifying names in a CRM.</li>
</ul>

<p>Some types of conversations don't depend on the agent looking up specific customer data, for example, general inquiries or product questions. In such cases, the decision comes down to how much control you want to have over the contact data that is shown to your agents within their workspace. Use of random identities generated at runtime provides more variety, and the set up is simpler.</p>

<p class="attn-note">If your agent workflows require agents to contact customers via email or phone (SMS or voice), use identities, which have <strong>fixed</strong> contact data. Identities allow you to use real emails or phone numbers that your brand owns and monitors.</p>

<h3 id="identity-versus-scenario-which-info-goes-where">Identity versus scenario: Which info goes where?</h3>

<p>The identity identifies the customer (name, email address, customer ID, etc.), and the scenario describes the situation or problem (what happened and what the customer wants).</p>

<p>If the scenario relies upon a data point that has to do with the customer's identity, <strong>don't</strong> put it in the scenario. Instead, <a href="work-in-the-simulation-and-training-studio-scenarios-manage-scenarios.html">within the scenario, specify the identity to use</a>.</p>

<p>The scenario's description can still include important context such as product names, plan names, order numbers, and location data (e.g., destination airport).</p>

<ul>
  <li><a href="work-in-the-simulation-and-training-studio-identities-best-practices.html">Learn about identity best practices.</a></li>
  <li><a href="work-in-the-simulation-and-training-studio-scenarios-best-practices.html">Learn about scenario best practices.</a></li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Best Practices</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-simulations-best-practices.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-simulations-best-practices.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="scale-ai-agents-for-high-availability-and-load">Scale AI agents for high availability and load</h3>

<p>If you're testing your AI agents used in Production, it's important to ensure your AI agent can effectively handle the total conversation load, accounting for both live customer traffic and the additional load generated by simulations.</p>

<p>For LivePerson AI agents (built and deployed in LivePerson Conversation Builder), the primary scaling mechanism is the agent connector.</p>

<ul>
  <li><strong>Capacity limit</strong>: A single bot agent connector can handle a maximum of <strong>999</strong> concurrent conversations. (<a href="conversation-builder-testing-deployment-deploy-the-bot.html#best-practices">See our Conversation Builder deployment best practices</a> and <a href="conversation-builder-testing-deployment-deploy-the-bot.html#add-an-agent-connector">learn how to add a connector</a>.)</li>
  <li><strong>Proactive scaling</strong>: You must evaluate whether the bot is currently handling live traffic and add additional connectors ahead of anticipated spikes to prevent performance degradation.</li>
</ul>

<p>For third-party AI agents used and managed through LivePerson’s Conversational Cloud, similar scaling principles apply. In this case, a connector shouldn't handle more than <strong>250</strong> conversations, so <a href="third-party-bots-getting-started.html#provision-a-connector">add additional connectors</a> as needed.</p>

<p>For third-party AI agents used and managed through other contact center solutions, similar scaling principles also apply. Refer to the documentation for the contact center solution for guidance.</p>

<h3 id="manage-human-agent-load-via-ccaas-tools">Manage human agent load via CCaaS tools</h3>

<p>The introduction of simulations shouldn't overwhelm your human agents. Rely on the built-in workload management tools within your CCaaS solution to manage their load. These features allow you to set strict concurrency limits, ensuring agents only handle a manageable number of conversations at once. By automating these caps, you protect your team from burnout while maintaining high-quality service for every customer, whether real or synthetic.</p>

<h3 id="blind-versus-open-testing">Blind versus open testing</h3>

<p>When using Syntrix to evaluate human agents, you must choose between blind testing (where your agents may be unaware they are interacting with a synthetic customer) and open testing (where the simulation is disclosed).</p>

<p>While blind testing provides the most authentic assessment regarding an agent’s natural performance, it carries cultural risks regarding surveillance and employee trust.</p>

<p>Conversely, open testing fosters a psychological "safe zone" ideal for coaching and upskilling without performance anxiety.</p>

<p>We recommend that you prioritize open testing for training purposes to build confidence, and reserve blind testing for compliance audits, ensuring that agents are informed beforehand that synthetic quality assurance checks are a part of standard operations.</p>

<h3 id="before-you-run-a-simulation">Before you run a simulation</h3>

<ul>
  <li><strong>Ensure agent availability</strong>. Confirm your human agents are logged in—or your AI agents are deployed and online—for all skills in the scenarios. If a conversation cannot route, it will eventually time out and consume your allotment of total conversations in the simulation.</li>
  <li><strong>Pilot your test</strong>. Run 3–5 conversations before starting a full-scale test. Use these initial runs to catch configuration errors, such as incorrect skills.</li>
</ul>

<h3 id="when-you-configure-a-simulation">When you configure a simulation</h3>

<h4 id="total-conversations">Total conversations</h4>

<p>To ensure your performance data is meaningful, aim for at least 5–10 conversations per agent. Calculate your total test volume by scaling this target against your active agent count.</p>

<table>
  <tbody>
    <tr>
      <td>Testing/training goal</td>
      <td>Recommended value for "Total conversations"</td>
    </tr>
    <tr>
      <td>Quick validation or smoke test</td>
      <td>3-5 conversations is enough to validate flows are working before committing to a full run.</td>
    </tr>
    <tr>
      <td>Agent training</td>
      <td>Scale to your agent count to ensure everyone gets meaningful exposure.</td>
    </tr>
    <tr>
      <td>Bot testing</td>
      <td>Scale volume to bot complexity. Simple flows might require fewer conversations to surface issues.</td>
    </tr>
  </tbody>
</table>

<h4 id="max-concurrent-conversations">Max. concurrent conversations</h4>

<p class="attn-note">Getting this right is critical.</p>

<ul>
  <li><strong>When training human agents</strong>: Set concurrency slightly above total agent capacity (agents × conversations per agent) to keep a small queue. This ensures agents always have work without a long backlog. For example, 5 agents at 3 concurrent each = 15 capacity, so 18–20 concurrency works well.</li>
  <li><strong>When testing AI agents</strong>: Bots can handle much higher concurrency. Start at 10–15 and increase to stress-test throughput, but monitor for rate-limit errors.</li>
</ul>

<h4 id="max-conversation-turns">Max. conversation turns</h4>

<p>This is the safety net that prevents conversations from looping indefinitely.</p>

<p>When this limit is reached, the conversation is closed automatically by the system. This can negatively affect assessment scores, so choose a limit that allows legitimate conversation flows to finish.</p>

<ul>
  <li><strong>General recommendation</strong>: 20–30 turns for typical conversations.</li>
  <li><strong>When testing AI agents</strong>: Set lower (10–15) to detect infinite loops quickly. If a bot can't resolve an issue in 15 turns, that's a finding in itself.</li>
  <li><strong>For complex, multi-step scenarios</strong>: Increase to 30 if the scenario requires extensive back-and-forth, for example, technical troubleshooting with multiple steps.</li>
</ul>

<h3 id="during-a-simulation">During a simulation</h3>

<h4 id="monitor-the-conversations-in-the-agent-workspace">Monitor the conversations in the agent workspace</h4>

<p>Watch the first 5–10 conversations closely; look for:</p>

<ul>
  <li>In-progress conversations that have with no turns progressing (routing issue)</li>
  <li>Rapid closures with very few conversation turns (bot immediately closing, or agent rejecting)</li>
</ul>

<h4 id="stop-early-if-something-is-wrong">Stop early if something is wrong</h4>

<p>If you see systematic errors (wrong skill, broken bot, agent confusion, etc.), stop the simulation instead of letting bad conversations run their course. Fix the issue and re-run the simulation. Allowing flawed simulations to continue wastes valuable agent time and compromises the integrity of your reports.</p>

<h3 id="after-a-simulation">After a simulation</h3>

<h4 id="analyze-at-three-levels">Analyze at three levels</h4>

<ul>
  <li><strong>Macro (overall simulation)</strong>: Start with the summary. Did the simulation succeed? Look for broad patterns and system-wide trends.</li>
  <li><strong>Mid (agent performance)</strong>: Drill into individual results to identify exactly who needs coaching and on which specific skills, and which AI agents need tuning.</li>
  <li><strong>Micro (conversation deep-dive)</strong>: Review specific failures. Use these transcripts as concrete, real-world examples for training sessions.</li>
</ul>

<h4 id="track-long-term-progress">Track long-term progress</h4>

<p>Run the same simulations periodically to measure ROI. Consistent benchmarking is the only way to verify if your bot updates, process changes, or agent coaching programs are actually working.</p>

<h4 id="close-the-feedback-loop">Close the feedback loop</h4>

<p>Use your results to sharpen your scenarios and personas:</p>

<ul>
  <li><strong>Too easy?</strong> If everyone passes, increase the scenario difficulty or tighten your agent goals.</li>
  <li><strong>Universal failures?</strong> If most agents fail the same metric, decide if the goal is unrealistic or if you've found a critical training gap.</li>
  <li><strong>Repetitive outcomes?</strong> If multiple personas always lead to the same result, your personas are too generic. Sharpen their unique traits to ensure they sound like distinct individuals.</li>
</ul>

<h3 id="related-topics">Related topics</h3>

<ul>
  <li><a href="work-in-the-simulation-and-training-studio-your-iterative-workflow.html">Your iterative workflow</a> in the simulation and training studio</li>
  <li><a href="work-in-the-simulation-and-training-studio-testing-rollout-test-roll-out-on-conversational-cloud.html">Test &amp; roll out on Conversational Cloud</a></li>
  <li><a href="work-in-the-simulation-and-training-studio-testing-rollout-test-roll-out-on-genesys-cloud.html">Test &amp; roll out on Genesys Cloud</a></li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Best Practices</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-scenarios-best-practices.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-scenarios-best-practices.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>Scenarios are the backbone of every simulation. They define what the synthetic customer wants, why they are contacting your brand, and how success is measured. A well-crafted scenario produces realistic, useful conversations; a vague one produces noise. Follow the best practices below.</p>

<h3 id="description">Description</h3>

<ul>
  <li><strong>Write in second person</strong> ("You"). For example, "You purchased a router last week, and it keeps dropping connection," not, "The customer has a router issue."</li>
  <li><strong>Clearly state the customer's goals</strong>. The customer's goals, not the agent's goals, go here. For example, "You want a full refund or a replacement shipped overnight."</li>
  <li><strong>Include context</strong>, such as what happened, what you've already tried, product names, plan names, etc. Abstract descriptions ("You have a problem with your service.") produce vague behavior from the synthetic customer - be descriptive!</li>
  <li><strong>Get detailed when applicable</strong>: If your use case relies on specific location data (e.g., a destination airport), or other information (e.g., an order number), be sure to include this data in the description.</li>
  <li><strong>Keep it relatively short</strong>. The scenario's description should be 3-6 sentences in length. This is enough detail without overwhelming the LLM.</li>
  <li><strong>Use relative dates</strong>, such as "two days ago," "last Monday," "a couple of weeks ago." Don't use absolute dates (“March 3”) because they quickly become stale.</li>
</ul>

<h4 id="example-description">Example description</h4>

<p><em>You signed up for the Premium Plan a couple of weeks ago. You were charged $49.99 but your account still shows the Free Plan features. You've already tried logging out and back in. You want this resolved immediately — either activate the features you paid for or give you a full refund.</em></p>

<h3 id="agent-goals">Agent goals</h3>

<ul>
  <li>
    <p><strong>Be specific and observable</strong>. Each criterion should describe something an assessor can verify from the transcript alone. A good example is, "Agent confirmed the customer's order number before proceeding." A bad example is, "Agent was helpful."</p>

    <p class="attn-note">Refrain from entering agent goals that apply to multiple scenarios. Such goals belong in scorecards because they're not scenario-specific. That said, in the current release, scorecards aren't customizable. Stay tuned for this feature!</p>
  </li>
  <li><strong>Align with your brand's actual process</strong>. The goals should mirror the steps your agents are trained to follow: verification, troubleshooting, resolution, wrap-up, etc.</li>
  <li><strong>Write independent goals</strong>. Each goal should stand on its own. Avoid goals that only make sense if a previous goal passed.</li>
  <li><strong>Keep the count manageable</strong>. Three (3) to seven (7) goals per scenario is typical. More than seven makes it noisy and harder for the AI to score reliably.</li>
</ul>

<h3 id="skill-selection">Skill selection</h3>

<ul>
  <li><strong>Always specify the __correct__ skill</strong>. Conversations route to your agents based on the skill. Specify an incorrect skill means conversations land in the wrong queue, rendering your performance data inaccurate.</li>
  <li><strong>Always specify the __most targeted__ skill</strong>. When you run a simulation, there's flexibility: You can choose whether to use the skill that you specify in the scenario or override the scenario's setup and start all conversations on the same skill. The latter is useful for end-to-end testing or training. Since the latter option is available when running a simulation, always specify <em>within the scenario</em> the most targeted skill that's relevant.</li>
  <li><strong>Use different skills to segment tests</strong>. If you want to test your Billing AI agent and your Sales AI agent separately, create separate scenarios that use distinct skills rather than mixing them in one simulation.</li>
</ul>

<h3 id="scenario-maintenance">Scenario maintenance</h3>

<ul>
  <li><strong>Review and update scenarios quarterly</strong> (or whenever processes change). Stale scenarios with outdated steps or goals produce misleading results.</li>
  <li><strong>Use tags to organize</strong>. Group by department, use case, or difficulty level. This is especially useful when your library grows past 20–30 scenarios.</li>
  <li><strong>Version through naming</strong>. If you significantly rework a scenario, consider naming the second iteration with a version indicator ("Billing Dispute v2") rather than overwriting the first iteration.</li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Best Practices</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-personas-best-practices.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-personas-best-practices.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="language-support">Language support</h3>

<p><a href="language-support.html">Learn about supporting synthetic customers who speak languages other than English.</a></p>

<h3 id="traits">Traits</h3>

<h4 id="think-in-archetypes-and-conversational-styles">Think in archetypes and conversational styles</h4>

<p>The most useful personas are defined by communication behavior, <strong>not</strong> by demographics (for example, age or gender). Focus on traits that actually change how the conversation plays out.</p>

<p>Effective trait focus:</p>

<ul>
  <li>Patience level, vocabulary complexity, emotional volatility</li>
  <li>How they escalate (or don't)</li>
  <li>Whether they provide information proactively or need to be asked</li>
</ul>

<p>Less useful trait focus:</p>

<ul>
  <li>Age, gender, occupation (unless relevant to the scenario)</li>
  <li>Physical appearance</li>
  <li>Hobbies unrelated to the conversation</li>
</ul>

<h4 id="use-short-descriptive-phrases">Use short, descriptive phrases</h4>

<ul>
  <li><strong>Good example</strong>: Impatient, direct, uses short sentences, escalates quickly if not helped within 2–3 exchanges, refers to previous negative experiences.</li>
  <li><strong>Suboptimal example</strong>: This person is kind of impatient and doesn't really like waiting around for things.</li>
</ul>

<h4 id="include-behavioral-cues-not-just-adjectives">Include behavioral cues, not just adjectives</h4>

<p>Describe what the persona does, not just what they are. Good examples include:</p>

<ul>
  <li>Asks the same question repeatedly if the answer isn't clear</li>
  <li>Responds with single words or very short phrases</li>
  <li>Threatens to switch providers when frustrated</li>
</ul>

<h4 id="define-escalation-and-de-escalation-triggers">Define escalation and de-escalation triggers</h4>

<p>Tell what makes this persona more upset and what calms them down, for example:</p>

<ul>
  <li>Becomes cooperative when the agent uses their name and acknowledges the inconvenience</li>
  <li>Gets increasingly frustrated if put on hold or asked to repeat information</li>
</ul>

<h3 id="typical-responses">Typical responses</h3>

<p>Include three (3) to five (5) dialogue snippets to anchor the persona’s voice. Ensure they:</p>

<ul>
  <li><strong>Vary by mood</strong>: Include a calm opening, a frustrated middle, and a satisfied close.</li>
  <li><strong>Sound human</strong>: Use contractions, slang, and natural imperfections rather than "textbook" English.</li>
</ul>

<p>Examples for an "Impatient Executive" persona:</p>

<ul>
  <li><em>I don't have time for this.</em></li>
  <li><em>Can you just fix it?</em></li>
  <li><em>I've already explained this twice.</em></li>
  <li><em>Look, I'm in a meeting in 10 minutes.</em></li>
  <li><em>Fine, that works. Thanks.</em></li>
</ul>

<p>Examples for a "Confused Customer" persona:</p>

<ul>
  <li><em>I'm not sure what you mean by that.</em></li>
  <li><em>Can you explain that more slowly?</em></li>
  <li><em>I think I pressed the wrong button.</em></li>
  <li><em>Oh, thank you so much, dear.</em></li>
</ul>

<h3 id="persona-maintenance">Persona maintenance</h3>

<ul>
  <li><strong>Audit for distinction</strong>. Review your simulation results. If every conversation sounds the same regardless of the character, your personas are too generic. Sharpen their unique traits to ensure they sound like distinct individuals.</li>
  <li><strong>Separate style from situation</strong>. To keep your data clean and effective, ensure each category sticks to its specific role: The <em>persona</em> is about the communication style, tone, and behavioral traits, The <em>scenario</em> is about the specific situation, the problem, and the customer's goal. Avoid adding the scenario’s emotional context (for example, "is angry about a bill") to the persona’s permanent traits.</li>
  <li>If you're creating <strong>different personas for different channels</strong>, assign <a href="work-in-the-simulation-and-training-studio-tags-get-started-with-tags.html">tags</a> to classify them. This makes retrieval easier when needed.</li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Best Practices</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-identities-best-practices.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-identities-best-practices.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="establish-functional-realism">Establish functional realism</h3>

<p>Functional realism means your "synthetic" identities pass human scrutiny and, if necessary, technical validation.</p>

<p>Technical validation in particular is critical if your workflows require agents to contact customers via email, SMS, or voice. If this applies to your workflow, ensure the contact data is technically valid and monitored by your team. These are best practices:</p>

<ul>
  <li><strong>Emails</strong>: Use standard-looking handles on common domains (e.g., j.doe777@gmail.com). Configure these accounts to forward all incoming mail to your internal audit inbox to ensure no agent responses go unmonitored.</li>
  <li><strong>Phone numbers</strong>: Assign real VoIP numbers with local area codes through providers like Twilio. And ensure the number features a generic but professional voicemail greeting.</li>
  <li><strong>CRM integrity</strong>: Pre-load your CRM with the synthetic identity's record. Use a "Testing" flag in a hidden field to identify the account internally, and proactively notify Business Intelligence and Sales teams to exclude these records from their performance reporting and lead queues.</li>
</ul>

<h3 id="dont-use-pii">Don't use PII</h3>

<p>While functional realism (above) is important, when defining identities, <strong>don't</strong> use any Personally Identifiable Information (PII). PII is data that can be used on its own—or combined with other relevant information—to identify, contact, or locate a single person. Protecting PII is a cornerstone of digital privacy and data security law.</p>

<h3 id="before-you-run-a-simulation">Before you run a simulation</h3>

<p>An identity's attributes are fixed and known, so ensure you set up corresponding records in your CRM or training system <strong>before</strong> the simulation starts.</p>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>At a Glance</title>
      <link>https://developers.liveperson.com/get-started-at-a-glance.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/get-started-at-a-glance.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>If you're a CCaaS administrator tasked with setting up Syntrix and getting your team started, this short article is for you.</p>

<ol>
  <li><a href="get-started-manage-your-account-and-users.html">Log into Syntrix.</a></li>
  <li><a href="get-started-manage-the-contact-center.html">Add your contact center to Syntrix.</a></li>
  <li><a href="get-started-manage-skills.html">Import your "skills" into Syntrix.</a></li>
  <li><a href="get-started-manage-your-account-and-users.html">Invite users to join the account.</a></li>
</ol>

<p>At this point, Syntrix users can begin to create synthetic customer assets (<a href="key-terms.html#scenario">scenarios</a>, <a href="key-terms.html#persona">personas</a>, etc.) and <a href="work-in-the-simulation-and-training-studio-simulations-manage-simulations.html">run simulations</a>.</p>

<h3 id="related-topics">Related topics</h3>

<ul>
  <li><a href="work-in-the-simulation-and-training-studio-your-iterative-workflow.html">Your iterative workflow</a></li>
  <li><a href="work-in-the-simulation-and-training-studio-testing-rollout-test-roll-out-on-conversational-cloud.html">Test &amp; roll out on Conversational Cloud</a></li>
  <li><a href="work-in-the-simulation-and-training-studio-testing-rollout-test-roll-out-on-genesys-cloud.html">Test &amp; roll out on Genesys Cloud</a></li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 15 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>External APIs</title>
      <link>https://developers.liveperson.com/bot-analytics-external-apis.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/bot-analytics-external-apis.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>Custom events originate from a scripting function that is written in either the Pre/Post-Process Code or the Process User Response section of any dialog interaction in a bot. Custom events are more flexible than our default analytics, allowing you to specify when and what data is captured for analytic or tracking purposes. For a deeper introduction to custom event logging — including info on viewing custom events in Bot Analytics — see <a href="conversation-builder-best-practices-custom-event-logging.html">our guide</a>.</p>

<p>Bot Analytics makes available public APIs for retrieving custom event data.</p>

<h3 id="use-cases">Use cases</h3>

<p>Data on logged custom events is important for analyzing automated conversations with your consumers. But to analyze that data in your own reporting and analytics solution, you need both automated access to the data and the ability to integrate the data with your own tools. The Bot Analytics public APIs provide you with such access.</p>

<h3 id="important-notes">Important notes</h3>

<ul>
  <li>To use these APIs, you must have the <a href="conversation-builder-bot-accounts-permissions.html">Conversation Builder: Administrator role</a>.</li>
  <li>You can use the APIs to access data that’s captured from the day you onboard and onward. Once you are onboarded, please allow a day for the data to become available. (Onboarding is discussed later in this article.)</li>
  <li>As time rolls on past 30 days since you were onboarded, be mindful that there’s a limit: You can only retrieve data from the last 30 days.</li>
  <li>The API can provide a maximum of 24 hours of data at a time.</li>
  <li>For optimal performance, an isolated database is used for the Custom Events API. Every day at 1 a.m. Eastern:
    <ul>
      <li>A backup of yesterday’s data is created using the main database.</li>
      <li>The backup is transferred to the isolated database.</li>
    </ul>

    <p>It can take up to 1-2 hours for the backup and transfer to be completed. Therefore, when using the APIs, take into account such time delays. If you want the freshest data (yesterday’s events), use the API no earlier than 2-3 a.m. Eastern.</p>
  </li>
  <li>The APIs are rate-limited to 5 requests per second.</li>
  <li>The results are always sorted by timestamp, with the most recent details first.</li>
</ul>

<h3 id="before-you-begin">Before you begin</h3>

<h4 id="requirements">Requirements</h4>

<ul>
  <li>An Apigee API key provided by LivePerson. Contact your LivePerson representative to obtain this.</li>
  <li>Your account (brand) ID in Conversational Cloud.</li>
</ul>

<p class="attn-note">To integrate a second brand account using these APIs, you must obtain a different key. Each key is valid for only one account.</p>

<h4 id="onboarding">Onboarding</h4>

<ol>
  <li>Contact your LivePerson representative and request that they get you onboarded.</li>
  <li>Your LivePerson representative notifies the Bot Analytics team, providing your account ID.</li>
  <li>The Bot Analytics team analyzes your account in terms of capacity, etc., and prepares your account for onboarding to Apigee.</li>
  <li>
    <p>Your LivePerson representative onboards you to Apigee and provides you with your API keys.</p>

    <p class="attn-note">The keys are needed to access these APIs.</p>
  </li>
</ol>

<h3 id="getting-started">Getting started</h3>

<p>Here are a few things you’ll need to get started with these APIs:</p>

<p>1 - Retrieve your domain based on your region:</p>

<table>
  <thead>
    <tr>
      <th>Environment</th>
      <th>Domain</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>North America</td>
      <td>us.livepersonapis.com</td>
    </tr>
    <tr>
      <td>EMEA</td>
      <td>emea.livepersonapis.com</td>
    </tr>
    <tr>
      <td>APAC</td>
      <td>apac.livepersonapis.com</td>
    </tr>
  </tbody>
</table>

<p>2 - Review the <a href="https://www.liveperson.com/policies/apitou/">API terms of use</a>.</p>

<h4 id="authorization">Authorization</h4>

<p>To get the access token for the Bot Analytics APIs:</p>

<ol>
  <li>Log in.</li>
  <li>Invoke SSO authentication.</li>
</ol>

<h5 id="login">Login</h5>

<p>Log in using your Conversational Cloud account (brand) ID and user credentials.</p>

<ul>
  <li>
    <p><strong>Endpoint</strong>: https://{{domain}}/api/account/{{accountId}}/login?v=1.3</p>

    <p>Domain names can be pulled via the agentvep API:</p>

    <p>https://api.liveperson.net/api/account/{{accountId}}/service/agentVep/baseURI.json?version=1.0</p>
  </li>
  <li><strong>HTTP method</strong>: POST</li>
  <li><strong>Request body</strong>:</li>
</ul>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w"> 
</span><span class="nl">"username"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yourLoginName"</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"password"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yourLoginPassword"</span><span class="w"> 
</span><span class="p">}</span><span class="w"> 
</span></code></pre></div></div>

<p><strong>Headers</strong></p>

<table>
  <thead>
    <tr>
      <th>Header name</th>
      <th>Value</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>x-api-key</td>
      <td>API key</td>
      <td>No</td>
    </tr>
    <tr>
      <td>Content-Type</td>
      <td>application/json</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<p><strong>Response</strong></p>

<p>Note the bearer token in the response. Other fields in the response payload can be ignored.</p>

<h5 id="sso-authentication">SSO authentication</h5>

<p>Invoke SSO authentication with the bearer token that you generated in step 1 to retrieve the API access token. You can then use the API access token and the Apigee API key to authenticate to the Bot Analytics API.</p>

<ul>
  <li><strong>Endpoint</strong>: https://{{api-domain}}/cb/auth/v1/sso/authenticate</li>
  <li><strong>HTTP method</strong>: GET</li>
</ul>

<p><strong>Headers</strong></p>

<table>
  <thead>
    <tr>
      <th>Header name</th>
      <th>Value</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>x-api-key</td>
      <td>API key</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>Authorization</td>
      <td>Bearer {{bearer token}}</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<p><strong>Response</strong></p>

<p>Note the <code class="language-html highlighter-rouge">apiAccessToken</code> and <code class="language-html highlighter-rouge">sessionOrganizationId</code> in the response. The value for <code class="language-html highlighter-rouge">sessionOrganizationId</code> is static for each account and can be copied only once and reused in all subsequent requests.</p>

<p>You can ignore the other fields in the response payload.</p>

<h3 id="customevents-api-bot-level">customEvents API (bot level)</h3>

<p>Retrieves a list of custom events triggered by a single bot within a given date range.</p>

<table>
  <thead>
    <tr>
      <th>Description</th>
      <th>Value</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Apigee proxy path</td>
      <td>https://{domain-apigeeProxy}/cb/analytics/v1/accounts/{accountId}/customEvents/{chatbot_id}?</td>
    </tr>
    <tr>
      <td>HTTP method</td>
      <td>GET</td>
    </tr>
  </tbody>
</table>

<h4 id="request">Request</h4>

<h5 id="headers">Headers</h5>

<table>
  <thead>
    <tr>
      <th>Header name</th>
      <th>Value</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>authorization</td>
      <td>Authorization token</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>organizationId</td>
      <td>The organization ID for the current session</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>x-api-key</td>
      <td>API key</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<h5 id="path-parameters">Path parameters</h5>

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
      <th>Type</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>chatbotId</td>
      <td>Bot ID</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<h5 id="query-parameters">Query parameters</h5>

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
      <th>Type</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>startDate</td>
      <td>Start date in the format yyyy-mm-ddTHH:MM:SSZ. For example: 2023-04-19T00:00:00-04:00</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>endDate</td>
      <td>End date in the format yyyy-mm-ddTHH:MM:SSZ. For example: 2023-04-19T00:00:00-04:00</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<h4 id="response-format">Response format</h4>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w"> 
</span><span class="nl">"customEventList"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w"> 
</span><span class="p">{</span><span class="w"> 
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"UserInput"</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"hasChildrens"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> 
</span><span class="p">},</span><span class="w"> 
</span><span class="p">{</span><span class="w"> 
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"API::ok_status_code_200"</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"hasChildrens"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> 
</span><span class="p">},</span><span class="w"> 
</span><span class="p">{</span><span class="w"> 
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Get_started_clicked_no"</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"hasChildrens"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> 
</span><span class="p">},</span><span class="w"> 
</span><span class="p">{</span><span class="w"> 
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"SYSTEM-sde_go_back"</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"hasChildrens"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> 
</span><span class="p">},</span><span class="w"> 
</span><span class="p">{</span><span class="w"> 
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"99 FALLBACK KB Integration"</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"hasChildrens"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> 
</span><span class="p">},</span><span class="w"> 
</span><span class="p">{</span><span class="w"> 
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"FALLBACK index"</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"hasChildrens"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> 
</span><span class="p">}</span><span class="w"> 
</span><span class="p">]</span><span class="w"> 
</span><span class="p">}</span><span class="w"> 
</span></code></pre></div></div>

<h4 id="response-status">Response status</h4>

<p>There’s no response body for non-200 status codes.</p>

<table>
  <tbody>
    <tr>
      <td>Status code</td>
      <td>Description</td>
    </tr>
    <tr>
      <td>200</td>
      <td>Success response<br /><br />Note that scenarios can exist where there are no custom events for a particular bot. In this case, a success response with an empty list is returned.</td>
    </tr>
    <tr>
      <td>400</td>
      <td>Bad request; request validation failures</td>
    </tr>
    <tr>
      <td>401</td>
      <td>Not authorized to access the resource</td>
    </tr>
    <tr>
      <td>404</td>
      <td>Requested response not found</td>
    </tr>
    <tr>
      <td>429</td>
      <td>Too many requests</td>
    </tr>
    <tr>
      <td>500</td>
      <td>Internal server error</td>
    </tr>
  </tbody>
</table>

<h3 id="customevent-api-details-level">customEvent API (details level)</h3>

<p>Retrieves info about the number of times a specific custom event was triggered by a single bot within a given date range.</p>

<table>
  <tbody>
    <tr>
      <td>Description</td>
      <td>Value</td>
    </tr>
    <tr>
      <td>Apigee proxy path</td>
      <td>https://{domain-apigeeProxy}/cb/analytics/v1/accounts/{accountId}/customEvents/{bot_id}/histogram?</td>
    </tr>
    <tr>
      <td>HTTP method</td>
      <td>GET</td>
    </tr>
  </tbody>
</table>

<h4 id="request-1">Request</h4>

<h5 id="headers-1">Headers</h5>

<table>
  <thead>
    <tr>
      <th>Header name</th>
      <th>Value</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>authorization</td>
      <td>Authorization token</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>organizationId</td>
      <td>The organization ID for the current session</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>x-api-key</td>
      <td>API key</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<h5 id="path-parameters-1">Path parameters</h5>

<table>
  <thead>
    <tr>
      <th>Parameters</th>
      <th>Description</th>
      <th>Type</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>chatbotId</td>
      <td>Bot ID</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<h5 id="query-parameters-1">Query parameters</h5>

<table>
  <thead>
    <tr>
      <th>Parameters</th>
      <th>Description</th>
      <th>Type</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>startDate</td>
      <td>Start date in the format yyyy-mm-ddTHH:MM:SSZ. For example: 2023-04-19T00:00:00-04:00</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>endDate</td>
      <td>End date in the format yyyy-mm-ddTHH:MM:SSZ. For example: 2023-04-19T00:00:00-04:00</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>eventName</td>
      <td>Name of the custom event</td>
      <td>String</td>
      <td>No</td>
    </tr>
    <tr>
      <td>interval</td>
      <td>Hourly, Daily</td>
      <td>String</td>
      <td>No</td>
    </tr>
    <tr>
      <td>platform</td>
      <td>Type of the platform. These values are acceptable: FACEBOOK,KIK,TELEGRAM, HTMLCLIENT, SMS, INAPP,INAPP_IOS, INAPP_ANDROID, SMS_TWILIO, WHATSAPP, RCS, ABC, VIBER, LINE, TWITTER, VOICE</td>
      <td>String</td>
      <td>No</td>
    </tr>
  </tbody>
</table>

<h4 id="response-format-1">Response format</h4>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w"> 
</span><span class="nl">"customEventName"</span><span class="p">:</span><span class="w"> </span><span class="s2">" 15 INSTL Item number reprompt 2"</span><span class="p">,</span><span class="w"> </span><span class="nl">"channelTotal"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> 
</span><span class="nl">"HTMLCLIENT"</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"FACEBOOK"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"ABC"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"VIBER"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"VOICE"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"RCS"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"INAPP"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"LINE"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"SMS"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"TWITTER"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="w"> 
</span><span class="p">},</span><span class="w"> 
</span><span class="nl">"histories"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w"> 
</span><span class="p">{</span><span class="w"> 
</span><span class="nl">"platformCount"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> 
</span><span class="nl">"HTMLCLIENT"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"FACEBOOK"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"ABC"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"VIBER"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"VOICE"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"RCS"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"INAPP"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"LINE"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"SMS"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"TWITTER"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="w"> 
</span><span class="p">},</span><span class="w"> 
</span><span class="nl">"platformTotal"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"dateTime"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1663855200000"</span><span class="w"> 
</span><span class="p">},</span><span class="w"> 
</span><span class="p">{</span><span class="w"> 
</span><span class="nl">"platformCount"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> 
</span><span class="nl">"HTMLCLIENT"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"FACEBOOK"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"ABC"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"VIBER"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"VOICE"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"RCS"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"INAPP"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"LINE"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"SMS"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"TWITTER"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="w"> 
</span><span class="p">},</span><span class="w"> 
</span><span class="nl">"platformTotal"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> 
</span><span class="nl">"dateTime"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1663873200000"</span><span class="w"> 
</span><span class="p">}</span><span class="w"> 
</span><span class="p">],</span><span class="w"> 
</span><span class="nl">"total"</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="w"> 
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="response-status-1">Response status</h4>

<p>There’s no response body for non-200 status codes.</p>

<table>
  <tbody>
    <tr>
      <td>Status code</td>
      <td>Description</td>
    </tr>
    <tr>
      <td>200</td>
      <td>Success response<br /><br />Note that scenarios can exist where there are no custom events for a particular bot. In this case, a success response with an empty list is returned.</td>
    </tr>
    <tr>
      <td>400</td>
      <td>Bad request; request validation failures</td>
    </tr>
    <tr>
      <td>401</td>
      <td>Not authorized to access the resource</td>
    </tr>
    <tr>
      <td>404</td>
      <td>Requested response not found</td>
    </tr>
    <tr>
      <td>429</td>
      <td>Too many requests</td>
    </tr>
    <tr>
      <td>500</td>
      <td>Internal server error</td>
    </tr>
  </tbody>
</table>

<h3 id="downloadcustomeventdetails-api-details-level">downloadCustomEventDetails API (details level)</h3>

<p>Retrieves info about the number of times a specific custom event was triggered by a single bot within a given date range.</p>

<table>
  <tbody>
    <tr>
      <td>Description</td>
      <td>Value</td>
    </tr>
    <tr>
      <td>Apigee proxy path</td>
      <td>https://{domain-apigeeProxy}/cb/aiworkbench/v1/chatbots/{chatbotId}/download/customEventDetail?</td>
    </tr>
    <tr>
      <td>HTTP method</td>
      <td>GET</td>
    </tr>
  </tbody>
</table>

<h4 id="request-2">Request</h4>

<h5 id="headers-2">Headers</h5>

<table>
  <thead>
    <tr>
      <th>Header name</th>
      <th>Value</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>authorization</td>
      <td>Authorization token</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>organizationId</td>
      <td>The organization ID for the current session</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>x-api-key</td>
      <td>API key</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<h5 id="path-parameters-2">Path parameters</h5>

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
      <th>Type</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>chatbotId</td>
      <td>Bot ID</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<h5 id="query-parameters-2">Query parameters</h5>

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
      <th>Type</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>startDate</td>
      <td>Start date in the format yyyy-mm-ddTHH:MM:SSZ. For example: 2023-04-19T00:00:00-04:00</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>endDate</td>
      <td>End date in the format yyyy-mm-ddTHH:MM:SSZ. For example: 2023-04-19T00:00:00-04:00</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>eventName</td>
      <td>Name of the custom event</td>
      <td>String</td>
      <td>No</td>
    </tr>
    <tr>
      <td>platform</td>
      <td>Type of the platform. These values are acceptable: FACEBOOK,KIK,TELEGRAM, HTMLCLIENT, SMS, INAPP,INAPP_IOS, INAPP_ANDROID, SMS_TWILIO, WHATSAPP, RCS, ABC, VIBER, LINE, TWITTER, VOICE</td>
      <td>String</td>
      <td>No</td>
    </tr>
  </tbody>
</table>

<h4 id="response-format-2">Response format</h4>

<p>The output is CSV format.</p>

<p><em>eventName,platform,eventDetails,userText,eventCreationTime,conversationId,matchedTitle</em></p>

<p><em>"Question answered? - j",HTMLCLIENT,"Returned article: null","Original user message_2:</em><em>*",2023-04-19T14:59:16.158Z,"7060a959-7d89-436b-9d02-af40421299c1",</em></p>

<p><em>"Question answered? - j",HTMLCLIENT,"Returned article: null","Original user message_2:</em><em>*",2023-04-19T14:59:16.157Z,"7060a959-7d89-436b-9d02-af40421299c1",</em></p>

<h4 id="response-status-2">Response status</h4>

<p>There’s no response body for non-200 status codes.</p>

<table>
  <tbody>
    <tr>
      <td>Status code</td>
      <td>Description</td>
    </tr>
    <tr>
      <td>200</td>
      <td>Success response<br /><br />Note that scenarios can exist where there are no custom events for a particular bot. In this case, a success response with an empty list is returned.</td>
    </tr>
    <tr>
      <td>400</td>
      <td>Bad request; request validation failures</td>
    </tr>
    <tr>
      <td>401</td>
      <td>Not authorized to access the resource</td>
    </tr>
    <tr>
      <td>404</td>
      <td>Requested response not found</td>
    </tr>
    <tr>
      <td>429</td>
      <td>Too many requests</td>
    </tr>
    <tr>
      <td>500</td>
      <td>Internal server error</td>
    </tr>
  </tbody>
</table>

<h3 id="downloadcustomeventtotal-api">downloadCustomEventTotal API</h3>

<p>Retrieves info about the number of times a specific custom event was triggered by a single bot within a given date range.</p>

<table>
  <tbody>
    <tr>
      <td>Description</td>
      <td>Value</td>
    </tr>
    <tr>
      <td>Apigee proxy path</td>
      <td>https://{domain-apigeeProxy}/cb/aiworkbench/v1/chatbots/{chatbotId}/download/customEventTotal?</td>
    </tr>
    <tr>
      <td>HTTP method</td>
      <td>GET</td>
    </tr>
  </tbody>
</table>

<h4 id="request-3">Request</h4>

<h5 id="headers-3">Headers</h5>

<table>
  <thead>
    <tr>
      <th>Header name</th>
      <th>Value</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>authorization</td>
      <td>Authorization token</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>organizationId</td>
      <td>The organization ID for the current session</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>x-api-key</td>
      <td>API key</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<h5 id="path-parameters-3">Path parameters</h5>

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
      <th>Type</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>chatbotId</td>
      <td>Bot ID</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<h5 id="query-parameters-3">Query parameters</h5>

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Description</th>
      <th>Type</th>
      <th>Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>startDate</td>
      <td>Start date in the format yyyy-mm-ddTHH:MM:SSZ. For example: 2023-04-19T00:00:00-04:00</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>endDate</td>
      <td>End date in the format yyyy-mm-ddTHH:MM:SSZ. For example: 2023-04-19T00:00:00-04:00</td>
      <td>String</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>interval</td>
      <td>Hourly, Daily</td>
      <td>String</td>
      <td>No</td>
    </tr>
    <tr>
      <td>platform</td>
      <td>Type of the platform. These values are acceptable: FACEBOOK,KIK,TELEGRAM, HTMLCLIENT, SMS, INAPP,INAPP_IOS, INAPP_ANDROID, SMS_TWILIO, WHATSAPP, RCS, ABC, VIBER, LINE, TWITTER, VOICE</td>
      <td>String</td>
      <td>No</td>
    </tr>
  </tbody>
</table>

<h4 id="response-format-3">Response format</h4>

<p>The output is CSV format.</p>

<p><em>Event Name,Event Detail,Event total,HTMLCLIENT,Date</em></p>

<p><em>Demo,,11,11,2023-04-19</em></p>

<p><em>Question answered? - j,,7,7,2023-04-19</em></p>

<p><em>Bike size is - Zh Option 1,,2,2,2023-04-19</em></p>

<p><em>Question answered? - hh,,2,2,2023-04-19</em></p>

<p><em>Question answered? - jj,,2,2,2023-04-19</em></p>

<p><em>Question answered? - h,,1,1,2023-04-19</em></p>

<p><em>Question answered? - k,,1,1,2023-04-19</em></p>

<h4 id="response-status-3">Response status</h4>

<p>There’s no response body for non-200 status codes.</p>

<table>
  <tbody>
    <tr>
      <td>Status code</td>
      <td>Description</td>
    </tr>
    <tr>
      <td>200</td>
      <td>Success response<br /><br />Note that scenarios can exist where there are no custom events for a particular bot. In this case, a success response with an empty list is returned.</td>
    </tr>
    <tr>
      <td>400</td>
      <td>Bad request; request validation failures</td>
    </tr>
    <tr>
      <td>401</td>
      <td>Not authorized to access the resource</td>
    </tr>
    <tr>
      <td>404</td>
      <td>Requested response not found</td>
    </tr>
    <tr>
      <td>429</td>
      <td>Too many requests</td>
    </tr>
    <tr>
      <td>500</td>
      <td>Internal server error</td>
    </tr>
  </tbody>
</table>

<h3 id="troubleshooting">Troubleshooting</h3>

<p>If you encounter issues when using these APIs, please contact your LivePerson account representative. If the API is returning an error, include mention of the following:</p>

<ul>
  <li>The error code in the response</li>
  <li>The correlationId in the response header</li>
</ul>

<p>These two pieces of information will help us to identify and resolve your issue.</p>
]]></description>
      <!-- <pubDate>Thu, 04 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Overview</title>
      <link>https://developers.liveperson.com/messaging-platform-sdk-overview.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/messaging-platform-sdk-overview.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h1 id="messaging-platform-sdk">Messaging Platform SDK</h1>

<p>An SDK to facilitate agent and consumer interactions on LivePerson's Messaging Platform from Node.js and web applications. Can be used to create bots, system tests, or custom UIs.</p>

<p>For more information about specific classes, functions, or enums see the <a href="https://l1905.gitlab.io/conversational-cloud-engineering/messaging-assist/lp-messaging-sdk/">API Reference</a>.</p>

<p><a href="messaging-platform-sdk-changelog.html">View the changelog here.</a></p>

<p>Messaging Platform SDK has replaced <a href="messaging-agent-sdk-overview.html">Messaging Agent SDK</a> (aka Node Agent SDK) as the recommended method for interacting with Messaging Platform from a node.js application.
See the <a href="messaging-platform-sdk-sdk-feature-comparison.html">Feature Comparison</a> for more information.
For information about converting a Node Agent SDK based project to use Messaging Platform SDK, see our <a href="messaging-platform-sdk-node-agent-sdk-conversion-guide.html">Conversion Guide</a>.</p>

<h2 id="table-of-contents">Table of Contents</h2>

<ul>
  <li><a href="#how-to-install">How To Install</a></li>
  <li><a href="#quick-start">Quick Start</a>
    <ul>
      <li><a href="#a-simple-consumer-conversation">A simple consumer conversation</a></li>
      <li><a href="#a-simple-agent-conversation-listener-bot">A simple agent conversation listener bot</a></li>
    </ul>
  </li>
  <li><a href="#commonly-used-features">Commonly Used Features</a>
    <ul>
      <li><a href="#application-tracking">Application Tracking</a></li>
      <li><a href="#conversations">Conversations</a>
        <ul>
          <li><a href="#create-conversation">Create Conversation</a></li>
          <li><a href="#conversation-functions">Conversation Functions</a>
            <ul>
              <li><a href="#join-and-leave">Join and Leave</a></li>
              <li><a href="#transfer">Transfer</a></li>
              <li><a href="#close">Close</a></li>
              <li><a href="#resume-conversation">Resume conversation</a></li>
              <li><a href="#get-latest-consumer-message">Get Latest Consumer Message</a></li>
            </ul>
          </li>
        </ul>
      </li>
      <li><a href="#rings">Rings</a>
        <ul>
          <li><a href="#agent-routing-tasks-aka-rings">Agent Routing Tasks aka "Rings"</a></li>
          <li><a href="#accepting-conversation-on-the-ring">Accepting conversation on the ring</a></li>
          <li><a href="#faq">FAQ</a></li>
        </ul>
      </li>
      <li><a href="#conversation-events">Conversation Events</a>
        <ul>
          <li><a href="#conversation-event-close">Conversation Event: close</a></li>
          <li><a href="#conversation-event-transfer-skill">Conversation Event: transfer-skill</a></li>
          <li><a href="#conversation-event-transfer-agent">Conversation Event: transfer-agent</a></li>
          <li><a href="#conversation-event-back-to-queue">Conversation Event: back-to-queue</a></li>
          <li><a href="#conversation-event-consumer-step-up">Conversation Event: consumer-step-up</a></li>
          <li><a href="#conversation-event-participant-added">Conversation Event: participant-added</a></li>
          <li><a href="#conversation-event-participant-removed">Conversation Event: participant-removed</a></li>
        </ul>
      </li>
      <li><a href="#messages">Messages</a>
        <ul>
          <li><a href="#markdown-in-messages">Markdown in Messages</a></li>
          <li><a href="#message-events">Message Events</a></li>
          <li><a href="#previous-messages">Previous messages</a></li>
          <li><a href="#message-is-sent-by-current-user">Message is sent by current user</a></li>
          <li><a href="#loading-all-previous-messages">Loading all previous messages</a></li>
          <li><a href="#message-metadata">Message Metadata</a></li>
          <li><a href="#message-quick-replies">Message quick replies</a></li>
          <li><a href="#error-handling">Error Handling</a></li>
        </ul>
      </li>
      <li><a href="#file-sharing">File Sharing</a>
        <ul>
          <li><a href="#upload-a-file-from-nodejs">Upload a file from Node.js</a></li>
          <li><a href="#download-a-file-from-nodejs">Download a file from Node.js</a></li>
          <li><a href="#upload-a-file-from-browser">Upload a file from browser</a></li>
          <li><a href="#download-a-file-in-browser">Download a file in browser</a></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><a href="#advanced-topics">Advanced Topics</a>
    <ul>
      <li><a href="#background-process-errors">Background Process Errors</a></li>
      <li><a href="#multiple-consumer-conversation-handling">Multiple consumer conversation handling</a></li>
      <li><a href="#arbitrary-websocket-requests">Arbitrary websocket requests</a></li>
      <li><a href="#notification-events">Notification Events</a></li>
      <li><a href="#notification-types">Notification Types</a>
        <ul>
          <li><a href="#message-event-notification">Message Event Notification</a></li>
          <li><a href="#conversation-state-notification">Conversation State Notification</a></li>
          <li><a href="#routing-notification">Routing Notification</a></li>
        </ul>
      </li>
      <li><a href="#notification-order">Notification order</a></li>
      <li><a href="#subscriptions">Subscriptions</a>
        <ul>
          <li><a href="#the-default-subscription">The default subscription</a></li>
          <li><a href="#creating-manual-subscriptions">Creating manual subscriptions</a></li>
          <li><a href="#query-properties">Query properties</a></li>
        </ul>
      </li>
      <li><a href="#connection-maintenance">Connection Maintenance</a>
        <ul>
          <li><a href="#automatically-mark-bot-as-offline-upon-disconnect">Automatically mark bot as offline upon disconnect</a></li>
        </ul>
      </li>
      <li><a href="#brand-authentication">Brand Authentication</a>
        <ul>
          <li><a href="#different-authentication-mechanisms">Different authentication mechanisms</a></li>
          <li><a href="#brand-authentication-token-process">Brand Authentication Token Process</a></li>
          <li><a href="#brand-authentication-with-existing-bearer-token">Brand Authentication with existing bearer token</a></li>
          <li><a href="#brand-authentication-using-tokenmaintainer">Brand Authentication using TokenMaintainer</a></li>
        </ul>
      </li>
      <li><a href="#continuing-an-anonymous-user-session-between-two-connections">Continuing an anonymous user session between two connections</a></li>
      <li><a href="#client-properties">Client Properties</a></li>
      <li><a href="#conversation-context-and-campaign-info">Conversation Context and Campaign Info</a></li>
      <li><a href="#consumer-auth-flow">Consumer Auth Flow</a></li>
      <li><a href="#getting-a-user-profile">Getting a User Profile</a></li>
      <li><a href="#set-user-profile">Set User Profile</a></li>
      <li><a href="#consumer-step-up">Consumer Step Up</a></li>
      <li><a href="#message-statistics">Message statistics</a></li>
      <li><a href="#using-proxies">Using proxies</a></li>
      <li><a href="#response-timeout">Response Timeout</a></li>
      <li><a href="#combined-conversation-handling">Combined conversation handling</a></li>
    </ul>
  </li>
  <li><a href="#features-not-yet-supported">Features Not yet supported</a></li>
</ul>

<h2 id="how-to-install">How To Install</h2>

<p>To install as a dependency, run the following from a terminal window:</p>

<p><code class="language-html highlighter-rouge">npm install lp-messaging-sdk</code></p>

<h2 id="quick-start">Quick Start</h2>

<h3 id="a-simple-consumer-conversation">A simple consumer conversation</h3>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">"</span><span class="s2">lp-messaging-sdk</span><span class="dl">"</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">12345678</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span>
<span class="p">});</span>

<span class="c1">// log any internal errors (auth errors, etc)</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
<span class="p">});</span>

<span class="c1">// connect &amp; open conversation</span>
<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

<span class="c1">// optionally set the consumer's name information</span>
<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">setUserProfile</span><span class="p">({</span><span class="na">firstName</span><span class="p">:</span> <span class="dl">'</span><span class="s1">firstName</span><span class="dl">'</span><span class="p">,</span> <span class="na">lastName</span><span class="p">:</span> <span class="dl">'</span><span class="s1">lastName</span><span class="dl">'</span><span class="p">,</span> <span class="na">nickName</span><span class="p">:</span> <span class="dl">'</span><span class="s1">nickName</span><span class="dl">'</span><span class="p">});</span>

<span class="c1">// create conversation</span>
<span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">();</span>

<span class="c1">// setup a message notification listener</span>
<span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">));</span>
<span class="p">});</span>

<span class="c1">// send a message</span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">test</span><span class="dl">'</span><span class="p">);</span>

<span class="c1">// close the main dialog</span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>

<span class="c1">// close the connection</span>
<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
</code></pre></div></div>

<h3 id="a-simple-agent-conversation-listener-bot">A simple agent conversation listener bot</h3>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">"</span><span class="s2">lp-messaging-sdk</span><span class="dl">"</span><span class="p">);</span>

<span class="c1">// define the auth data</span>
<span class="kd">const</span> <span class="nx">accountId</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">12345678</span><span class="dl">'</span><span class="p">;</span>
<span class="kd">const</span> <span class="nx">authData</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">username</span><span class="p">:</span> <span class="dl">'</span><span class="s1">bot1</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">appKey</span><span class="p">:</span> <span class="dl">'</span><span class="s1">1a804df636f347bgcb4974a1ea3e2a91</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">secret</span><span class="p">:</span> <span class="dl">'</span><span class="s1">e15d540710838b40</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accessToken</span><span class="p">:</span> <span class="dl">'</span><span class="s1">ccf8gf5bb346f3a95245e9b4798695f2</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accessTokenSecret</span><span class="p">:</span> <span class="dl">'</span><span class="s1">876c7425f81c5160</span><span class="dl">'</span>
<span class="p">};</span>

<span class="c1">// create the connection object</span>
<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">authData</span>
<span class="p">});</span>

<span class="c1">// log any internal errors (auth errors, etc)</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
<span class="p">});</span>

<span class="c1">// setup the conversation event</span>
<span class="c1">// this event will fire whenever the bot is informed of a new conversation</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>

    <span class="c1">// join the conversation as "AGENT" role</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">AGENT</span><span class="p">);</span>
    
    <span class="c1">// listen for messages from the consumer</span>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
        
        <span class="c1">// ignore all messages not from the consumer</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">participant</span><span class="p">.</span><span class="nx">role</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
        
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">);</span>
        
        <span class="c1">// send a simple response</span>
        <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">hello</span><span class="dl">'</span><span class="p">);</span>
    <span class="p">});</span>
    
    <span class="c1">// listen for the close event</span>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">close</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation closed</span><span class="dl">'</span><span class="p">);</span>
    <span class="p">});</span>
    
<span class="p">});</span>

<span class="c1">// make the connection</span>
<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
</code></pre></div></div>

<h2 id="commonly-used-features">Commonly Used Features</h2>

<h3 id="application-tracking">Application Tracking</h3>

<p>In order to help us provide the best support, we require that you choose an <code class="language-html highlighter-rouge">appId</code> for your application.
<code class="language-html highlighter-rouge">appId</code> should only contain characters <code class="language-html highlighter-rouge">a-z</code> and/or the special characters: <code class="language-html highlighter-rouge">-_.</code>.
This should be passed in the createConnection function along with the version of your application if available.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">consumerConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">appVersion</span><span class="p">:</span> <span class="dl">'</span><span class="s1">1.6.2</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">123456</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span>
<span class="p">});</span>
</code></pre></div></div>

<hr />

<h3 id="conversations">Conversations</h3>

<h4 id="create-conversation">Create Conversation</h4>

<p>When a consumer connection calls <code class="language-html highlighter-rouge">createConversation</code> with no arguments, the conversation will be created in the default skill: "-1".</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">();</span>
<span class="nx">expect</span><span class="p">(</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">skill</span><span class="p">.</span><span class="nx">skillId</span><span class="p">).</span><span class="nx">toEqual</span><span class="p">(</span><span class="dl">'</span><span class="s1">-1</span><span class="dl">'</span><span class="p">);</span>
</code></pre></div></div>

<p>To create a conversation in a specific skill, simply pass the skillId as an argument when calling createConversation.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">({</span><span class="na">skillId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">12345678</span><span class="dl">'</span><span class="p">});</span>
</code></pre></div></div>

<p>See <a href="#conversation-context-and-campaign-info">Conversation Context and Campaign Info</a> for two other arguments that can be passed to createConversation.</p>

<hr />

<h4 id="conversation-functions">Conversation Functions</h4>

<h5 id="join-and-leave">Join and Leave</h5>

<p>One way to join a conversation is to invoke the join function on that conversation, passing the role that the current user should join the conversation as. Commonly used roles are <code class="language-html highlighter-rouge">ASSIGNED_AGENT</code>, <code class="language-html highlighter-rouge">AGENT</code>, <code class="language-html highlighter-rouge">MANAGER</code>, and <code class="language-html highlighter-rouge">CONTROLLER</code>.
The other main way to join a conversation as the assigned agent is to <a href="#agent-routing-tasks-aka-rings">accept a ring</a>.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
</code></pre></div></div>

<p>To leave a conversation, use the leave function.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">leave</span><span class="p">();</span>
</code></pre></div></div>

<h5 id="transfer">Transfer</h5>

<p>To transfer a conversation, use the transfer function. The transfer function will remove the assigned agent from the conversation (if present) and then transfer the conversation to the specified skill or agent. Keep in mind that if you try to transfer without having an open conversation you will get an error.</p>

<p>NOTE: when transferring to a specific agent, specify the whole agent id, i.e. <code class="language-html highlighter-rouge">accountId.agentId</code>, instead of just <code class="language-html highlighter-rouge">agentId</code>.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// transfer to a specific skill</span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">transfer</span><span class="p">({</span><span class="na">skillId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">1111111</span><span class="dl">'</span><span class="p">});</span>

<span class="c1">// transfer to a specific agent </span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">transfer</span><span class="p">({</span><span class="na">agentId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">2222222.5555555</span><span class="dl">'</span><span class="p">});</span>
</code></pre></div></div>

<h5 id="close">Close</h5>

<p>You have the option to close either the main dialog or the entire conversation. Here's how each works:</p>

<ul>
  <li>
    <p>Closing the Main Dialog:
When you close the main dialog, the conversation remains open as long as there are other dialogs configured.
For instance, post-conversation surveys might run in a separate dialog after the main dialog ends. If no additional
dialog is configured, the conversation will automatically close.</p>
  </li>
  <li>
    <p>Closing the Conversation:
Closing the entire conversation prevents any further dialogs from appearing, including post-conversation surveys. This
is important to consider if you plan to configure post-conversation surveys in the future.</p>
  </li>
</ul>

<p>To close only the main dialog while leaving the conversation open, use the following method:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">getDialog</span><span class="p">(</span><span class="nx">DialogType</span><span class="p">.</span><span class="nx">MAIN</span><span class="p">).</span><span class="nx">close</span><span class="p">()</span>
</code></pre></div></div>

<p>To close the entire conversation, use the close function on the <code class="language-html highlighter-rouge">conversation</code> object. Be aware that doing so will disable post-conversation surveys:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
</code></pre></div></div>

<p>Alternatively, you can close a conversation by passing its conversationId to the closeConversation method of the <code class="language-html highlighter-rouge">connection</code>
object. This does not require a conversation object, but keep in mind that post-conversation surveys will not run:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">conversationId</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">123456789</span><span class="dl">'</span><span class="p">;</span>
<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">closeConversation</span><span class="p">(</span><span class="nx">conversationId</span><span class="p">);</span>
</code></pre></div></div>

<h5 id="resume-conversation">Resume conversation</h5>

<p>To resume previously closed conversation you can use the resumeConversation function</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">resumedConversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">resumeConversation</span><span class="p">();</span>
</code></pre></div></div>

<h5 id="get-latest-consumer-message">Get Latest Consumer Message</h5>

<p>To get latest consumer message you can use getLatestConsumerMessage function. Note that, the function does not attempt
to retrieve messages over the network. This means the latest consumer message will only be available if was received
before.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">latestConsumerMessage</span> <span class="o">=</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">getLatestConsumerMessage</span><span class="p">();</span>
</code></pre></div></div>

<hr />
<h3 id="rings">Rings</h3>

<h4 id="agent-routing-tasks-aka-rings">Agent Routing Tasks aka "Rings"</h4>

<p>Most bots are configured for the role of <code class="language-html highlighter-rouge">MANAGER</code> and receive conversations by virtue of being subscribed to
all conversations, and thus they will get their conversations through the connection.on('conversation') event.</p>

<p>Agents and agent-type bots, on the other hand, get notified that they should handle a certain conversation through a
process called "agent routing". In this process, the bot must indicate it is open to accepting routing tasks
otherwise known as "rings" by setting their agent state to "online" and creating a routingTaskSubscription, which
will then emit <code class="language-html highlighter-rouge">ring</code> events when an agent has been assigned to handle a conversation.</p>

<p>Note: If an agent (bot or human) accepts a ring, the agent is assigned to the corresponding conversation.
When the agent rejects the ring or lets it expire the corresponding conversation is moved back to the queue.
This means, that when multiple agents with the same skill are online, rings might not arrive immediately - because other
agents are ringed first.</p>

<p>When a ring is received, the agent has the option to either accept or reject the ring. Accepting the ring will add
the agent as a participant on the conversation with the role of <code class="language-html highlighter-rouge">ASSIGNED_AGENT</code>.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// connect as admin for brand</span>
<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span><span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span> <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span> <span class="nx">accountId</span><span class="p">,</span> <span class="nx">authData</span><span class="p">});</span>
<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

<span class="c1">// agent state must be "ONLINE" in order to receive rings</span>
<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">setAgentState</span><span class="p">({</span><span class="na">agentState</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">AgentState</span><span class="p">.</span><span class="nx">ONLINE</span><span class="p">});</span>

<span class="c1">// subscribe to routing tasks (rings)</span>
<span class="kd">const</span> <span class="nx">taskRoutingSubscription</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createRoutingTaskSubscription</span><span class="p">();</span>

<span class="c1">// process the rings as they arrive</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">ring</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">ring</span> <span class="o">=&gt;</span> <span class="p">{</span>
    
    <span class="c1">// ignore old rings</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">ring</span><span class="p">.</span><span class="nx">ringState</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">RingState</span><span class="p">.</span><span class="nx">WAITING</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
    
    <span class="c1">// accept the ring</span>
    <span class="c1">// full conversation will appear from the connection.on('conversation') event (for now)</span>
    <span class="k">await</span> <span class="nx">ring</span><span class="p">.</span><span class="nx">accept</span><span class="p">();</span>
    
    <span class="c1">// or reject the ring</span>
    <span class="c1">// await ring.reject();</span>
<span class="p">});</span>

<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">agent has been added to the conversation</span><span class="dl">'</span><span class="p">);</span>
<span class="p">});</span>
</code></pre></div></div>

<h4 id="accepting-conversation-on-the-ring">Accepting conversation on the ring</h4>

<p>As convenience, you can fetch the conversation, which is assigned to the ring.
The default timeout is two seconds with 100 ms polling intervals.
You can set a different timeout in milliseconds when establishing the brand connection.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// connect as admin for brand</span>
<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span><span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span> <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span> <span class="nx">accountId</span><span class="p">,</span> <span class="nx">authData</span><span class="p">,</span> <span class="na">ringConversationTimeout</span><span class="p">:</span> <span class="mi">2000</span><span class="p">});</span>
<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

<span class="c1">// agent state must be "ONLINE" in order to receive rings</span>
<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">setAgentState</span><span class="p">({</span><span class="na">agentState</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">AgentState</span><span class="p">.</span><span class="nx">ONLINE</span><span class="p">});</span>

<span class="c1">// subscribe to routing tasks (rings)</span>
<span class="kd">const</span> <span class="nx">taskRoutingSubscription</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createRoutingTaskSubscription</span><span class="p">();</span>

<span class="c1">// process the rings as they arrive</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">ring</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">ring</span> <span class="o">=&gt;</span> <span class="p">{</span>
    
    <span class="c1">// ignore old rings</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">ring</span><span class="p">.</span><span class="nx">ringState</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">RingState</span><span class="p">.</span><span class="nx">WAITING</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
    
    <span class="c1">// accept the ring</span>
    <span class="k">await</span> <span class="nx">ring</span><span class="p">.</span><span class="nx">accept</span><span class="p">();</span>

    <span class="c1">// await fetching conversation</span>
    <span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">ring</span><span class="p">.</span><span class="nx">conversation</span><span class="p">();</span>
    
    <span class="c1">// or define callback to avoid pausing code execution</span>
    <span class="nx">ring</span><span class="p">.</span><span class="nx">conversation</span><span class="p">().</span><span class="nx">then</span><span class="p">((</span><span class="nx">conversation</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
       <span class="c1">// process conversation and/or execute code that depends on the conversation to have already been fetched</span>
    <span class="p">});</span>

    <span class="c1">// or reject the ring</span>
    <span class="c1">// await ring.reject();</span>
<span class="p">});</span>

</code></pre></div></div>
<hr />

<h4 id="faq">FAQ</h4>

<details>
  <summary>Q: When a ring is accepted, can it be accepted by another agent? </summary>

A: A ring is always specific for one agent. It cannot be accepted twice. When a ring is accepted, the conversation is assigned to this bot or agent.
</details>

<details>
  <summary>Q: Can two different rings share the same id?</summary>

A: Two different rings always have a different id. When a conversation is sent back to the queue, a new ring for a different agent with a different id
will be created. The ring id has this pattern: dialogId_brandId_timeStampInMilliSeconds.
</details>

<details>
  <summary>Q: How is the skillId of the ring determined?</summary>

A: A skill id is related to a conversation. It is selected by a rule engine or by the engagement when the conversation is opened by a consumer.
The skill id of a ring can change when the conversation is transferred to a different skill.
</details>

<details>
  <summary>Q: What happens when an agent rejects a ring?</summary>

A: Agents assigned to the skill of the conversation are ringed one after another. If all reject the ring, the first agent will be ringed again.
For example, given three agents with skill A. When there is a new conversation for skill A and the first agent rejects the ring, then the conversation
is put back in the queue. A new ring is created for the second agent. If all three agents reject the ring, the first agent will be ringed again.
</details>

<h3 id="conversation-events">Conversation Events</h3>

<p>With the Messaging Platform SDK, it is possible to set up hooks for events in a conversation.</p>

<h4 id="conversation-event-close">Conversation Event: close</h4>

<p>To know when a conversation closes, watch the <code class="language-html highlighter-rouge">close</code> event.
Please note that most conversation actions are not available for closed conversations, such as sending a message or transfer.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">close</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="c1">// TODO: close action</span>
<span class="p">});</span>
</code></pre></div></div>

<h4 id="conversation-event-transfer-skill">Conversation Event: transfer-skill</h4>

<p>The <code class="language-html highlighter-rouge">transfer-skill</code> event will fire when the conversation is transferred from one skill to another. Usually this also involves the assigned agent being removed.</p>

<p>One potential use case for conversation hooks is to implement holder bots that handles conversations when the
contact center is in off hours and there are no available agents:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">transfer-skill</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    
    <span class="c1">// if the new skill is in off hours</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">skill</span><span class="p">.</span><span class="nx">isInOffHours</span><span class="p">())</span> <span class="p">{</span>
        
        <span class="c1">// join the conversation and send a message to inform the consumer</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">AGENT</span><span class="p">);</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">we are in off hours, would you like to wait?</span><span class="dl">'</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>
</code></pre></div></div>

<h4 id="conversation-event-transfer-agent">Conversation Event: transfer-agent</h4>

<p>The <code class="language-html highlighter-rouge">transfer-agent</code> event will fire when the conversation is transferred directly from one assigned agent to another.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">transfer-agent</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    
<span class="p">});</span>
</code></pre></div></div>

<h4 id="conversation-event-back-to-queue">Conversation Event: back-to-queue</h4>

<p>The <code class="language-html highlighter-rouge">back-to-queue</code> event will fire when the assigned agent is removed from the conversation (without adding another) and the skill does not change.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">back-to-queue</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    
<span class="p">});</span>
</code></pre></div></div>

<h4 id="conversation-event-consumer-step-up">Conversation Event: consumer-step-up</h4>

<p>The <code class="language-html highlighter-rouge">consumer-step-up</code> event will fire when the consumer becomes authenticated during a conversation.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">consumer-step-up</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    
<span class="p">});</span>
</code></pre></div></div>

<h4 id="conversation-event-participant-added">Conversation Event: participant-added</h4>

<p>The <code class="language-html highlighter-rouge">participant-added</code> event will fire whenever any participant is added to the conversation, this includes bots and managers.</p>

<p>It is also possible to extend the <a href="#a-simple-agent-conversation-listener-bot">agent greeter bot</a> to react to new participants
on the conversation, a hook for <code class="language-html highlighter-rouge">participant-added</code> event can be added:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// listen for new participants on the conversation</span>
<span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">participant-added</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">addedParticipant</span> <span class="o">=&gt;</span> <span class="p">{</span>

    <span class="c1">// if a manager joins, send a private message that is hidden from the consumer</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">addedParticipant</span><span class="p">.</span><span class="nx">participant</span><span class="p">.</span><span class="nx">role</span> <span class="o">===</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">MANAGER</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendPrivateMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">a manager has joined the conversation</span><span class="dl">'</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>
</code></pre></div></div>

<h4 id="conversation-event-participant-removed">Conversation Event: participant-removed</h4>

<p>The <code class="language-html highlighter-rouge">participant-removed</code> event will fire whenever any participant is removed from the conversation.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">participant-removed</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">(</span><span class="nx">removedParticipant</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
    
<span class="p">});</span>
</code></pre></div></div>

<p>For a complete list of events emitted by the conversation object, see <strong>Events</strong> section of <a href="https://l1905.gitlab.io/conversational-cloud-engineering/conversation-exchange-services/lp-messaging-sdk/Conversation.html">Conversation class</a></p>

<hr />

<h3 id="messages">Messages</h3>

<p>To send a message to a conversation there are several methods you can use:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// plain text</span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">hello</span><span class="dl">'</span><span class="p">);</span>

<span class="c1">// rich text</span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendRichText</span><span class="p">(</span><span class="nx">richTextObject</span><span class="p">);</span>

<span class="c1">// brand connections can send private messages to a conversation that consumers will not see</span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendPrivateMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">this is private</span><span class="dl">'</span><span class="p">);</span>
</code></pre></div></div>

<h4 id="markdown-in-messages">Markdown in Messages</h4>

<p>Messages can include markdown encoding by wrapping the mardown in the <code class="language-html highlighter-rouge">#md#</code> tag.
One common use is to use this to create a hyperlink via the markdown syntax of <code class="language-html highlighter-rouge">[label](url)</code>.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">view our docs #md#[here](https://developers.liveperson.com)#/md#</span><span class="dl">'</span><span class="p">);</span>
</code></pre></div></div>

<h4 id="message-events">Message Events</h4>

<p>To receive messages you can watch the conversation's <code class="language-html highlighter-rouge">message</code> event.
If the user is an assigned agent or a consumer, your application should call the <code class="language-html highlighter-rouge">accept</code> and <code class="language-html highlighter-rouge">read</code> functions in order to tell the system that the message has been accepted and read (where appropriate).</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// listen for messages from the consumer</span>
<span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
    
    <span class="c1">// ignore all messages not from the consumer</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">participant</span><span class="p">.</span><span class="nx">role</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
    
    <span class="c1">// indicate that our application has received the message</span>
    <span class="k">await</span> <span class="nx">message</span><span class="p">.</span><span class="nx">accept</span><span class="p">();</span>
    
    <span class="c1">// write the message out to log</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">);</span>
    
    <span class="c1">// indicate that the user had read the message</span>
    <span class="k">await</span> <span class="nx">message</span><span class="p">.</span><span class="nx">read</span><span class="p">();</span>
<span class="p">});</span>
</code></pre></div></div>

<h4 id="previous-messages">Previous messages</h4>

<p>All received messages for a dialog will be stored in the <code class="language-html highlighter-rouge">messages</code> array of that dialog.
You can iterate through that array to write these messages to the screen or a log.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="k">for</span> <span class="p">(</span><span class="kd">const</span> <span class="nx">message</span> <span class="k">of</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">openDialog</span><span class="p">.</span><span class="nx">messages</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<h4 id="message-is-sent-by-current-user">Message is sent by current user</h4>

<p>To check if a message is self sent (sent from the same user) you can use the sentByCurrentUser() method on every message.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">message</span><span class="p">.</span><span class="nx">sentByCurrentUser</span><span class="p">();</span>
</code></pre></div></div>

<h4 id="loading-all-previous-messages">Loading all previous messages</h4>

<p>By default, <code class="language-html highlighter-rouge">messages</code> will only have the messages that have been received since the conversation was joined.
For consumer connections, all messages are automatically retrieved for open conversations. For brand connections, messages
are not automatically retrieved, because this could result in excessive memory usage for accounts with a large number of
open conversations. Instead, you can call <code class="language-html highlighter-rouge">getAllPublishEvents</code> on a conversation's dialog to ensure that all of its
messages have been loaded into the <code class="language-html highlighter-rouge">messages</code> array.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="c1">// Load events for the open or main dialog</span>
  <span class="kd">const</span> <span class="nx">dialog</span> <span class="o">=</span> <span class="nx">openDialogOrMainDialogIfAvailable</span><span class="p">(</span><span class="nx">conversation</span><span class="p">)</span>
  <span class="k">if</span> <span class="p">(</span><span class="nx">dialog</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">await</span> <span class="nx">dialog</span><span class="p">.</span><span class="nx">getAllPublishEvents</span><span class="p">();</span>
  <span class="p">}</span>
  <span class="c1">// [execute conversation code]</span>
<span class="p">});</span>

<span class="cm">/**
 * Returns the open dialog or the main dialog if the conversation is closed.
 * 
 * @param conversation of the dialog
 * @returns {(null|dialog)}
 */</span>
<span class="kd">function</span> <span class="nx">openDialogOrMainDialogIfAvailable</span><span class="p">(</span><span class="nx">conversation</span><span class="p">)</span> <span class="p">{</span>
  <span class="k">return</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">openDialog</span> <span class="o">??</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">getDialog</span><span class="p">(</span><span class="nx">DialogType</span><span class="p">.</span><span class="nx">MAIN</span><span class="p">);</span>
<span class="p">}</span>

</code></pre></div></div>

<p>However, you can force the SDK to automatically call <code class="language-html highlighter-rouge">getAllPublishEvents</code> on all conversations as they are received, before they are emitted via the conversation event,
by passing the argument <code class="language-html highlighter-rouge">getAllMessages: true</code> when calling <code class="language-html highlighter-rouge">createConnection</code></p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">authData</span><span class="p">,</span>
    <span class="na">getAllMessages</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">});</span>
</code></pre></div></div>

<hr />

<h4 id="message-metadata">Message Metadata</h4>

<p>To attach metadata to a message, pass it in as the second parameter to <code class="language-html highlighter-rouge">sendMessage</code>, <code class="language-html highlighter-rouge">sendRichText</code>, or <code class="language-html highlighter-rouge">sendPrivateMessage</code>.
The structure of metadata objects is strictly validated, please contact the Messaging Platform team for more information.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// TODO: ensure the metadata structure conforms to a valid metadata definition based on type</span>
<span class="kd">const</span> <span class="nx">metadata</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">ExternalId</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">id</span><span class="p">:</span> <span class="dl">'</span><span class="s1">123</span><span class="dl">'</span>
<span class="p">};</span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">external action 123 was taken</span><span class="dl">'</span><span class="p">,</span> <span class="nx">metadata</span><span class="p">);</span>
</code></pre></div></div>

<p>Metadata can also be an array of metadata objects, if you need to attach more than one:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">metadata1</span> <span class="o">=</span> <span class="p">{</span><span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">ExternalId</span><span class="dl">'</span><span class="p">,</span><span class="na">id</span><span class="p">:</span> <span class="dl">'</span><span class="s1">1</span><span class="dl">'</span><span class="p">};</span>
<span class="kd">const</span> <span class="nx">metadata2</span> <span class="o">=</span> <span class="p">{</span><span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">ExternalId</span><span class="dl">'</span><span class="p">,</span><span class="na">id</span><span class="p">:</span> <span class="dl">'</span><span class="s1">2</span><span class="dl">'</span><span class="p">};</span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">external action 123 was taken</span><span class="dl">'</span><span class="p">,</span> <span class="p">[</span><span class="nx">metadata1</span><span class="p">,</span> <span class="nx">metadata2</span><span class="p">]);</span>
</code></pre></div></div>
<hr />

<h4 id="message-quick-replies">Message quick replies</h4>

<p>To attach quick replies to a message, pass the object as the third parameter to <code class="language-html highlighter-rouge">sendMessage</code> or <code class="language-html highlighter-rouge">sendRichText</code>.
The structure of quick reply objects is strictly validated, please contact the Messaging Platform team for more information.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// TODO: ensure the quickreplies structure conforms to a valid definition</span>
<span class="kd">const</span> <span class="nx">quickReplies</span> <span class="o">=</span> <span class="p">{</span>
    <span class="dl">"</span><span class="s2">type</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">quickReplies</span><span class="dl">"</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">itemsPerRow</span><span class="dl">"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">replies</span><span class="dl">"</span><span class="p">:</span> <span class="p">[</span>
        <span class="c1">// TODO: insert quickreplies objects here</span>
    <span class="p">]</span>
<span class="p">};</span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">here are some quick replies</span><span class="dl">'</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">quickReplies</span><span class="p">);</span>
</code></pre></div></div>

<hr />

<h3 id="error-handling">Error Handling</h3>

<p>To help you identify missed events when an error of type <code class="language-html highlighter-rouge">conversation not in cache</code> occurs, the SDK provides the event itself. 
This situation can arise, for example, when a message notification is received, but the event for the conversation's creation has not yet been processed. 
You can access the event associated with the error using <code class="language-html highlighter-rouge">error.event</code>.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s2">`error`</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">err</span><span class="p">.</span><span class="nx">event</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">handleMessageForUnknownConversation</span><span class="p">(</span><span class="nx">err</span><span class="p">.</span><span class="nx">event</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">})</span>

<span class="kd">function</span> <span class="nx">handleMessageForUnknownConversation</span><span class="p">(</span><span class="nx">event</span><span class="p">){</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Event with error: </span><span class="p">${</span><span class="nx">event</span><span class="p">}</span><span class="s2">`</span><span class="p">)</span>
<span class="p">}</span>

</code></pre></div></div>

<hr />

<h3 id="file-sharing">File Sharing</h3>

<p>Accounts that have <a href="https://community.liveperson.com/kb/articles/1130-agent-file-sharing-overview">filesharing enabled</a>
can upload and download files using the SDK. The article also describes the limits such as file size, formats, supported channels</p>

<p>To upload files, pass an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer">ArrayBuffer</a>
to the <code class="language-html highlighter-rouge">Conversation.uploadFile</code> method. An optional caption can also be passed in as the second argument.</p>

<p>If the upload succeeds, the SDK will then publish a message on the conversation with the uploaded file and caption (if
any), which makes it viewable by the conversation participants. For image files, the SDK will generate a preview thumbnail
that gets displayed in <a href="https://community.liveperson.com/kb/articles/1378-photo-sharing-user-guide">supported channels</a>.</p>

<h4 id="upload-a-file-from-nodejs">Upload a file from Node.js</h4>

<p>To upload a file In Node.js environments, access the file with the File System module to generate a buffer.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">fs</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">path</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">path</span><span class="dl">'</span><span class="p">);</span>

<span class="c1">// read the file into a buffer</span>
<span class="kd">const</span> <span class="nx">file</span> <span class="o">=</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="nx">path</span><span class="p">.</span><span class="nx">resolve</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">,</span> <span class="dl">'</span><span class="s1">asset/logo.png</span><span class="dl">'</span><span class="p">));</span>

<span class="c1">// upload the buffer</span>
<span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">uploadFile</span><span class="p">(</span><span class="nx">file</span><span class="p">.</span><span class="nx">buffer</span><span class="p">);</span>
</code></pre></div></div>

<h4 id="download-a-file-from-nodejs">Download a file from Node.js</h4>

<p>Whenever the conversation has a downloadable message with a file, the file can be downloaded.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// set up a hook to download files in the conversation</span>
<span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">(</span><span class="nx">msg</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
    
    <span class="c1">// ignore regular messages without files</span>
    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">msg</span><span class="p">.</span><span class="nx">isDownloadable</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>
    
    <span class="c1">// download the file</span>
    <span class="kd">const</span> <span class="nx">downloadedFile</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">msg</span><span class="p">.</span><span class="nx">downloadFile</span><span class="p">();</span>
    
    <span class="c1">// write the file out to disk</span>
    <span class="kd">const</span> <span class="nx">buffer</span> <span class="o">=</span> <span class="nx">downloadedFile</span><span class="p">.</span><span class="nx">data</span><span class="p">;</span>
    <span class="kd">const</span> <span class="nx">filename</span> <span class="o">=</span> <span class="nx">downloadedFile</span><span class="p">.</span><span class="nx">filename</span><span class="p">;</span>
    <span class="nx">fs</span><span class="p">.</span><span class="nx">writeFileSync</span><span class="p">(</span><span class="nx">path</span><span class="p">.</span><span class="nx">resolve</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">,</span> <span class="s2">`asset/</span><span class="p">${</span><span class="nx">filename</span><span class="p">}</span><span class="s2">`</span><span class="p">),</span> <span class="nx">data</span><span class="p">);</span>
<span class="p">});</span>
</code></pre></div></div>

<h4 id="upload-a-file-from-browser">Upload a file from browser</h4>

<p>For browser implementations, the SDK supports client-side scripting with JavaScript.
To allow a user to upload a file to a conversation, first create an input tag of type <code class="language-html highlighter-rouge">file</code>, an event that pulls the data from that file, and uploads it to the conversation.</p>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">"file-upload"</span> <span class="na">style=</span><span class="s">"padding: 4px"</span><span class="nt">&gt;</span>
    <span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">"file"</span> <span class="na">id=</span><span class="s">"selected-file"</span><span class="nt">&gt;</span>
    <span class="nt">&lt;button</span> <span class="na">id=</span><span class="s">"upload"</span> <span class="na">value=</span><span class="s">"upload"</span><span class="nt">&gt;</span>Upload<span class="nt">&lt;/button&gt;</span>
<span class="nt">&lt;/div&gt;</span>

<span class="nt">&lt;script </span><span class="na">type=</span><span class="s">"text/javascript"</span><span class="nt">&gt;</span>
    <span class="kd">const</span> <span class="nx">selectedFile</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">querySelector</span><span class="p">(</span><span class="dl">'</span><span class="s1">#selected-file</span><span class="dl">'</span><span class="p">);</span>

    <span class="k">async</span> <span class="kd">function</span> <span class="nx">upload</span><span class="p">(</span><span class="nx">buffer</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">uploadFile</span><span class="p">(</span><span class="nx">buffer</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="nb">document</span><span class="p">.</span><span class="nx">querySelector</span><span class="p">(</span><span class="dl">'</span><span class="s1">#upload</span><span class="dl">'</span><span class="p">).</span><span class="nx">addEventListener</span><span class="p">(</span><span class="dl">'</span><span class="s1">click</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">uploading file</span><span class="dl">'</span><span class="p">);</span>

        <span class="kd">const</span> <span class="nx">file</span> <span class="o">=</span> <span class="nx">selectedFile</span><span class="p">.</span><span class="nx">files</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
        
        <span class="c1">// create a FileReader instance and read the selected file as arrayBuffer</span>
        <span class="kd">let</span> <span class="nx">fr</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">FileReader</span><span class="p">();</span>
        <span class="nx">fr</span><span class="p">.</span><span class="nx">onload</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
            <span class="kd">let</span> <span class="nx">data</span> <span class="o">=</span> <span class="nx">fr</span><span class="p">.</span><span class="nx">result</span><span class="p">;</span>
            <span class="nx">upload</span><span class="p">(</span><span class="nx">data</span><span class="p">).</span><span class="nx">then</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="p">{</span>
                <span class="nx">writeLine</span><span class="p">(</span><span class="dl">'</span><span class="s1">file uploaded</span><span class="dl">'</span><span class="p">);</span>
            <span class="p">});</span>
        <span class="p">};</span>
        <span class="nx">fr</span><span class="p">.</span><span class="nx">readAsArrayBuffer</span><span class="p">(</span><span class="nx">file</span><span class="p">);</span>
    <span class="p">});</span>
<span class="nt">&lt;/script&gt;</span>
</code></pre></div></div>

<h4 id="download-a-file-in-browser">Download a file in browser</h4>

<p>To download a file, set up a message event as before, but use the <code class="language-html highlighter-rouge">download</code> function below in order to cause the browser to prompt the user to save the file to disk.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">(</span><span class="nx">msg</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
        <span class="c1">// ignore regular messages without files</span>
        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">msg</span><span class="p">.</span><span class="nx">isDownloadable</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">await</span> <span class="nx">download</span><span class="p">(</span><span class="nx">msg</span><span class="p">);</span>
    <span class="p">});</span>

    <span class="k">async</span> <span class="kd">function</span> <span class="nx">download</span><span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// execute the real download</span>
        <span class="kd">const</span> <span class="p">{</span><span class="nx">data</span><span class="p">}</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">message</span><span class="p">.</span><span class="nx">downloadFile</span><span class="p">();</span>
        
        <span class="c1">// convert arrayBuffer to Blob</span>
        <span class="kd">const</span> <span class="nx">blob</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Blob</span><span class="p">([</span><span class="nx">data</span><span class="p">]);</span>
        
        <span class="c1">// obtain the filename </span>
        <span class="kd">const</span> <span class="nx">path</span> <span class="o">=</span> <span class="nx">message</span><span class="p">.</span><span class="nx">relativePath</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="dl">'</span><span class="s1">/</span><span class="dl">'</span><span class="p">);</span>
        <span class="kd">const</span> <span class="nx">filename</span> <span class="o">=</span> <span class="nx">path</span><span class="p">[</span><span class="nx">path</span><span class="p">.</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">];</span>
        
        <span class="c1">// create a temporary element that references the downloaded data</span>
        <span class="kd">let</span> <span class="nx">link</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="dl">'</span><span class="s1">hiddenDownloadElement</span><span class="dl">'</span><span class="p">);</span>
        <span class="nx">link</span><span class="p">.</span><span class="nx">href</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">URL</span><span class="p">.</span><span class="nx">createObjectURL</span><span class="p">(</span><span class="nx">blob</span><span class="p">);</span>
        <span class="nx">link</span><span class="p">.</span><span class="nx">download</span> <span class="o">=</span> <span class="nx">filename</span><span class="p">;</span>
        
        <span class="c1">// downloads the data as a file</span>
        <span class="nx">link</span><span class="p">.</span><span class="nx">click</span><span class="p">();</span>
        
        <span class="c1">// remove the temporary element</span>
        <span class="nb">window</span><span class="p">.</span><span class="nx">URL</span><span class="p">.</span><span class="nx">revokeObjectURL</span><span class="p">(</span><span class="nx">blob</span><span class="p">);</span>
        <span class="nx">link</span><span class="p">.</span><span class="nx">remove</span><span class="p">();</span>
    <span class="p">}</span>
</code></pre></div></div>

<hr />

<h2 id="advanced-topics">Advanced Topics</h2>

<h3 id="background-process-errors">Background Process Errors</h3>

<p>There are many active processes running under the hood of the SDK, sometimes these will encounter an error scenario.
They will do their best to recover, but it is advised that applications watch and log the error event. To do this,
simply add an event watcher to the connection and log the error as you would any other error in the application.
If you get any unexpected errors that you can't resolve on your own, please reach out to a LivePerson team member
for assistance.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
<span class="p">});</span>
</code></pre></div></div>

<hr />

<h3 id="multiple-consumer-conversation-handling">Multiple consumer conversation handling</h3>

<p>To allow a consumer to have multiple open conversations with a brand, specific configurations are required on the LivePerson account. Ensure that the appropriate feature flags are enabled — contact your LivePerson representative for assistance.</p>

<p>Additionally, you must provide <code class="language-html highlighter-rouge">clientProperties</code> with the <code class="language-html highlighter-rouge">THREADS</code> feature enabled when creating the connection.</p>

<p>To start a threaded conversation, provide a <code class="language-html highlighter-rouge">thread</code> argument to the <code class="language-html highlighter-rouge">createConversation</code> method. If you provide <code class="language-html highlighter-rouge">"-1"</code> as the argument, UMS will automatically generate a thread ID for you. Otherwise, you must provide a unique ID of your own.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">clientProperties</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createClientProperties</span><span class="p">({</span>
    <span class="na">features</span><span class="p">:</span> <span class="p">[</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">Features</span><span class="p">.</span><span class="nx">THREADS</span><span class="p">]</span>
<span class="p">});</span>

<span class="kd">const</span> <span class="nx">consumerConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">12345678</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
    <span class="nx">clientProperties</span>
<span class="p">});</span>

<span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

<span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">({</span> <span class="na">thread</span><span class="p">:</span> <span class="dl">"</span><span class="s2">-1</span><span class="dl">"</span> <span class="p">});</span>
</code></pre></div></div>

<hr />

<h3 id="arbitrary-websocket-requests">Arbitrary websocket requests</h3>

<p>Our goal in making this SDK is to support all Message Platform requests through nicely designed interfaces.
However, there may be some requests or edge cases for existing requests that the SDK does not yet support.
If there is a type of request that you want to execute for which the SDK does not yet officially support, you can send the request directly using the <code class="language-html highlighter-rouge">send</code> function.</p>

<p>The <code class="language-html highlighter-rouge">send</code> function is async and will wait for the response back before completing. For example, to send a plain text message, instead of using <code class="language-html highlighter-rouge">sendMessage</code> you can use the following code:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">request</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">.ams.ms.PublishEvent</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">body</span><span class="p">:</span> <span class="p">{</span>
        <span class="na">dialogId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">MY_DIALOG_ID</span><span class="dl">'</span><span class="p">,</span>
        <span class="na">event</span><span class="p">:</span> <span class="p">{</span>
            <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">ContentEvent</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">contentType</span><span class="p">:</span> <span class="dl">'</span><span class="s1">text/plain</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">message</span><span class="p">:</span> <span class="dl">'</span><span class="s1">hello world!</span><span class="dl">'</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="kd">const</span> <span class="nx">response</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">request</span><span class="p">);</span>
</code></pre></div></div>

<hr />

<h3 id="notification-events">Notification Events</h3>

<p>There are three different kinds of messages used in communicating with Messaging Platform: Request, Response, and Notification. For the most part, when using the SDK your application does not need to consider these, but we want to provide the information just in case it is useful.</p>

<p>In general, when you use the SDK to issue a command, it sends a Request to the server, the request is processed and
the server returns a Response which then triggers the awaited promise to resolve. So, Response messages are only ever
received in response to a Request.</p>

<p>The third type of websocket message is a notification, these are the server's method of communicating with
clients asynchronously, without a request originating from the client. They are the main reason that websockets are required, otherwise we could do all communications simply using http.</p>

<p>Notifications are automatically processed by the SDK and may result in one of the events mentioned above.
However, some applications might wish to examine notifications directly.
In order to do this, watch the <code class="language-html highlighter-rouge">notification</code> event on a connection.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">notification</span><span class="dl">'</span><span class="p">,</span> <span class="nx">notification</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`notification received of type </span><span class="p">${</span><span class="nx">notification</span><span class="p">.</span><span class="nx">type</span><span class="p">}</span><span class="s2">\n</span><span class="p">${</span><span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">notification</span><span class="p">.</span><span class="nx">body</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="mi">2</span><span class="p">)}</span><span class="s2">`</span><span class="p">);</span>
<span class="p">})</span>
</code></pre></div></div>

<hr />

<h3 id="notification-types">Notification Types</h3>

<p>There are three types of Notifications that Messaging Platform can send, each of which has different conditions that must 
be met in order to receive them. Some of them involve the creation of a subscription telling Messaging Platform which 
types of notifications the application wants to receive.</p>

<h4 id="message-event-notification">Message Event Notification</h4>

<p>A message event notification is sent whenever a publishEvent request is successfully processed by the Messaging Platform.
There are various types of message events: plain or rich message text from a participant, the status of a participant 
(typing, away, etc.), a file sharing event, etc. To receive messages events for a conversation, an agent simply needs to 
be a participant in the conversation. This is accomplished by joining a conversation or accepting a ring.</p>

<p>Consumer connections, on the other hand, must create a subscription for the conversation before they will receive these
notifications. <strong>The SDK creates and maintains these subscriptions automatically</strong>, there is no need to create them
manually.</p>

<h4 id="conversation-state-notification">Conversation State Notification</h4>

<p>Conversation state notifications contain information about a conversation's state (whether it is open or closed, or which 
users are participants, etc.)</p>

<p>To receive conversation state notifications, a conversation subscription is required whose query encompasses that
conversation. <strong>The SDK creates and maintains these subscriptions automatically</strong>, there is usually no need to
<a href="#creating-manual-subscriptions">create them manually</a>, unless you want to see closed conversations on a brand connection, which does not apply to
most users.</p>

<h4 id="routing-notification">Routing Notification</h4>

<p>A routing task event, aka a Ring, indicating that routing has chosen the current user to handle a conversation.
To receive routing task events, a routing task subscription is required. These must be manually created, for more 
information see <a href="#agent-routing-tasks-aka-rings">Agent Routing Tasks</a>.</p>

<h3 id="notification-order">Notification order</h3>

<p>The SDK processes notifications in order on a best-effort basis. However, different types of notifications may sometimes 
arrive out of order. For example, a <code class="language-html highlighter-rouge">ContentEvent</code> may be received before the corresponding conversation state 
notification that announces a new conversation. While such sequence errors are rare, they can occur. To maintain proper 
order, the SDK implements the following mechanisms:</p>

<ul>
  <li><strong>Delayed Processing:</strong> If a content event arrives before its corresponding conversation state update, the SDK waits 
for one second to allow the conversation to arrive. If it doesn’t, the SDK attempts to fetch the conversation via 
an API call. An error is emitted if both strategies fail.</li>
  <li><strong>Handling Missing Conversations:</strong> If a message event is received before the conversation state update and the 
conversation cannot be fetched from the API, an error (<code class="language-html highlighter-rouge">conversation not found in cache</code>) is emitted. This error 
includes the raw <code class="language-html highlighter-rouge">event</code> data, which can still be processed. See <a href="#error-handling">Error Handling</a> for details.</li>
  <li><strong>Unknown Participant Handling:</strong> If a chat state event references a participant unknown to the SDK, the SDK emits a 
warning if the participant was previously removed and does not process the event. Otherwise, it waits one second for a 
possible conversation update. If the participant remains unknown after this, an error is emitted.</li>
  <li><strong>Coordinated Event Processing:</strong> The SDK prevents duplicate conversation processing by coordinating events triggered 
either by a <code class="language-html highlighter-rouge">conversation</code> event or when a <code class="language-html highlighter-rouge">ring</code> is accepted. This ensures each conversation is processed only once. 
For details, see <a href="#combined-conversation-handling">Combined Conversation Handling</a>.</li>
</ul>

<h3 id="subscriptions">Subscriptions</h3>

<h4 id="the-default-subscription">The default subscription</h4>

<p>By default, after connecting the SDK will automatically create a single subscription per connection.
This subscription is available on the connection object, if you want to log all notifications that subscription
receives you can do so with this code:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">connection</span><span class="p">.</span><span class="nx">defaultSubscription</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">notification</span><span class="dl">'</span><span class="p">,</span> <span class="nx">notification</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">notification</span><span class="p">));</span>
<span class="p">});</span>
</code></pre></div></div>

<p>Each type of connection has a different default query that is used to create its default subscription:</p>

<ul>
  <li>Brand connections use this query: <code class="language-html highlighter-rouge">{stage:["OPEN"]}</code></li>
  <li>Consumer connections use this query: <code class="language-html highlighter-rouge">{stage:["OPEN", "CLOSE"]}</code></li>
</ul>

<p>You can also provide a different query that will be used to create the default subscription, for example if you want
your bot to only monitor conversations with an open main dialog, you would create your connection like this:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">authData</span><span class="p">,</span>
    <span class="na">defaultSubscriptionQuery</span><span class="p">:</span> <span class="p">{</span><span class="na">state</span><span class="p">:[</span><span class="dl">"</span><span class="s2">OPEN</span><span class="dl">"</span><span class="p">],</span> <span class="na">dialogTypes</span><span class="p">:[</span><span class="dl">"</span><span class="s2">MAIN</span><span class="dl">"</span><span class="p">]}</span>
<span class="p">});</span>
</code></pre></div></div>

<p><a href="#query-properties">Other possible query properties.</a></p>

<p>If you don't want the SDK to create the default subscription, you can disable it by passing
createDefaultSubscription as false when creating the connection:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">authData</span><span class="p">,</span>
    <span class="na">createDefaultSubscription</span><span class="p">:</span> <span class="kc">false</span>
<span class="p">});</span>
</code></pre></div></div>
<p>Note that <code class="language-html highlighter-rouge">skillId</code> is not supported in the subscription query.</p>

<h4 id="creating-manual-subscriptions">Creating manual subscriptions</h4>

<p>In the event that you want to create a conversation subscription manually, use the "createConversationSubscription"
function. Please note that conversation objects are shared between subscriptions, in the sense that the SDK will use
any notifications from all active subscriptions to update conversation objects.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">query</span> <span class="o">=</span> <span class="p">{</span><span class="na">stage</span><span class="p">:[</span><span class="dl">"</span><span class="s2">OPEN</span><span class="dl">"</span><span class="p">],</span> <span class="na">agentId</span><span class="p">:[</span><span class="dl">'</span><span class="s1">12345.123456</span><span class="dl">'</span><span class="p">]};</span>
<span class="kd">const</span> <span class="nx">waitForReady</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
<span class="kd">const</span> <span class="nx">sub</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversationSubscription</span><span class="p">({</span><span class="nx">query</span><span class="p">,</span> <span class="nx">waitForReady</span><span class="p">});</span>
</code></pre></div></div>

<p><code class="language-html highlighter-rouge">waitForReady</code> can be used to wait for conversations to be loaded once the connection is opened. False by default.</p>

<div style="background-color: #f8d7da; color: #721c24; padding: 10px; border-radius: 5px; border: 1px solid #f5c6cb;">
  <strong>Notice:</strong> If <strong>agentId</strong> is not provided - the bots will try to subscribe to all open conversation for the given account.
</div>
<p><br /></p>

<h4 id="query-properties">Query properties</h4>

<p>Following properties can be used to filter for conversations in your query.</p>

<table>
  <thead>
    <tr>
      <th>Property</th>
      <th>Type and example</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>query.accountId</td>
      <td><code class="language-html highlighter-rouge">string</code>: <code class="language-html highlighter-rouge">"3949245"</code></td>
      <td>The account id.</td>
    </tr>
    <tr>
      <td>query.agentId</td>
      <td><code class="language-html highlighter-rouge">Array<span class="nt">&lt;string&gt;</span></code>: <code class="language-html highlighter-rouge">["3949245.agentId1", "3949245.agentId2"]</code></td>
      <td>Filters for events of conversations for these agent ids. The id is preceded by the account id.</td>
    </tr>
    <tr>
      <td>query.consumerId</td>
      <td><code class="language-html highlighter-rouge">string</code>: <code class="language-html highlighter-rouge">consumerId123</code></td>
      <td>Filters for events of conversations for this consumer.</td>
    </tr>
    <tr>
      <td>query.conversationId</td>
      <td><code class="language-html highlighter-rouge">string</code>: <code class="language-html highlighter-rouge">59999610-d812-4j76-907f-9905as579e5a</code></td>
      <td>Filters for events for a specific conversation.</td>
    </tr>
    <tr>
      <td>query.state</td>
      <td><code class="language-html highlighter-rouge">Array<span class="nt">&lt;string&gt;</span></code>: <code class="language-html highlighter-rouge">["OPEN", "CLOSE"]</code></td>
      <td>Filters for conversations with a MAIN dialog in given state. Possible values: <code class="language-html highlighter-rouge">OPEN</code>, <code class="language-html highlighter-rouge">CLOSE</code>, <code class="language-html highlighter-rouge">LOCKED</code>, <code class="language-html highlighter-rouge">CLOSING</code></td>
    </tr>
    <tr>
      <td>query.stage</td>
      <td><code class="language-html highlighter-rouge">Array<span class="nt">&lt;string&gt;</span></code>: <code class="language-html highlighter-rouge">["OPEN", "CLOSE"]</code></td>
      <td>Filters for conversations being in given stage. Possible values: <code class="language-html highlighter-rouge">OPEN</code>, <code class="language-html highlighter-rouge">CLOSE</code>, <code class="language-html highlighter-rouge">LOCKED</code>, <code class="language-html highlighter-rouge">CLOSING</code></td>
    </tr>
    <tr>
      <td>query.dialogType</td>
      <td><code class="language-html highlighter-rouge">Array<span class="nt">&lt;string&gt;</span></code>: <code class="language-html highlighter-rouge">["MAIN"]</code></td>
      <td>Filters conversation events related to given dialog type. Possible values: <code class="language-html highlighter-rouge">MAIN</code>, <code class="language-html highlighter-rouge">AGENTS</code>, <code class="language-html highlighter-rouge">OTHER</code>, <code class="language-html highlighter-rouge">POST_SURVEY</code>, <code class="language-html highlighter-rouge">PRE_CONVERSATION_OPT_IN</code></td>
    </tr>
    <tr>
      <td>query.lastUpdateBefore</td>
      <td><code class="language-html highlighter-rouge">number</code>: <code class="language-html highlighter-rouge">1715613775114</code></td>
      <td>Filters for conversations which were updated before given timestamp.</td>
    </tr>
    <tr>
      <td>query.lastUpdateAfter</td>
      <td><code class="language-html highlighter-rouge">number</code>: <code class="language-html highlighter-rouge">1715613775114</code></td>
      <td>Filters for conversations which were updated after given timestamp.</td>
    </tr>
  </tbody>
</table>

<p><code class="language-html highlighter-rouge">query</code> is a nested object within the connection object. For example:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
    </span><span class="nl">"waitForReady"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
    </span><span class="nl">"query"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
        </span><span class="nl">"dialogType"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"MAIN"</span><span class="p">],</span><span class="w"> 
        </span><span class="nl">"agentId"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"1245.1122"</span><span class="p">]</span><span class="w">
    </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<hr />

<h3 id="connection-maintenance">Connection Maintenance</h3>

<p>Communication with Messaging Platform happens primarily over a websocket, the SDK takes responsibility for maintaining this
connection and in the event of a connection loss it will attempt to reconnect.
The SDK will do this by default, no additional configuration or intervention is required.</p>

<p>While disconnected, any requests will be queued up and will execute when the connection is re-established.
The SDK will also attempt to recreate any subscriptions, including the default subscription.</p>

<p>If the auth token has become invalid during the time in which the connection was down, the SDK will attempt to
generate a new one based on the <a href="#brand-auth-token-process">Auth Token Process</a>.</p>

<p>Sometimes there could be issues with conversations being lost or stuck after reconnection. If you encounter this, set <code class="language-html highlighter-rouge">unsubscribeFromOutdatedConversationsOnReconnect</code>
flag to <code class="language-html highlighter-rouge">false</code> when you create the connection.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">authData</span><span class="p">,</span>
    <span class="na">unsubscribeFromOutdatedConversationsOnReconnect</span><span class="p">:</span> <span class="kc">false</span>
<span class="p">});</span>
</code></pre></div></div>

<h4 id="automatically-mark-bot-as-offline-upon-disconnect">Automatically mark bot as offline upon disconnect</h4>

<p>By default, when a bot disconnects, the corresponding agent user stays online. To set the agent user to offline when the bot disconnects, set <code class="language-html highlighter-rouge">setAgentOfflineOnDisconnect</code> flag to true when you create the connection.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">authData</span><span class="p">,</span>
    <span class="na">setAgentOfflineOnDisconnect</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">});</span>
</code></pre></div></div>
<hr />

<h3 id="brand-authentication">Brand Authentication</h3>

<h4 id="different-authentication-mechanisms">Different authentication mechanisms</h4>

<p>The SDK supports several authenticating mechanisms depending on the credentials provided using <code class="language-html highlighter-rouge">authData</code>. For oAuth1, 
<code class="language-html highlighter-rouge">authData</code> is expected to have the following format:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">authData</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">username</span><span class="p">:</span> <span class="dl">'</span><span class="s1">botName123</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">appKey</span><span class="p">:</span> <span class="dl">'</span><span class="s1">appKey</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">secret</span><span class="p">:</span> <span class="dl">'</span><span class="s1">secret</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accessToken</span><span class="p">:</span> <span class="dl">'</span><span class="s1">accessToken</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accessTokenSecret</span><span class="p">:</span> <span class="dl">'</span><span class="s1">accessTokenSecret</span><span class="dl">'</span>
<span class="p">}</span>
</code></pre></div></div>

<p>If you have oAuth2 credentials, you can either use oAuth2 over oAuth1 or just oAuth2. For oAuth2 over oAuth1, the
<code class="language-html highlighter-rouge">authData</code> looks as follows:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">authData</span> <span class="o">=</span> <span class="p">{</span>
  <span class="dl">"</span><span class="s2">username</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">username</span><span class="dl">"</span><span class="p">,</span>
  <span class="dl">"</span><span class="s2">appKey</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">6YxG183r123456</span><span class="dl">"</span><span class="p">,</span>
  <span class="dl">"</span><span class="s2">secret</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">zQ1wIzypH123456</span><span class="dl">"</span><span class="p">,</span>
  <span class="dl">"</span><span class="s2">accessToken</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">hint</span><span class="dl">"</span><span class="p">,</span>
  <span class="dl">"</span><span class="s2">accessTokenSecret</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">hint</span><span class="dl">"</span>
<span class="p">}</span>
</code></pre></div></div>

<p>The credentials themselves are provided through the <code class="language-html highlighter-rouge">authData</code> property in the same way as oAuth1 credentials. The 
difference being that the values for <code class="language-html highlighter-rouge">accessToken</code> and <code class="language-html highlighter-rouge">accessTokenSecret</code> <strong>MUST</strong> be <code class="language-html highlighter-rouge">"hint"</code> since they don't exist
for oAuth2. For just oAuth2, the <code class="language-html highlighter-rouge">authData</code> looks as follows:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">authData</span> <span class="o">=</span> <span class="p">{</span>
  <span class="dl">"</span><span class="s2">oauth2</span><span class="dl">"</span><span class="p">:</span> <span class="p">{</span>
    <span class="dl">"</span><span class="s2">username</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">username</span><span class="dl">"</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">client_id</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">6YxG183r123456</span><span class="dl">"</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">client_secret</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">zQ1wIzypH123456</span><span class="dl">"</span>
  <span class="p">}</span>
<span class="p">}</span>
</code></pre></div></div>

<p>If you provide oAuth1 and oAuth2 credentials, the oAuth2 credentials takes precedence. If you use oAuth2, authentication 
with <a href="#brand-authentication-with-existing-bearer-token">existing bearer token</a> is not supported and will result in an 
<code class="language-html highlighter-rouge">error</code> emit. If you want to use oAuth2 with an existing bearer token please use oAuth2 over oAuth1.</p>

<h4 id="brand-authentication-token-process">Brand Authentication Token Process</h4>

<p>For brand connections, the SDK will use the provided <code class="language-html highlighter-rouge">authData</code> to create a bearer token by making a request to an internal 
service called <code class="language-html highlighter-rouge">agentVep</code>. This token is used to authenticate with the Messaging Platform when making a websocket connection 
or a rest api request. To guarantee a valid token for every request, there are different mechanisms in place for oAuth1 
and oAuth2.</p>

<p>For oAuth1, a refresh request must be made once in every ten minutes back to <code class="language-html highlighter-rouge">agentVep</code> so that the token stays valid. 
The SDK requests a refresh every four minutes by default. For oAuth2, a token expires after 60 minutes and cannot be 
refreshed. The SDK requests a new oAuth2 token every 30 minutes and stores it internally.</p>

<p>If a token becomes invalid for any reason, the SDK will automatically attempt to create a new one. In general, any
websockets established will not lose connection if their token becomes invalid, so there is no risk of service
interruption, but the new token will be required before any new http requests can be made.</p>

<p>If an application creates another token for the same user, the first token will become invalid. So it is therefore
important that applications do not create two connections with the same authData, this will cause them to
continually generate new tokens and put a strain on LivePerson's services. To share the same authentication information 
across multiple connections, please refer to <a href="#brand-authentication-using-tokenmaintainer">Brand Authentication using TokenMaintainer</a>.</p>

<p>If an application needs to use a connection's token to make http requests to other LivePerson services that are not
supported directly by the SDK, you can access the bearer token with the following method after the <code class="language-html highlighter-rouge">connect()</code>
finishes: <code class="language-html highlighter-rouge">await connection.getToken()</code></p>

<hr />

<h4 id="brand-authentication-with-existing-bearer-token">Brand Authentication with existing bearer token</h4>

<div style="background-color: #f8d7da; color: #721c24; padding: 10px; border-radius: 5px; border: 1px solid #f5c6cb;">
  <strong>Notice:</strong> This mechanism only works with oAuth1 or oAuth2 over oAuth1 authentication. If you have oAuth2 
  credentials or session information from an oAuth2 connection, this authentication mechanism is not supported.
</div>
<p><br /></p>

<p>If you are already authenticated with agentVep and have a token at hand, you can use it with the SDK to establish an
authenticated brand connection. Add your bearer token to <code class="language-html highlighter-rouge">authAgentSessionData</code> when setting up a  connection. If you
provide both the <code class="language-html highlighter-rouge">authAgentSessionData</code> and <code class="language-html highlighter-rouge">authData</code> an error is thrown. The format looks as follows:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">authAgentSessionData</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">token</span><span class="p">:</span> <span class="dl">'</span><span class="s1">your-bearer-token</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">userPid</span><span class="p">:</span> <span class="dl">'</span><span class="s1">uuid-of-the-user</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">csrf</span><span class="p">:</span> <span class="dl">'</span><span class="s1">csrf-key</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">sessionId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">session-id</span><span class="dl">'</span>
<span class="p">}</span>
</code></pre></div></div>
<p>Once this is set, the SDK will utilize the provided token for any subsequent brand requests. Token refresh will be managed
automatically by the SDK. Here's an example of how to set up the connection when using <code class="language-html highlighter-rouge">authAgentSessionData</code>:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">authAgentSessionData</span><span class="p">,</span>
<span class="p">});</span>
</code></pre></div></div>

<p>This ensures proper usage of the <code class="language-html highlighter-rouge">authAgentSessionData</code> parameter and avoid errors when establishing connections.</p>

<hr />

<h4 id="brand-authentication-using-tokenmaintainer">Brand Authentication using TokenMaintainer</h4>

<p>To share the same authentication information across multiple connections, pass the same <code class="language-html highlighter-rouge">TokenMaintainer</code> instance to
each connection. The <code class="language-html highlighter-rouge">TokenMaintainer</code> handles token refreshes.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">accountId</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">1234</span><span class="dl">'</span><span class="p">;</span>   
<span class="kd">const</span> <span class="nx">authData</span> <span class="o">=</span> <span class="p">{</span> <span class="c1">// This can also be oAuth2 credentials</span>
    <span class="na">username</span><span class="p">:</span> <span class="dl">"</span><span class="s2">username</span><span class="dl">"</span><span class="p">,</span>
    <span class="na">appKey</span><span class="p">:</span> <span class="dl">"</span><span class="s2">app-key</span><span class="dl">"</span><span class="p">,</span>
    <span class="na">secret</span><span class="p">:</span> <span class="dl">"</span><span class="s2">secret</span><span class="dl">"</span><span class="p">,</span>
    <span class="na">accessToken</span><span class="p">:</span> <span class="dl">"</span><span class="s2">accessToken</span><span class="dl">"</span><span class="p">,</span>
    <span class="na">accessTokenSecret</span><span class="p">:</span> <span class="dl">"</span><span class="s2">accessTokenSecret</span><span class="dl">"</span><span class="p">,</span>
<span class="p">};</span>

<span class="kd">const</span> <span class="nx">tokenMaintainer</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">TokenMaintainer</span><span class="p">({</span><span class="nx">accountId</span><span class="p">,</span> <span class="nx">authData</span><span class="p">});</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">sharedAuthentication</span><span class="dl">'</span><span class="p">,</span>
    <span class="nx">application</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">tokenMaintainer</span>
<span class="p">});</span>

<span class="kd">const</span> <span class="nx">connection2</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">sharedAuthentication2</span><span class="dl">'</span><span class="p">,</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">tokenMaintainer</span>
<span class="p">});</span>

<span class="kd">const</span> <span class="nx">connection3</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">sharedAuthentication3</span><span class="dl">'</span><span class="p">,</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">tokenMaintainer</span>
<span class="p">});</span>

<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
<span class="k">await</span> <span class="nx">connection2</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
<span class="k">await</span> <span class="nx">connection3</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
</code></pre></div></div>

<p>The <code class="language-html highlighter-rouge">TokenMaintainer</code> provides several events you can listen to:</p>

<ul>
  <li>The <code class="language-html highlighter-rouge">error</code> event is triggered whenever an error occurs during refresh.</li>
  <li>The <code class="language-html highlighter-rouge">token-invalid</code> event is triggered when the token becomes invalid.</li>
  <li>The <code class="language-html highlighter-rouge">refresh-token</code> event is triggered when the token is refreshed.</li>
  <li>The <code class="language-html highlighter-rouge">token-regenerated</code> event is triggered when the token is successfully regenerated.</li>
</ul>

<p>To monitor the requests and responses between the server and the SDK, listen to the <code class="language-html highlighter-rouge">getAgentToken#request</code> and
<code class="language-html highlighter-rouge">getAgentToken#response</code> events. These events are emitted on all connections sharing the same token maintainer.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">tokenMaintainer</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">token-invalid</span><span class="dl">'</span><span class="p">,</span> <span class="nx">source</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">refresh-token</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">token-regenerated</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">getAgentToken#request</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">getAgentToken#response</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...});</span>

<span class="nx">connection</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">token-invalid</span><span class="dl">'</span><span class="p">,</span> <span class="nx">source</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">refresh-token</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">token-regenerated</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">getAgentToken#request</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">getAgentToken#response</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...});</span>

<span class="nx">connection2</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">token-invalid</span><span class="dl">'</span><span class="p">,</span> <span class="nx">source</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">refresh-token</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">token-regenerated</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">getAgentToken#request</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">getAgentToken#response</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...});</span>

<span class="nx">connection3</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">token-invalid</span><span class="dl">'</span><span class="p">,</span> <span class="nx">source</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">refresh-token</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">token-regenerated</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">getAgentToken#request</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...})</span>
    <span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">getAgentToken#response</span><span class="dl">'</span><span class="p">,</span> <span class="nx">info</span> <span class="o">=&gt;</span> <span class="p">{...});</span>
</code></pre></div></div>
<hr />

<h3 id="continuing-an-anonymous-user-session-between-two-connections">Continuing an anonymous user session between two connections</h3>

<p>It is common for users of a web application to refresh their browser, or to close their browser and return to the site at a later time.
In these situations, the expectation is that the user resumes the same conversation.
However, from an application stand point, there is no way to preserve objects between page refreshes, much less between separate browser processes.</p>

<p>Instead, the solution is to save the JWT generated by the initial connection and give it to the subsequent connections. They can then use this JWT to connect, rather than generate their own new JWTs.
This will cause the Messaging Platform to recognize them as the same consumer, and give them access to the existing conversations for that consumer.</p>

<ol>
  <li>Once the initial connection is open, get the jwt by calling <code class="language-html highlighter-rouge">await connection.getToken()</code></li>
  <li>Store that token in local storage or a cookie</li>
  <li>Pass the token back in to <code class="language-html highlighter-rouge">createConnection</code> as <code class="language-html highlighter-rouge">token</code></li>
</ol>

<p>Any existing conversations will automatically be loaded up into the SDK and emitted as a <code class="language-html highlighter-rouge">conversation</code> event.
They will also be available through <code class="language-html highlighter-rouge">connection._conversations</code> which is a <code class="language-html highlighter-rouge">Map</code>.
To ensure that that conversation is loaded by the time <code class="language-html highlighter-rouge">await connection.open()</code> is resolved, you can pass <code class="language-html highlighter-rouge">waitForReady: true</code> to <code class="language-html highlighter-rouge">createConnection</code>.
This will cause <code class="language-html highlighter-rouge">open</code> to only resolve once all conversations have been retrieved.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// open the initial connection</span>
<span class="kd">const</span> <span class="nx">connection1</span> <span class="o">=</span> <span class="nx">Connection</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">123456789</span><span class="dl">'</span>
<span class="p">});</span>
<span class="k">await</span> <span class="nx">connection1</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

<span class="c1">// get and store the token</span>
<span class="kd">const</span> <span class="nx">token</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection1</span><span class="p">.</span><span class="nx">getToken</span><span class="p">();</span>

<span class="c1">// create a conv so we can resume it in the 2nd connection</span>
<span class="kd">const</span> <span class="nx">conversation1</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">();</span>
<span class="k">await</span> <span class="nx">conversation1</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">hello</span><span class="dl">"</span><span class="p">);</span>

<span class="c1">// close connection</span>
<span class="k">await</span> <span class="nx">connection1</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>

<span class="c1">// open a second connection using the same token</span>
<span class="kd">const</span> <span class="nx">connection2</span> <span class="o">=</span> <span class="nx">Connection</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">123456789</span><span class="dl">'</span><span class="p">,</span>
    <span class="nx">token</span><span class="p">,</span>
    <span class="na">waitForReady</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">});</span>
<span class="k">await</span> <span class="nx">connection2</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

<span class="c1">// retrieve the conversation and close it</span>
<span class="kd">const</span> <span class="nx">conversation2</span> <span class="o">=</span> <span class="nb">Array</span><span class="p">.</span><span class="k">from</span><span class="p">(</span><span class="nx">connection2</span><span class="p">.</span><span class="nx">_conversations</span><span class="p">.</span><span class="nx">values</span><span class="p">())[</span><span class="mi">0</span><span class="p">];</span>
<span class="k">await</span> <span class="nx">conversation2</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>

<span class="c1">// close connection</span>
<span class="k">await</span> <span class="nx">connection2</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
</code></pre></div></div>

<hr />

<h3 id="client-properties">Client Properties</h3>

<p>ClientProperties is an object that contains information about the client that a consumer uses to connect to Messaging Platform.
This includes not only device and browser information, but also information about the specific messaging features
supported by the particular UI client they are connected through.</p>

<p>Example:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">clientProperties</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createClientProperties</span><span class="p">({</span>
    <span class="na">deviceFamily</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">DeviceFamily</span><span class="p">.</span><span class="nx">DESKTOP</span><span class="p">,</span>
    <span class="na">deviceManufacturer</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Apple</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">deviceModel</span><span class="p">:</span> <span class="dl">'</span><span class="s1">MacBook Pro</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">os</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">OS</span><span class="p">.</span><span class="nx">OSX</span><span class="p">,</span>
    <span class="na">osName</span><span class="p">:</span> <span class="dl">'</span><span class="s1">macOS</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">osVersion</span><span class="p">:</span> <span class="dl">'</span><span class="s1">11.6.8</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">ipAddress</span><span class="p">:</span> <span class="dl">'</span><span class="s1">127.0.0.1</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">browser</span><span class="p">:</span> <span class="dl">'</span><span class="s1">CHROME</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">browserVersion</span><span class="p">:</span> <span class="dl">'</span><span class="s1">47.0</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">timeZone</span><span class="p">:</span> <span class="dl">'</span><span class="s1">America/Los_Angeles</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">features</span><span class="p">:</span> <span class="p">[</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">Features</span><span class="p">.</span><span class="nx">AUTO_MESSAGES</span><span class="p">,</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">Features</span><span class="p">.</span><span class="nx">PHOTO_SHARING</span><span class="p">]</span>
<span class="p">});</span>

<span class="kd">const</span> <span class="nx">consumerConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">123456</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
    <span class="nx">clientProperties</span>
<span class="p">});</span>

<span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
</code></pre></div></div>

<hr />

<h3 id="conversation-context-and-campaign-info">Conversation Context and Campaign Info</h3>

<p>To create a conversation with a given context and or campaign, use the following syntax.
Keep in mind that client properties should be sent during connection creation.</p>

<!-- TODO: add other context types -->
<!-- TODO: show how to retrieve context as bot -->

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">context</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">type</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ConversationContextType</span><span class="p">.</span><span class="nx">SHARK</span><span class="p">,</span>
    <span class="na">lang</span><span class="p">:</span> <span class="dl">'</span><span class="s1">en-US</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">visitorId</span><span class="p">:</span> <span class="dl">''</span><span class="p">,</span>
    <span class="na">sessionId</span><span class="p">:</span> <span class="dl">''</span><span class="p">,</span>
    <span class="na">interactionContextId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">2</span><span class="dl">'</span>
<span class="p">};</span>

<span class="kd">const</span> <span class="nx">campaignInfo</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">campaignId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">111</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">engagementId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">222</span><span class="dl">'</span>
<span class="p">};</span>

<span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">({</span><span class="nx">context</span><span class="p">,</span> <span class="nx">campaignInfo</span><span class="p">});</span>
</code></pre></div></div>

<hr />

<h3 id="consumer-auth-flow">Consumer Auth Flow</h3>

<p>By default, consumer connections will be made in "anonymous" mode.
Some customers have set up <a href="consumer-authentication-introduction.html">Consumer Authentication</a> for their account.
To establish an authenticated consumer connection, your application must provide the <code class="language-html highlighter-rouge">useAuthenticatedConnection</code> parameter along with a JWT (JSON Web Token).
This combination of <code class="language-html highlighter-rouge">useAuthenticatedConnection</code> and JWT prompts the service to retrieve all connectors configured for the brand. Based on the issuer, it matches the connector ID to generate a token, facilitating authenticated consumer access.
Before establishing a connection, the brand must undertake an additional step to generate the token, which will be received via a callback. This token should then be added as a parameter to the createConnection function.
It's worth noting that the JWT generated by the brand's configured authentication service has an expiration time. Hence, the brand should supply a new token once the current one expires, if necessary.</p>

<p>Migration from the old structure to the new one includes deleting usage of those three methods: <code class="language-html highlighter-rouge">createJwtClaimsSet,createCustomerInfoSde, createPersonalInfoSde</code> and start using the corresponding example described here.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">appVersion</span><span class="p">:</span> <span class="dl">'</span><span class="s1">1.6.2</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">123456</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
    <span class="na">useAuthenticatedConnection</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
    <span class="na">jwt</span><span class="p">:</span> <span class="dl">'</span><span class="s1">eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c</span><span class="dl">'</span>
<span class="p">});</span>
</code></pre></div></div>

<p>Another type of consumer authentication is unauth connection. By providing <code class="language-html highlighter-rouge">useUnauthenticatedConnection</code> to the createConnection function the system will know to use
unauth connector if such is configured for the brand</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">appVersion</span><span class="p">:</span> <span class="dl">'</span><span class="s1">1.6.2</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">123456</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
    <span class="na">useUnauthenticatedConnection</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
<span class="p">});</span>
</code></pre></div></div>

<hr />

<h3 id="getting-a-user-profile">Getting a User Profile</h3>

<p>In order to retrieve authenticated consumer data or an agent's profile, call <code class="language-html highlighter-rouge">getUserProfile</code>, which is available on any conversation participant.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">consumerProfile</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">consumer</span><span class="p">.</span><span class="nx">getUserProfile</span><span class="p">();</span>
<span class="kd">const</span> <span class="nx">agentProfile</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">assignedAgent</span><span class="p">.</span><span class="nx">getUserProfile</span><span class="p">();</span>
</code></pre></div></div>

<p>Alternatively, you can access all of the participants of a dialog at <code class="language-html highlighter-rouge">conversation.openDialog.participants</code>. Note that consumers can only call getUserProfile on their own participant object; they cannot access agent or bot profiles.</p>

<p>When calling <code class="language-html highlighter-rouge">getUserProfile</code> on a participant, the <code class="language-html highlighter-rouge">conversationId</code> is automatically passed to the server, so the returned profile reflects the user profile snapshot scoped to that specific conversation (the profile state at the time the conversation was created). This is particularly useful when a consumer has multiple open conversations.</p>

<hr />

<h3 id="set-user-profile">Set User Profile</h3>

<p>To set a user profile outside of using the consumer auth flow, you can use <code class="language-html highlighter-rouge">setUserProfile</code>.
Most of these fields are optional, and it is very common to call this function with just <code class="language-html highlighter-rouge">firstName</code>, <code class="language-html highlighter-rouge">lastName</code>, and <code class="language-html highlighter-rouge">nickName</code> alone.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">data</span> <span class="o">=</span> <span class="p">{</span>
    <span class="dl">"</span><span class="s2">firstName</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">1</span><span class="dl">"</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">lastName</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">2</span><span class="dl">"</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">nickName</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">3</span><span class="dl">"</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">userId</span><span class="dl">"</span><span class="p">:</span> <span class="dl">""</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">avatarUrl</span><span class="dl">"</span><span class="p">:</span> <span class="dl">""</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">role</span><span class="dl">"</span><span class="p">:</span> <span class="dl">""</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">backgndImgUri</span><span class="dl">"</span><span class="p">:</span> <span class="dl">""</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">description</span><span class="dl">"</span><span class="p">:</span> <span class="dl">""</span><span class="p">,</span>
    <span class="dl">"</span><span class="s2">privateData</span><span class="dl">"</span><span class="p">:</span> <span class="p">{</span>
        <span class="dl">"</span><span class="s2">mobileNum</span><span class="dl">"</span><span class="p">:</span> <span class="dl">""</span><span class="p">,</span>
        <span class="dl">"</span><span class="s2">mail</span><span class="dl">"</span><span class="p">:</span> <span class="dl">""</span><span class="p">,</span>
        <span class="dl">"</span><span class="s2">pushNotificationData</span><span class="dl">"</span><span class="p">:</span> <span class="p">{</span>
            <span class="dl">"</span><span class="s2">serviceName</span><span class="dl">"</span><span class="p">:</span> <span class="dl">""</span><span class="p">,</span>
            <span class="dl">"</span><span class="s2">certName</span><span class="dl">"</span><span class="p">:</span> <span class="dl">""</span><span class="p">,</span>
            <span class="dl">"</span><span class="s2">token</span><span class="dl">"</span><span class="p">:</span> <span class="dl">""</span>
        <span class="p">}</span>
    <span class="p">},</span>
    <span class="dl">"</span><span class="s2">claims</span><span class="dl">"</span><span class="p">:</span> <span class="p">{</span>
        <span class="dl">"</span><span class="s2">lp_sdes</span><span class="dl">"</span><span class="p">:</span> <span class="p">[</span>
            <span class="nx">customerInfoSde</span><span class="p">,</span>
            <span class="nx">personalInfoSde</span>
        <span class="p">]</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">setUserProfile</span><span class="p">(</span><span class="nx">data</span><span class="p">);</span>
</code></pre></div></div>

<hr />

<h3 id="consumer-step-up">Consumer Step Up</h3>

<p>Consumer stepup is a process by which an unauthenticated consumer connection is "stepped up" to be an authenticated connection.
First, create an <strong>unauthenticated</strong> consumer connection by providing the configuration <code class="language-html highlighter-rouge">useUnauthenticatedConnection</code> to determine that we will use un auth connector and then opening the connection:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">appVersion</span><span class="p">:</span> <span class="dl">'</span><span class="s1">1.6.2</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">123456</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
    <span class="na">useUnauthenticatedConnection</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">});</span>
<span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
</code></pre></div></div>

<p>The consumer can create a conversation as usual. When the consumer logs in and you are ready to upgrade the connection to Messaging Platform, call the stepUp function, passing the jwt.
This will get an authenticated JWT, then disconnect and reconnect using the new JWT.
It will then issue a "takeover" command for any existing open conversation, so that the authenticated consumer takes ownership of the conversation, thereby completing the stepUp.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">stepUp</span><span class="p">(</span><span class="nx">jwt</span><span class="p">);</span>
</code></pre></div></div>
<hr />

<h3 id="message-statistics">Message statistics</h3>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code>
<span class="kd">const</span> <span class="nx">userData</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">getMessageStatisticsForUser</span><span class="p">();</span>
<span class="kd">const</span> <span class="nx">brandData</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">getMessageStatisticsForBrand</span><span class="p">();</span>

</code></pre></div></div>

<p>That is what getMessageStatisticsForUser/getMessageStatisticsForBrand data returns when you call it.</p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
    active: 0,
    pending: 0,
    unassigned: 0,
    overdue: 0,
    soonToOverdue: 0
}
</code></pre></div></div>
<hr />

<h3 id="using-proxies">Using proxies</h3>

<p>You can configure the SDK to redirect all requests to an HTTP proxy. Once you imported the messaging SDK, use the
<code class="language-html highlighter-rouge">configureProxy</code> method to pass your proxy configuration. To remove the proxy, call <code class="language-html highlighter-rouge">removeProxy</code>. When you configure the
proxy before establishing the connection, all requests are proxied. However, you can configure the proxy at any time you
want. The configuration structure looks as follows:</p>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
    host: string,
    port: number,
    protocol: string | undefined,
    path: string | undefined,
    auth: {
      username: string | number,
      password: string | number,
    } | undefined
}
</code></pre></div></div>

<p>The host can be a name or an address. The port refers to the proxy port. The protocol can either be https or http. It
defaults to http. The optional path is added to the URL. The optional <code class="language-html highlighter-rouge">auth</code> object carries the <code class="language-html highlighter-rouge">username</code> and <code class="language-html highlighter-rouge">password</code>
for HTTP basic authentication. Path and host should not end with a <code class="language-html highlighter-rouge">/</code>. Here is a usage example:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code>
<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">"</span><span class="s2">lp-messaging-sdk</span><span class="dl">"</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">proxy</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">host</span><span class="p">:</span> <span class="dl">'</span><span class="s1">yourHost.com</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">port</span><span class="p">:</span> <span class="mi">8080</span><span class="p">,</span>
    <span class="na">protocol</span><span class="p">:</span> <span class="dl">'</span><span class="s1">http</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">path</span><span class="p">:</span> <span class="dl">'</span><span class="s1">user/1</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">auth</span><span class="p">:</span> <span class="p">{</span>
      <span class="na">username</span><span class="p">:</span> <span class="dl">'</span><span class="s1">username</span><span class="dl">'</span><span class="p">,</span>
      <span class="na">password</span><span class="p">:</span> <span class="dl">'</span><span class="s1">password</span><span class="dl">'</span><span class="p">,</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="nx">lpm</span><span class="p">.</span><span class="nx">configureProxy</span><span class="p">(</span><span class="nx">proxy</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">12345678</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
<span class="p">});</span>
</code></pre></div></div>

<p>If you want to remove an existing proxy you can do that by calling <code class="language-html highlighter-rouge">removeProxy</code>;</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">"</span><span class="s2">lp-messaging-sdk</span><span class="dl">"</span><span class="p">);</span>

<span class="nx">lpm</span><span class="p">.</span><span class="nx">removeProxy</span><span class="p">();</span>

</code></pre></div></div>

<hr />

<h3 id="response-timeout">Response Timeout</h3>

<p>In order to provide you a way of manual configuration of what will be the response timeout instead of using the default one, we are providing <code class="language-html highlighter-rouge">responseTimeout</code> option for your application.
<code class="language-html highlighter-rouge">responseTimeout</code> should only contain digits <code class="language-html highlighter-rouge">0-9</code>.
The value should be in milliseconds.
<code class="language-html highlighter-rouge">responseTimeout</code> should be provided to the createConnection function.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">consumerConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">appVersion</span><span class="p">:</span> <span class="dl">'</span><span class="s1">1.12.2</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">123456</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">responseTimeout</span><span class="p">:</span> <span class="mi">10000</span>
<span class="p">});</span>
</code></pre></div></div>

<h3 id="combined-conversation-handling">Combined conversation handling</h3>

<p>Conversations can be accepted on the ring and/or being awaited on the connection. If you configure both options, it
can happen, that your code will process a conversation twice. To ensure that a conversation is processed once, 
coordination between the callbacks of the <code class="language-html highlighter-rouge">ring</code> and <code class="language-html highlighter-rouge">conversation</code> events is necessary. The SDK facilitates this by 
using a common callback for combined conversation handling. For example, when the 
<a href="#accepting-conversation-on-the-ring">conversation is accepted on the ring</a>, the callback will be triggered either when
the <code class="language-html highlighter-rouge">conversation</code> event was received on the connection or when the conversation could be resolved on the <code class="language-html highlighter-rouge">ring</code> event 
through <code class="language-html highlighter-rouge">ring.accept()</code>.</p>

<p>The callback can be configured using the <code class="language-html highlighter-rouge">combinedConversationHandling</code> option.</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">consumerConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
  <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
  <span class="na">appVersion</span><span class="p">:</span> <span class="dl">'</span><span class="s1">1.12.2</span><span class="dl">'</span><span class="p">,</span>
  <span class="na">accountId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">123456</span><span class="dl">'</span><span class="p">,</span>
  <span class="na">userType</span><span class="p">:</span> <span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
  <span class="na">combinedConversationHandling</span><span class="p">:</span> <span class="p">{</span>
    <span class="na">callback</span><span class="p">:</span> <span class="nx">brandImplementationFunctionToBeExecuted</span><span class="p">,</span>
    <span class="na">combinedConversationHandlingOptions</span><span class="p">:</span> <span class="p">{</span>
      <span class="na">max</span><span class="p">:</span> <span class="mi">10000</span><span class="p">,</span>
      <span class="na">ttl</span><span class="p">:</span> <span class="mi">1000</span> <span class="o">*</span> <span class="mi">60</span> <span class="o">*</span> <span class="mi">60</span> <span class="o">*</span> <span class="mi">24</span><span class="p">,</span>
    <span class="p">}</span>
  <span class="p">}</span>
<span class="p">});</span>

<span class="k">async</span> <span class="kd">function</span> <span class="nx">brandImplementationFunctionToBeExecuted</span><span class="p">(</span><span class="nx">conversation</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// Add code here</span>
<span class="p">}</span>
</code></pre></div></div>
<p><code class="language-html highlighter-rouge">combinedConversationHandling</code> contains the <code class="language-html highlighter-rouge">callback</code> and <code class="language-html highlighter-rouge">combinedConversationHandlingOptions</code>. <code class="language-html highlighter-rouge">callback</code> is the 
function that will be executed when the <code class="language-html highlighter-rouge">ring</code> is accepted or there is a <code class="language-html highlighter-rouge">conversation</code> event. It must take a <code class="language-html highlighter-rouge">conversation</code>
as parameter.<code class="language-html highlighter-rouge">combinedConversationHandlingOptions</code> contains the configuration options as documented for 
https://www.npmjs.com/package/lru-cache. At least one option of max, ttl, or maxSize is required. If there are no options, 
the configuration defaults to 10.000 conversations for 1 day. When a conversation is evicted, then the callback will be 
called again if a ring for the conversation is accepted and/or the conversation is not yet known to the application. 
Conversations, will be removed from the cache once they ended.</p>

<p>For a more elaborated example, look into third party bot with <a href="messaging-platform-sdk-examples.html#third-party-bot-with-callback-configured">combined conversation handling</a>.</p>

<hr />

<hr />

<h2 id="features-not-yet-supported">Features Not yet supported</h2>

<ul>
  <li>
    <p>Agent State Subscriptions</p>
  </li>
  <li>
    <p>Conversation/Dialog level metadata (Message Metadata is available)</p>
  </li>
  <li>
    <p>SendAPI</p>
  </li>
</ul>
]]></description>
      <!-- <pubDate>Tue, 02 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Examples</title>
      <link>https://developers.liveperson.com/messaging-platform-sdk-examples.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/messaging-platform-sdk-examples.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h1 id="messaging-platform-sdk-examples">Messaging Platform SDK Examples</h1>

<p>The following examples showcase how the Messaging Platform SDK can be used to establish a connection and conversations
with the Conversational Cloud. The examples are divided in Brand and Consumer. Brand connections allow you to create
authenticated connections with your account as an agent. These connections can be used to automate agent actions like
transferring a conversation or accepting a ring.</p>

<p>On the other hand, consumer connections allow unauthenticated connections for consumer actions. For example, creating
a conversation for a skill and sending messages. They are specific for one consumer and one conversation. Both connection
types require configuration, which you need to provide. Please have a look at the corresponding sections. The  example
code is also available on <a href="https://www.npmjs.com/package/lp-messaging-sdk?activeTab=code">npm</a> and will be pulled when
you install the package.</p>

<h2 id="table-of-contents">Table of Contents</h2>

<ul>
  <li><a href="#running">Running</a></li>
  <li><a href="#brand-examples">Brand Examples</a>
    <ul>
      <li><a href="#accept-any-waiting-ring">Accept any waiting ring</a></li>
      <li><a href="#close-all-open-conversations">Close all open conversations</a></li>
      <li><a href="#upload-file">Upload file</a></li>
      <li><a href="#get-last-consumer-message">Get last consumer message</a></li>
      <li><a href="#oauth1-oauth-2-and-oauth2-over-oauth1">OAuth1, OAuth 2 and OAuth2 over OAuth1</a></li>
      <li><a href="#share-authentication-between-instances">Share authentication between instances</a></li>
      <li><a href="#react-on-different-messages">React on different messages</a></li>
      <li><a href="#replay-all-messages-">Replay all messages</a></li>
      <li><a href="#transfer-to-agent">Transfer to agent</a></li>
      <li><a href="#transfer-to-skill">Transfer to skill</a></li>
      <li><a href="#respond-to-all-messages-on-restart-or-disconnect-with-a-downtime">Respond to all messages if there is a downtime or restart/reconnect</a></li>
      <li><a href="#third-party-bot">Third party bot</a></li>
      <li><a href="#third-party-bot-with-callback-configured">Third party bot with callback configured</a></li>
      <li><a href="#private-messages">Private messages</a></li>
      <li><a href="#rich-text">Rich text</a></li>
      <li><a href="#resume-conversation">Resume conversation</a></li>
    </ul>
  </li>
  <li><a href="#consumer-examples">Consumer Examples</a>
    <ul>
      <li><a href="#basic-conversation-example">Basic conversation example</a></li>
      <li><a href="#close-on-message">Close on Message</a></li>
      <li><a href="#continue-consumer-session">Continue consumer session</a></li>
      <li><a href="#conversation-for-skill">Conversation for skill</a></li>
      <li><a href="#conversation-for-language">Conversation for language</a></li>
      <li><a href="#multiple-conversations-with-threads">Multiple conversations with threads</a></li>
      <li><a href="#authenticated-connection">Authenticated connection</a></li>
    </ul>
  </li>
</ul>

<h2 id="running">Running</h2>

<p>Once you copied your example to a file and set up the configuration like explained in the corresponding sections, run 
the code by calling <code class="language-html highlighter-rouge">node <span class="nt">&lt;filename.js&gt;</span></code> where <code class="language-html highlighter-rouge"><span class="nt">&lt;filename.js&gt;</span></code> refers to the file of your example. For example, you 
copied the basic example to <code class="language-html highlighter-rouge">basic.js</code>, then your  directory should look similar to this:</p>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>.
├── basic.js
└── config.json
</code></pre></div></div>

<p>Run <code class="language-html highlighter-rouge">basic.js</code> by calling <code class="language-html highlighter-rouge">node basic.js</code>. Note that, for some brand examples, a consumer example should also be run,
in order to see conversational events.</p>

<h2 id="brand-examples">Brand Examples</h2>

<p>The following examples establish an authenticated brand connection. Before running, make sure that you have set up your 
<code class="language-html highlighter-rouge">config.json</code>. For all brand examples, we assume that there is only one agent/bot online. Otherwise, your bot user might
not receive rings. To run a brand example, copy the example to a separate file and add the <code class="language-html highlighter-rouge">config.json</code> in the 
same directory. The format looks as follows:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"accountId"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
  </span><span class="nl">"authData"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"username"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"appKey"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"secret"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"accessToken"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"accessTokenSecret"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"appId"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p>The parameters are the configurations for your bot user, your account id and the app id. The app id must contain at
least one alphanumeric character, a <code class="language-html highlighter-rouge">-</code>, <code class="language-html highlighter-rouge">.</code> or <code class="language-html highlighter-rouge">_</code>. For example, <code class="language-html highlighter-rouge">example-test_123</code> is a valid id while
<code class="language-html highlighter-rouge">example test 123</code> is not. For the skill transfer and agent transfer examples, you need an additional file
called <code class="language-html highlighter-rouge">specific-skill-config.json</code>. It has the same format and contains information about the target agent. If you run
any of those tests, make sure to create a second bot user on your account.</p>

<h3 id="accept-any-waiting-ring">Accept any waiting ring</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example uses the SDK to create a brand connection, register the agent as online and accept any ring in waiting state.
 * Then it publishes a welcome message.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="c1">// Define ring callback *before* opening the connection, to ensure no lost events</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">ring</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">ring</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">ring?</span><span class="dl">'</span><span class="p">);</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">ring</span><span class="p">.</span><span class="nx">ringState</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">RingState</span><span class="p">.</span><span class="nx">WAITING</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Ring is already in state </span><span class="p">${</span><span class="nx">ring</span><span class="p">.</span><span class="nx">ringState</span><span class="p">}</span><span class="s2">, ignoring`</span><span class="p">);</span>
        <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="k">await</span> <span class="nx">ring</span><span class="p">.</span><span class="nx">accept</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Ring accepted!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">});</span>

<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation received</span><span class="dl">'</span><span class="p">);</span>
    <span class="c1">// Emit message only when an assigned agent is added, which in our basic example emulates the bot itself</span>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">participant-added</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">participant</span> <span class="o">=&gt;</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">participant</span><span class="p">.</span><span class="nx">participant</span><span class="p">.</span><span class="nx">role</span> <span class="o">===</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">I accepted the ring, how may I help you?</span><span class="dl">'</span><span class="p">);</span>
        <span class="p">}</span>
    <span class="p">})</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bot...</span><span class="dl">'</span><span class="p">);</span>
    <span class="c1">// Open the connection</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// Register to be able to accept rings</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createRoutingTaskSubscription</span><span class="p">();</span>

    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">setAgentState</span><span class="p">({</span> <span class="na">agentState</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">AgentState</span><span class="p">.</span><span class="nx">ONLINE</span> <span class="p">});</span>
<span class="p">})();</span>
</code></pre></div></div>

<p>Make sure to run a consumer example which creates a conversation. In this way, you will be able to see the message
<code class="language-html highlighter-rouge">I accepted the ring, how may I help you?</code> from the bot user.</p>

<h3 id="close-all-open-conversations">Close all open conversations</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example uses the SDK to create a brand connection,
 * join all open conversations and close them.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Could not join conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> due to error - </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">. Will still try to close in case it's already joined.`</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Closed conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Could not close conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> due to error - </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="p">}</span>

<span class="p">});</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bot...</span><span class="dl">'</span><span class="p">);</span>
    <span class="c1">// Open the connection</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>

</code></pre></div></div>

<h3 id="upload-file">Upload file</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example uses the SDK to create a brand connection,
 * join all open conversations and send a file upon receiving a specific message.
 *
 * NOTE: the account needs `messaging.file.sharing.enabled` site setting enabled in order to share files.
 */</span>


<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">fs</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">path</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">path</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>

        <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">upload</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="kd">const</span> <span class="nx">file</span> <span class="o">=</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="nx">path</span><span class="p">.</span><span class="nx">resolve</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">,</span> <span class="dl">'</span><span class="s1">logo.jpg</span><span class="dl">'</span><span class="p">));</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">sending file</span><span class="dl">"</span><span class="p">);</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">uploadFile</span><span class="p">(</span><span class="nx">file</span><span class="p">.</span><span class="nx">buffer</span><span class="p">,</span> <span class="dl">"</span><span class="s2">upload</span><span class="dl">"</span><span class="p">)</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">done sending file</span><span class="dl">"</span><span class="p">);</span>
            <span class="p">}</span>
        <span class="p">});</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Could not join conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> due to error - </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">.`</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bot...</span><span class="dl">'</span><span class="p">);</span>
    <span class="c1">// Open the connection</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>

</code></pre></div></div>

<h3 id="get-last-consumer-message">Get last consumer message</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example creates a connection, accepts a ring, awaits that the conversation to be loaded
 * and gets the last consumer message if any.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
  <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
  <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
  <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
  <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="c1">// process the rings as they arrive</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">ring</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">ring</span> <span class="o">=&gt;</span> <span class="p">{</span>

  <span class="c1">// ignore old rings</span>
  <span class="k">if</span> <span class="p">(</span><span class="nx">ring</span><span class="p">.</span><span class="nx">ringState</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">RingState</span><span class="p">.</span><span class="nx">WAITING</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>

  <span class="c1">// accept the ring</span>
  <span class="k">await</span> <span class="nx">ring</span><span class="p">.</span><span class="nx">accept</span><span class="p">();</span>

  <span class="c1">// Awaiting the conversation would pause any subsequent code. Instead, utilize then if there is code which should</span>
  <span class="c1">// be run without a conversation.</span>
  <span class="nx">ring</span><span class="p">.</span><span class="nx">conversation</span><span class="p">().</span><span class="nx">then</span><span class="p">(</span><span class="nx">logLastConsumerMessage</span><span class="p">);</span>

  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Ring received</span><span class="dl">'</span><span class="p">);</span>
<span class="p">});</span>

<span class="kd">function</span> <span class="nx">logLastConsumerMessage</span><span class="p">(</span><span class="nx">conversation</span><span class="p">)</span> <span class="p">{</span>
  <span class="k">if</span> <span class="p">(</span><span class="nx">conversation</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">const</span> <span class="nx">latestConsumerMessage</span> <span class="o">=</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">getLatestConsumerMessage</span><span class="p">();</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">latestConsumerMessage</span> <span class="o">&amp;&amp;</span> <span class="nx">latestConsumerMessage</span><span class="p">.</span><span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
      <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Last consumer message is: "</span><span class="p">${</span><span class="nx">latestConsumerMessage</span><span class="p">.</span><span class="nx">body</span><span class="p">}</span><span class="s2">"`</span><span class="p">);</span>
      <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="c1">// If consumer messages has not yet arrived when the ring is accepted, subscribe to all subsequent messages</span>
    <span class="c1">// for the conversation and log it whenever it arrives</span>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
      <span class="kd">const</span> <span class="nx">latestConsumerMessage</span> <span class="o">=</span> <span class="nx">message</span><span class="p">.</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">getLatestConsumerMessage</span><span class="p">();</span>
      <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">latestConsumerMessage</span> <span class="o">||</span> <span class="o">!</span><span class="nx">latestConsumerMessage</span><span class="p">.</span><span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Message that we have received is not a consumer message for this conversation with id: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
      <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`This is the latestConsumerMessage: </span><span class="p">${</span><span class="nx">latestConsumerMessage</span><span class="p">.</span><span class="nx">body</span><span class="p">}</span><span class="s2"> for conversation: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
      <span class="p">}</span>
    <span class="p">});</span>
  <span class="p">}</span>
<span class="p">}</span>

<span class="p">(</span><span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bot...</span><span class="dl">'</span><span class="p">);</span>
  <span class="c1">// Open the connection</span>
  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>

  <span class="c1">// Register to be able to accept rings</span>
  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createRoutingTaskSubscription</span><span class="p">();</span>

  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">setAgentState</span><span class="p">({</span><span class="na">agentState</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">AgentState</span><span class="p">.</span><span class="nx">ONLINE</span><span class="p">});</span>
<span class="p">})();</span>

</code></pre></div></div>

<h3 id="oauth1-oauth-2-and-oauth2-over-oauth1">OAuth1, OAuth 2 and OAuth2 over OAuth1</h3>

<p>This example uses the SDK to create a brand connection with different oAuth credentials. Depending on the authentication 
you are using, you have to provide different credentials. For oAuth1, use the following format in your <code class="language-html highlighter-rouge">./config.json</code> 
file:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"accountId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testAccount"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"authData"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"username"</span><span class="p">:</span><span class="w"> </span><span class="s2">"username"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"appKey"</span><span class="p">:</span><span class="w"> </span><span class="s2">"287512345"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"secret"</span><span class="p">:</span><span class="w"> </span><span class="s2">"753612345"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"accessToken"</span><span class="p">:</span><span class="w"> </span><span class="s2">"8984112345"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"accessTokenSecret"</span><span class="p">:</span><span class="w"> </span><span class="s2">"13d612345"</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"appId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"test-app"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p>If you already have oAuth2 credentials, but you are using a version of the MPSDK which does not yet support a dedicated
oAuth2 login, you can use the oAuth1 flow with oAuth2 credentials:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"accountId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testAccount"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"authData"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"username"</span><span class="p">:</span><span class="w"> </span><span class="s2">"username"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"appKey"</span><span class="p">:</span><span class="w"> </span><span class="s2">"6YxG183r123456"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"secret"</span><span class="p">:</span><span class="w"> </span><span class="s2">"zQ1wIzypH123456"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"accessToken"</span><span class="p">:</span><span class="w"> </span><span class="s2">"hint"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"accessTokenSecret"</span><span class="p">:</span><span class="w"> </span><span class="s2">"hint"</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"appId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"test-app"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p>The credentials themselves are provided to the <code class="language-html highlighter-rouge">authData</code> property in the connection the same way as oAuth1 credentials.
The difference being that the values for <code class="language-html highlighter-rouge">accessToken</code> and <code class="language-html highlighter-rouge">accessTokenSecret</code> <strong>MUST</strong> be <code class="language-html highlighter-rouge">"hint"</code> since they don't exist 
for oAuth2. If you use a version of the MPSDK which supports oAuth2, use the following format:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"accountId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testAccount"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"authData"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"oauth2"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
      </span><span class="nl">"username"</span><span class="p">:</span><span class="w"> </span><span class="s2">"username"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"client_id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"6YxG183r123456"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"client_secret"</span><span class="p">:</span><span class="w"> </span><span class="s2">"zQ1wIzypH123456"</span><span class="w">
    </span><span class="p">}</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"appId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"test-app"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p>You can try the different flows using the following example. The bot joins new conversations and responds to messages as 
long as they aren't sent by the bot itself.</p>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="p">(</span><span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>

  <span class="c1">// Get the credentials from the config</span>
  <span class="kd">const</span> <span class="p">{</span><span class="nx">appId</span><span class="p">,</span> <span class="nx">accountId</span><span class="p">,</span> <span class="nx">authData</span><span class="p">}</span> <span class="o">=</span> <span class="nx">config</span><span class="p">;</span>
  <span class="kd">const</span> <span class="nx">brandConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="nx">appId</span><span class="p">,</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="nx">authData</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
  <span class="p">});</span>

  <span class="nx">brandConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">"</span><span class="s2">error</span><span class="dl">"</span><span class="p">,</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">"</span><span class="s2">error: </span><span class="dl">"</span><span class="p">,</span> <span class="nx">err</span><span class="p">);</span>
  <span class="p">})</span>
  <span class="k">await</span> <span class="nx">brandConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">"</span><span class="s2">Running</span><span class="dl">"</span><span class="p">);</span>
  <span class="k">await</span> <span class="nx">brandConnection</span><span class="p">.</span><span class="nx">setAgentState</span><span class="p">({</span> <span class="na">agentState</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">AgentState</span><span class="p">.</span><span class="nx">ONLINE</span> <span class="p">});</span>

  <span class="nx">brandConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="c1">// join the conversation as "AGENT" role</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">AGENT</span><span class="p">);</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">"</span><span class="s2">joined conversation</span><span class="dl">"</span><span class="p">);</span>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
      <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">sentByCurrentUser</span><span class="p">())</span> <span class="k">return</span><span class="p">;</span>
      <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">hello</span><span class="dl">'</span><span class="p">);</span>
    <span class="p">});</span>

    <span class="c1">// listen for the close event</span>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">close</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
      <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation closed</span><span class="dl">'</span><span class="p">);</span>
    <span class="p">});</span>
  <span class="p">})</span>
<span class="p">})()</span>
</code></pre></div></div>

<h3 id="share-authentication-between-instances">Share authentication between instances</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example showcases how credentials can be shared between multiple connections.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">"</span><span class="s2">../../index</span><span class="dl">"</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="k">async</span> <span class="kd">function</span> <span class="nx">createBrandConnection</span><span class="p">(</span><span class="nx">connectionName</span><span class="p">,</span> <span class="nx">appId</span><span class="p">,</span> <span class="nx">accountId</span><span class="p">,</span> <span class="nx">tokenMaintainer</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="nx">appId</span><span class="p">,</span>
    <span class="nx">accountId</span><span class="p">,</span>
    <span class="na">query</span><span class="p">:</span> <span class="p">{</span>
      <span class="na">stage</span><span class="p">:[</span><span class="dl">"</span><span class="s2">OPEN</span><span class="dl">"</span><span class="p">]</span>
    <span class="p">},</span>
    <span class="na">waitForReady</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="nx">tokenMaintainer</span>
  <span class="p">});</span>
  <span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="c1">// Try to join the conversation</span>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">AGENT</span><span class="p">).</span><span class="nx">then</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="p">{</span>
      <span class="c1">// Close conversation</span>
      <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`</span><span class="p">${</span><span class="nx">connectionName</span><span class="p">}</span><span class="s2"> Connection: closing conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
      <span class="k">return</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
    <span class="p">}).</span><span class="k">catch</span><span class="p">(</span><span class="nx">e</span> <span class="o">=&gt;</span> <span class="p">{</span>
      <span class="c1">// console.warn(e);</span>
    <span class="p">});</span>
  <span class="p">})</span>
  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">setAgentState</span><span class="p">({</span><span class="na">agentState</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">AgentState</span><span class="p">.</span><span class="nx">ONLINE</span><span class="p">});</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`</span><span class="p">${</span><span class="nx">connectionName</span><span class="p">}</span><span class="s2"> Connection running`</span><span class="p">);</span>
  <span class="k">return</span> <span class="nx">connection</span><span class="p">;</span>
<span class="p">}</span>

<span class="p">(</span><span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="kd">const</span> <span class="p">{</span><span class="nx">appId</span><span class="p">,</span> <span class="nx">accountId</span><span class="p">,</span> <span class="nx">authData</span><span class="p">}</span> <span class="o">=</span> <span class="nx">config</span><span class="p">;</span>

  <span class="c1">// Create tokenMaintainer with credentials from the config</span>
  <span class="kd">const</span> <span class="nx">tokenMaintainer</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">TokenMaintainer</span><span class="p">({</span> <span class="nx">accountId</span><span class="p">,</span> <span class="nx">authData</span> <span class="p">});</span>

  <span class="c1">// Share the tokenMaintainer between two brand connections</span>
  <span class="c1">// Each connection will try to close the received conversation</span>
  <span class="k">await</span> <span class="nx">createBrandConnection</span><span class="p">(</span><span class="dl">"</span><span class="s2">First</span><span class="dl">"</span><span class="p">,</span> <span class="nx">appId</span><span class="p">,</span> <span class="nx">accountId</span><span class="p">,</span> <span class="nx">tokenMaintainer</span><span class="p">);</span>
  <span class="k">await</span> <span class="nx">createBrandConnection</span><span class="p">(</span><span class="dl">"</span><span class="s2">Second</span><span class="dl">"</span><span class="p">,</span> <span class="nx">appId</span><span class="p">,</span> <span class="nx">accountId</span><span class="p">,</span> <span class="nx">tokenMaintainer</span><span class="p">);</span>

  <span class="c1">// Create a new consumer connection to create new conversations</span>
  <span class="kd">const</span> <span class="nx">consumerConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span>
  <span class="p">});</span>

  <span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

  <span class="c1">// Create a new conversation every two seconds</span>
  <span class="nx">setInterval</span><span class="p">(</span><span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">();</span>
  <span class="p">},</span> <span class="mi">2000</span><span class="p">)</span>
<span class="p">})()</span>
</code></pre></div></div>

<h3 id="react-on-different-messages">React on different messages</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example uses the SDK to create a brand connection,
 * join all open conversations and react to each message, based on its content
 *
 * - if it's #time, respond with current time
 * - if it's #close, close the conversation
 * - if it's something else, repeat what the consumer said
 */</span>


<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>

        <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">participant</span><span class="p">.</span><span class="nx">role</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Skipping non-consumer (</span><span class="p">${</span><span class="nx">message</span><span class="p">.</span><span class="nx">participant</span><span class="p">.</span><span class="nx">role</span><span class="p">}</span><span class="s2">) message!`</span><span class="p">);</span>
                <span class="k">return</span><span class="p">;</span>
            <span class="p">}</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#time</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`Time now is: </span><span class="p">${</span><span class="k">new</span> <span class="nb">Date</span><span class="p">().</span><span class="nx">toISOString</span><span class="p">()}</span><span class="s2">`</span><span class="p">);</span>
            <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#close</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`You said: "</span><span class="p">${</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">}</span><span class="s2">"`</span><span class="p">);</span>
            <span class="p">}</span>
        <span class="p">});</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Could not join conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> due to error - </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">.`</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bot...</span><span class="dl">'</span><span class="p">);</span>
    <span class="c1">// Open the connection</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="replay-all-messages">Replay all messages</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example uses the SDK to create a brand connection,
 * join a conversation and if message contains #replay, lists all messages, based on the exact string:
 *
 * - #replay-all - replays all messages in the order they arrived
 * - #replay-reverse - replays all messages in reverse order
 * - #replay-system - replays only the messages sent by controller or brand-bot, in the order they arrived
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>

        <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">includes</span><span class="p">(</span><span class="dl">'</span><span class="s1">#replay-</span><span class="dl">'</span><span class="p">))</span> <span class="p">{</span>
                <span class="kd">const</span> <span class="nx">messagesInDescendingOrder</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">queryMessages</span><span class="p">();</span>
                <span class="k">switch</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
                    <span class="k">case</span> <span class="dl">'</span><span class="s1">#replay-reverse</span><span class="dl">'</span><span class="p">:</span> <span class="p">{</span>
                        <span class="kd">const</span> <span class="nx">messageBodies</span> <span class="o">=</span> <span class="nx">messagesInDescendingOrder</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">msg</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">msg</span><span class="p">.</span><span class="nx">body</span><span class="p">);</span>
                        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`Here are all messages in reverse order:\n-</span><span class="p">${</span><span class="nx">messageBodies</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="dl">'</span><span class="se">\n</span><span class="s1">-</span><span class="dl">'</span><span class="p">)}</span><span class="s2">`</span><span class="p">);</span>
                    <span class="p">}</span><span class="k">break</span><span class="p">;</span>
                    <span class="k">case</span> <span class="dl">'</span><span class="s1">#replay-all</span><span class="dl">'</span><span class="p">:</span> <span class="p">{</span>
                        <span class="kd">const</span> <span class="nx">messagesInAscendingOrder</span> <span class="o">=</span> <span class="nx">messagesInDescendingOrder</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">msg</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">msg</span><span class="p">.</span><span class="nx">body</span><span class="p">).</span><span class="nx">reverse</span><span class="p">();</span>
                        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`Here are all messages in normal order:\n-</span><span class="p">${</span><span class="nx">messagesInAscendingOrder</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="dl">'</span><span class="se">\n</span><span class="s1">-</span><span class="dl">'</span><span class="p">)}</span><span class="s2">`</span><span class="p">);</span>
                    <span class="p">}</span><span class="k">break</span><span class="p">;</span>
                    <span class="k">case</span> <span class="dl">'</span><span class="s1">#replay-system</span><span class="dl">'</span><span class="p">:</span> <span class="p">{</span>
                        <span class="kd">const</span> <span class="nx">systemMessages</span> <span class="o">=</span> <span class="nx">messagesInDescendingOrder</span>
                            <span class="p">.</span><span class="nx">filter</span><span class="p">((</span><span class="nx">msg</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">CONTROLLER</span><span class="p">,</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">BRAND_BOT</span><span class="p">].</span><span class="nx">includes</span><span class="p">(</span><span class="nx">msg</span><span class="p">.</span><span class="nx">participant</span><span class="p">.</span><span class="nx">role</span><span class="p">))</span>
                            <span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">msg</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">msg</span><span class="p">.</span><span class="nx">body</span><span class="p">)</span>
                            <span class="p">.</span><span class="nx">reverse</span><span class="p">();</span>
                        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`Here are the system messages only:\n-</span><span class="p">${</span><span class="nx">systemMessages</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="dl">'</span><span class="se">\n</span><span class="s1">-</span><span class="dl">'</span><span class="p">)}</span><span class="s2">`</span><span class="p">);</span>
                    <span class="p">}</span>
                <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">});</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Could not join conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> due to error - </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">.`</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bot...</span><span class="dl">'</span><span class="p">);</span>
    <span class="c1">// Open the connection</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="transfer-to-agent">Transfer to agent</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example joins a conversation and, upon a certain message, transfers to specific agent.
 *
 * NOTE: You'll need the `Messaging.Transfer_To_Agent` AC Feature enabled to be enabled to be able to transfer to specific agent.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">originalBrandConnectionConfig</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">regularBrandConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">originalBrandConnectionConfig</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">originalBrandConnectionConfig</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">originalBrandConnectionConfig</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="c1">//NOTE: make sure this is the same agent id as the one, described in specificSkillBrandConnectionConfig</span>
<span class="kd">const</span> <span class="nx">desiredAgentId</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">4615909832</span><span class="dl">'</span><span class="p">;</span>
<span class="kd">const</span> <span class="nx">specificSkillBrandConnectionConfig</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./specific-skill-config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">specificSkillBrandConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">specificSkillBrandConnectionConfig</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">specificSkillBrandConnectionConfig</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">specificSkillBrandConnectionConfig</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="nx">regularBrandConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Regular bot joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>

        <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#transfer</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="c1">// NOTE: when transferring to a specific agent, specify the whole agent id, i.e. `accountId.agentId`,</span>
                <span class="c1">// instead of just `agentId`.</span>
                <span class="nx">conversation</span><span class="p">.</span><span class="nx">transfer</span><span class="p">({</span><span class="na">agentId</span><span class="p">:</span> <span class="s2">`</span><span class="p">${</span><span class="nx">originalBrandConnectionConfig</span><span class="p">.</span><span class="nx">accountId</span><span class="p">}</span><span class="s2">.</span><span class="p">${</span><span class="nx">desiredAgentId</span><span class="p">}</span><span class="s2">`</span><span class="p">});</span>
            <span class="p">}</span>
        <span class="p">});</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Could not join conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> due to error - </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">.`</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>

<span class="nx">specificSkillBrandConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">transfer-agent</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">participant</span> <span class="o">=&gt;</span> <span class="p">{</span>
        <span class="c1">// Listen to events that transfer to specific agent and check only if all three criterias are fulfulled:</span>
        <span class="c1">// - id is the id of the agent</span>
        <span class="c1">// - role is assigned_agent</span>
        <span class="c1">// - state of the participant is still SUGGESTED (not ACTIVE, which would mean that the agent already has joined)</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">participant</span><span class="p">.</span><span class="nx">agentId</span> <span class="o">===</span> <span class="s2">`</span><span class="p">${</span><span class="nx">specificSkillBrandConnectionConfig</span><span class="p">.</span><span class="nx">accountId</span><span class="p">}</span><span class="s2">.</span><span class="p">${</span><span class="nx">desiredAgentId</span><span class="p">}</span><span class="s2">`</span>
            <span class="o">&amp;&amp;</span> <span class="nx">participant</span><span class="p">.</span><span class="nx">role</span> <span class="o">===</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span>
            <span class="o">&amp;&amp;</span> <span class="nx">participant</span><span class="p">.</span><span class="nx">state</span> <span class="o">===</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantState</span><span class="p">.</span><span class="nx">SUGGESTED</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
            <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Specific agent bot joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
            <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Hi, I heard you are looking for me?</span><span class="dl">'</span><span class="p">);</span>
        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
            <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`ID: </span><span class="p">${</span><span class="nx">participant</span><span class="p">.</span><span class="nx">agentId</span><span class="p">}</span><span class="s2">; role: </span><span class="p">${</span><span class="nx">participant</span><span class="p">.</span><span class="nx">role</span><span class="p">}</span><span class="s2">; state: </span><span class="p">${</span><span class="nx">participant</span><span class="p">.</span><span class="nx">state</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
        <span class="p">}</span>
    <span class="p">});</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bots...</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// Open the connections</span>
    <span class="k">await</span> <span class="nx">regularBrandConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Regular brand bot connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="k">await</span> <span class="nx">specificSkillBrandConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Specific agent brand bot connected!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="transfer-to-skill">Transfer to skill</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example joins a conversation and, upon a certain message, transfers to specific skill.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">originalBrandConnectionConfig</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">regularBrandConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">originalBrandConnectionConfig</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">originalBrandConnectionConfig</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">originalBrandConnectionConfig</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="c1">//NOTE: make sure this skill id is assigned to the brand, using the specificSkillBrandConnectionConfig</span>
<span class="kd">const</span> <span class="nx">desiredSkillId</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">4615909532</span><span class="dl">'</span><span class="p">;</span>
<span class="kd">const</span> <span class="nx">specificSkillBrandConnectionConfig</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./specific-skill-config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">specificSkillBrandConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">specificSkillBrandConnectionConfig</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">specificSkillBrandConnectionConfig</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">specificSkillBrandConnectionConfig</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="nx">regularBrandConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Regular bot joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>

        <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#transfer</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="nx">conversation</span><span class="p">.</span><span class="nx">transfer</span><span class="p">({</span><span class="na">skillId</span><span class="p">:</span> <span class="nx">desiredSkillId</span><span class="p">});</span>
            <span class="p">}</span>
        <span class="p">});</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Could not join conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> due to error - </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">.`</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>

<span class="nx">specificSkillBrandConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="c1">// Listen to events that transfer to skill and join if it's changing to the desired skill id</span>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">transfer-skill</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">(</span><span class="nx">ev</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">ev</span><span class="p">.</span><span class="nx">skillId</span> <span class="o">===</span> <span class="nx">desiredSkillId</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
            <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Specific skill bot joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
            <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">I am your new assistant!</span><span class="dl">'</span><span class="p">);</span>
        <span class="p">}</span>
    <span class="p">});</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bots...</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// Open the connections</span>
    <span class="k">await</span> <span class="nx">regularBrandConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Regular brand bot connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="k">await</span> <span class="nx">specificSkillBrandConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Specific skill brand bot connected!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="respond-to-all-messages-on-restart-or-disconnect-with-a-downtime">Respond to all messages on restart or disconnect with a downtime</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example creates a connection after a potential downtime caused by restart/disconnect or else. The bot tries to join all new conversation and respond with an message of the last existing consumer message.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span><span class="p">,</span>

    <span class="c1">// This flag fix an issues with conversations being lost or stuck after reconnection if set to false. </span>
    <span class="c1">// For more information look at this link: messaging-platform-sdk-overview.html#connection-maintenance</span>
    <span class="na">unsubscribeFromOutdatedConversationsOnReconnect</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span> 

    <span class="c1">// This way you will fetch all the conversation per brand but be aware that a lot of conversations with a lot of message could cause a problem.</span>
    <span class="c1">// For more information look at this link: messaging-platform-sdk-overview.html#loading-all-previous-messages</span>
    <span class="na">getAllMessages</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>

    <span class="c1">// This will cause open to only resolve once all conversations have been retrieved.</span>
    <span class="na">waitForReady</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>

    <span class="c1">// By default this will fetch all the conversation from UMS even if there are more than 1001, default value is true. If you don't want to take all of them you can switch the value to false. </span>
    <span class="c1">// By doing this you will have just the last 1001 conversation not more than that, but bear in mind that you can loose conversations that are open.</span>
    <span class="na">limitBreakEnabled</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
<span class="p">});</span>


<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Could not join conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> due to error - </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">.`</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="kd">const</span> <span class="nx">message</span> <span class="o">=</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">getLatestConsumerMessage</span><span class="p">();</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`I will reply to this message: </span><span class="p">${</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">}</span><span class="s2"> for conversation with id: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bot...</span><span class="dl">'</span><span class="p">);</span>
    <span class="c1">// Open the connection</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>

<span class="p">})();</span>

</code></pre></div></div>

<h3 id="third-party-bot">Third party bot</h3>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="cm">/**
 * This example uses the SDK to create a third party bot.
 *
 * On reconnect/disconnect or manual start/stop of the bot the SDK will create the event listeners out of the box for
 * the brand. This can take a bit of time depending on the traffic of the brand and online agents.
 *
 * A few questions and answers for the routing tasks aka. rings:
 *  1. When a ring is accepted, could it be accepted by another bot/agent?
 *    - Another agent/bot could join the conversation, but it could only be accepted by (thus, assigned to) a single
 *      agent/bot.
 *  2. Do we have rings with the same ids if the conversation has been transferred in between bots/agents?
 *    - The ringId always changes on new rings. When the conversation is transferred to another agent, send back to the
 *      queue or the ring expires or is rejected, a new ring with a new id will be created.
 *  3.  If a ring is rejected by one bot/agent, can the same bot/agent receive the ring again?
 *    - Let's say you have 3 agents/bots with skillA. Agent1 rejects the ring, agent2 is ringed. If agent2 rejects the
 *      new ring, then agent3 is ringed. If agent3 rejects the new ring, then agent1 is ringed again. This means, that
 *      rings will be created until a conversation is accepted.
 *
 * By default, the system waits 30 seconds until the ring is automatically rejected. Use option`messaging.ACD.response.time`
 * to change this.
 *
 * Important, if the example bot is stopped and a new consumer conversation has been created in the meantime, then the
 * agent will not accept the conversation. It will expire after the configured amount of time (30 seconds; see above).
 * Then, if possible, another online agent will be ringed. When the example bot is restarted, it will wait for a ring
 * which will happen only after rings for other agents are expired. Depending on the eligible agents this can take a
 * while.
 *
 * Important, for this example you need to adapt your config file and add an agentId entry:
 * {
 *   "accountId": "testAccount",
 *   "agentId": "accountId.agentId",
 *   "authData": {
 *     // ...
 *   },
 *   "appId": "test-app"
 * }
 *
 * The agentId is the userId of the bot user. It is concatenation of the accountId and agentId. If you are not sure what
 * your agentId is, you can also use connection.agentId once the connection has been opened.
 */</span>

<span class="kd">const</span> <span class="nx">processedConversations</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Map</span><span class="p">();</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
  <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
  <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
  <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
  <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span><span class="p">,</span>

  <span class="c1">// If set to false, this flag fixes an issue with conversations being lost or stuck after reconnection</span>
  <span class="c1">// For more information look at this link: messaging-platform-sdk-overview.html#connection-maintenance</span>
  <span class="na">unsubscribeFromOutdatedConversationsOnReconnect</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>

  <span class="c1">// If set to true, this will fetch all the conversation per brand but be aware that a lot of conversations with a lot of message could lead to performance issues on startup.</span>
  <span class="c1">// For more information look at this link: messaging-platform-sdk-overview.html#loading-all-previous-messages</span>
  <span class="na">getAllMessages</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>

  <span class="c1">// If set to true, this will cause `connection.open` to resolve only once all conversations have been retrieved.</span>
  <span class="c1">// This operation is time-consuming, so it can also lead to performance issues on startup.</span>
  <span class="na">waitForReady</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>

  <span class="c1">// This can be used to configure the timeout, used when fetching the conversation, assigned to the ring:</span>
  <span class="c1">// messaging-platform-sdk-overview.html#accepting-conversation-on-the-ring</span>
  <span class="na">ringConversationTimeout</span><span class="p">:</span> <span class="mi">2000</span><span class="p">,</span>

  <span class="c1">// Depending on the connection type (Brand or Consumer), the SDK will create a subscription for conversations by</span>
  <span class="c1">// default. For brand connections the SDK subscribes to all open conversations of the brand. However,</span>
  <span class="c1">// third party bots are acting as an agent, and, thus, are only interested in conversations which they joined. This</span>
  <span class="c1">// is why this option is set to false. Later in the example, there is a corresponding subscription. For more</span>
  <span class="c1">// information visit: messaging-platform-sdk-overview.html#the-default-subscription</span>
  <span class="na">createDefaultSubscription</span><span class="p">:</span> <span class="kc">false</span>
<span class="p">});</span>

<span class="c1">// Define the callbacks *before* opening the connection, to ensure no lost events</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">ring</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">ring</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="k">if</span> <span class="p">(</span><span class="nx">ring</span><span class="p">.</span><span class="nx">ringState</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">RingState</span><span class="p">.</span><span class="nx">WAITING</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Ring is already in state </span><span class="p">${</span><span class="nx">ring</span><span class="p">.</span><span class="nx">ringState</span><span class="p">}</span><span class="s2">, ignoring for conversation: </span><span class="p">${</span><span class="nx">ring</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="k">return</span><span class="p">;</span>
  <span class="p">}</span>

  <span class="k">await</span> <span class="nx">ring</span><span class="p">.</span><span class="nx">accept</span><span class="p">();</span>

  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Ring accepted!</span><span class="dl">'</span><span class="p">);</span>
  <span class="k">try</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Trying to fetch conversation from the ring</span><span class="dl">'</span><span class="p">);</span>
    <span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">ring</span><span class="p">.</span><span class="nx">conversation</span><span class="p">();</span>

    <span class="k">await</span> <span class="nx">processNewConversation</span><span class="p">(</span><span class="nx">conversation</span><span class="p">);</span>
  <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Error when trying to respond to the last consumer message</span><span class="dl">'</span><span class="p">,</span> <span class="nx">error</span><span class="p">);</span>
  <span class="p">}</span>
<span class="p">});</span>

<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="k">try</span> <span class="p">{</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>

    <span class="k">await</span> <span class="nx">processNewConversation</span><span class="p">(</span><span class="nx">conversation</span><span class="p">);</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`I joined a conversation with id: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
  <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Already joined </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
  <span class="p">}</span>
<span class="p">});</span>

<span class="cm">/**
 * Processes new conversations.
 *
 * Use this an example of what could be implemented.
 *
 * @param conversation which should be processed
 * @returns {Promise&lt;void&gt;}
 */</span>
<span class="k">async</span> <span class="kd">function</span> <span class="nx">processNewConversation</span><span class="p">(</span><span class="nx">conversation</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">const</span> <span class="nx">latestConsumerMessage</span> <span class="o">=</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">getLatestConsumerMessage</span><span class="p">();</span>
  <span class="k">if</span> <span class="p">(</span><span class="nx">latestConsumerMessage</span> <span class="o">&amp;&amp;</span> <span class="nx">latestConsumerMessage</span><span class="p">.</span><span class="nx">body</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">processedConversations</span><span class="p">.</span><span class="nx">has</span><span class="p">(</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">))</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Last consumer message is: "</span><span class="p">${</span><span class="nx">latestConsumerMessage</span><span class="p">.</span><span class="nx">body</span><span class="p">}</span><span class="s2"> and i will respond for conversation with id: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`Message received for you conversation for this conversationId: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="nx">processedConversations</span><span class="p">.</span><span class="kd">set</span><span class="p">(</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">,</span> <span class="nx">conversation</span><span class="p">);</span>
    <span class="nx">deleteProcessedConversation</span><span class="p">(</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">);</span>
    <span class="k">return</span><span class="p">;</span>
  <span class="p">}</span>

  <span class="c1">// If consumer messages have not yet arrived when the ring is accepted, subscribe to all subsequent messages</span>
  <span class="c1">// for the conversation and log whenever it arrives</span>
  <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="kd">const</span> <span class="nx">latestConsumerMessage</span> <span class="o">=</span> <span class="nx">message</span><span class="p">.</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">getLatestConsumerMessage</span><span class="p">();</span>
    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">latestConsumerMessage</span> <span class="o">||</span> <span class="o">!</span><span class="nx">latestConsumerMessage</span><span class="p">.</span><span class="nx">body</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">processedConversations</span><span class="p">.</span><span class="nx">has</span><span class="p">(</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">))</span> <span class="p">{</span>
      <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Message that we have received is not a consumer message for this conversation with id: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
      <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`Message received for you conversation for this conversationId: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
      <span class="nx">processedConversations</span><span class="p">.</span><span class="kd">set</span><span class="p">(</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">,</span> <span class="nx">conversation</span><span class="p">);</span>
      <span class="nx">deleteProcessedConversation</span><span class="p">(</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">);</span>
    <span class="p">}</span>
  <span class="p">});</span>
<span class="p">}</span>

<span class="kd">function</span> <span class="nx">deleteProcessedConversation</span><span class="p">(</span><span class="nx">conversationId</span><span class="p">)</span> <span class="p">{</span>
  <span class="nx">setTimeout</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">processedConversations</span><span class="p">.</span><span class="k">delete</span><span class="p">(</span><span class="nx">conversationId</span><span class="p">);</span>
  <span class="p">},</span> <span class="mi">60000</span><span class="p">);</span> <span class="c1">// You can increase according to the use case</span>
<span class="p">}</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bot...</span><span class="dl">'</span><span class="p">);</span>

  <span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">err</span><span class="p">));</span>
  <span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">disconnect</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`sdk disconnect event hit for account id: </span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">}</span><span class="s2">`</span><span class="p">));</span>
  <span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">reconnect</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`sdk reconnect event hit for account id: </span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">}</span><span class="s2">`</span><span class="p">));</span>

  <span class="c1">// Open the connection</span>
  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>

  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Subscribing to routing task subscriptions (rings)</span><span class="dl">'</span><span class="p">);</span>
  <span class="c1">// With this subscription, the bot will be ringed when there is a new conversation and the bot is eligible to join it.</span>
  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createRoutingTaskSubscription</span><span class="p">({</span> <span class="na">query</span><span class="p">:</span> <span class="p">{</span> <span class="na">agentId</span><span class="p">:</span> <span class="s2">`</span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">}</span><span class="s2">.</span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">agentId</span><span class="p">}</span><span class="s2">`</span><span class="p">,</span> <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span> <span class="p">}</span> <span class="p">});</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Subscribed to routing task subscriptions (rings)</span><span class="dl">'</span><span class="p">);</span>

  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Subscribing to conversations of this agent</span><span class="dl">'</span><span class="p">);</span>
  <span class="c1">// With this manual subscription, we ensure that we only subscribe to conversations which the agent joined.</span>
  <span class="kd">const</span> <span class="nx">query</span> <span class="o">=</span> <span class="p">{</span><span class="na">stage</span><span class="p">:[</span><span class="dl">"</span><span class="s2">OPEN</span><span class="dl">"</span><span class="p">],</span> <span class="na">agentId</span><span class="p">:</span> <span class="s2">`</span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">}</span><span class="s2">.</span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">agentId</span><span class="p">}</span><span class="s2">`</span><span class="p">};</span>
  <span class="c1">// waitForReady means that the application should block until all conversations are received before continuing.</span>
  <span class="c1">// In this case we set it to false. Corresponding conversations will be received but the bot will not block here.</span>
  <span class="kd">const</span> <span class="nx">waitForReady</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversationSubscription</span><span class="p">({</span><span class="nx">query</span><span class="p">,</span> <span class="nx">waitForReady</span><span class="p">});</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Subscribed to conversations of this agent</span><span class="dl">'</span><span class="p">);</span>

  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Setting Agent to online</span><span class="dl">'</span><span class="p">);</span>
  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">setAgentState</span><span class="p">({</span> <span class="na">agentState</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">AgentState</span><span class="p">.</span><span class="nx">ONLINE</span> <span class="p">});</span>
  <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Agent is online</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="third-party-bot-with-callback-configured">Third party bot with callback configured</h3>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="cm">/**
 * This example uses the SDK to create a third party bot.
 *
 * On reconnect/disconnect or manual start/stop of the bot the SDK will create the event listeners out of the box for
 * the brand. This can take a bit of time depending on the traffic of the brand and online agents.
 *
 * A few questions and answers for the routing tasks aka. rings:
 *  1. When a ring is accepted, could it be accepted by another bot/agent?
 *    - Another agent/bot could join the conversation, but it could only be accepted by (thus, assigned to) a single
 *      agent/bot.
 *  2. Do we have rings with the same ids if the conversation has been transferred in between bots/agents?
 *    - The ringId always changes on new rings. When the conversation is transferred to another agent, send back to the
 *      queue or the ring expires or is rejected, a new ring with a new id will be created.
 *  3.  If a ring is rejected by one bot/agent, can the same bot/agent receive the ring again?
 *    - Let's say you have 3 agents/bots with skillA. Agent1 rejects the ring, agent2 is ringed. If agent2 rejects the
 *      new ring, then agent3 is ringed. If agent3 rejects the new ring, then agent1 is ringed again. This means, that
 *      rings will be created until a conversation is accepted.
 *
 * By default, the system waits 30 seconds until the ring is automatically rejected. Use option`messaging.ACD.response.time`
 * to change this.
 *
 * Important, if the example bot is stopped and a new consumer conversation has been created in the meantime, then the
 * agent will not accept the conversation. It will expire after the configured amount of time (30 seconds; see above).
 * Then, if possible, another online agent will be ringed. When the example bot is restarted, it will wait for a ring
 * which will happen only after rings for other agents are expired. Depending on the eligible agents this can take a
 * while.
 *
 * Important, for this example you need to adapt your config file and add an agentId entry:
 * {
 *   "accountId": "testAccount",
 *   "agentId": "accountId.agentId",
 *   "authData": {
 *     // ...
 *   },
 *   "appId": "test-app"
 * }
 *
 * The agentId is the userId of the bot user. It is concatenation of the accountId and agentId. If you are not sure what
 * your agentId is, you can also use connection.agentId once the connection has been opened.
 *
 * Combined conversation handling can be used to process new conversations in one place. For example, if a ring is
 * accepted or when the conversation is received.
 */</span>
<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// Please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span><span class="p">,</span>

    <span class="c1">// If set to false, this flag fixes an issue with conversations being lost or stuck after reconnection</span>
    <span class="c1">// For more information look at this link: messaging-platform-sdk-overview.html#connection-maintenance</span>
    <span class="na">unsubscribeFromOutdatedConversationsOnReconnect</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>

    <span class="c1">// Depending on the connection type (Brand or Consumer), the SDK will create a subscription for conversations by</span>
    <span class="c1">// default. For brand connections the SDK subscribes to all open conversations of the brand. However,</span>
    <span class="c1">// third party bots are acting as an agent, and, thus, are only interested in conversations which they joined. This</span>
    <span class="c1">// is why this option is set to false. Later in the example, there is a corresponding subscription. For more</span>
    <span class="c1">// information visit: messaging-platform-sdk-overview.html#the-default-subscription</span>
    <span class="na">createDefaultSubscription</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>

    <span class="c1">// The SDK will trigger the callback once either the ring was accepted or when the conversation is received</span>
    <span class="c1">// messaging-platform-sdk-overview.html#conversation-callback-configuration</span>
    <span class="na">combinedConversationHandling</span><span class="p">:</span> <span class="p">{</span>
        <span class="na">callback</span><span class="p">:</span> <span class="nx">processNewConversation</span><span class="p">,</span>
        <span class="na">combinedConversationHandlingOptions</span><span class="p">:</span> <span class="p">{</span>
            <span class="na">max</span><span class="p">:</span> <span class="mi">10000</span><span class="p">,</span> <span class="c1">// caches 10K</span>
            <span class="na">ttl</span><span class="p">:</span> <span class="mi">1000</span> <span class="o">*</span> <span class="mi">60</span> <span class="o">*</span> <span class="mi">60</span> <span class="o">*</span> <span class="mi">24</span><span class="p">,</span> <span class="c1">// conversations over 1 day</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">});</span>

<span class="c1">// Define the callbacks *before* opening the connection, to ensure no lost events</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">ring</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">ring</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">ring</span><span class="p">.</span><span class="nx">ringState</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">RingState</span><span class="p">.</span><span class="nx">WAITING</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Ring is already in state </span><span class="p">${</span><span class="nx">ring</span><span class="p">.</span><span class="nx">ringState</span><span class="p">}</span><span class="s2">, ignoring for conversation: </span><span class="p">${</span><span class="nx">ring</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
        <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="k">await</span> <span class="nx">ring</span><span class="p">.</span><span class="nx">accept</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Ring accepted for </span><span class="p">${</span><span class="nx">ring</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">.`</span><span class="p">);</span>
<span class="p">});</span>

<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Already joined </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>

<span class="cm">/**
 * 
 * @param {*} conversation 
 * 
 * The function is free brand implementation that covers specific use cases. Use this an example of what could be implemented.
 * @returns void
 */</span>
<span class="k">async</span> <span class="kd">function</span> <span class="nx">processNewConversation</span><span class="p">(</span><span class="nx">conversation</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Process conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">)</span>
    <span class="kd">const</span> <span class="nx">latestConsumerMessage</span> <span class="o">=</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">getLatestConsumerMessage</span><span class="p">();</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">latestConsumerMessage</span> <span class="o">&amp;&amp;</span> <span class="nx">latestConsumerMessage</span><span class="p">.</span><span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Last consumer message is: "</span><span class="p">${</span><span class="nx">latestConsumerMessage</span><span class="p">.</span><span class="nx">body</span><span class="p">}</span><span class="s2"> and i will respond for conversation with id: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`Send message back about a conversation with conversationId: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
        <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="c1">// If consumer messages have not yet arrived when the ring is accepted, subscribe to all subsequent messages</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">openDialog</span><span class="p">.</span><span class="nx">queryMessages</span><span class="p">();</span>
    <span class="k">return</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`Send message back after fetching all messages for conversation with conversationId: </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
<span class="p">}</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting brand bot...</span><span class="dl">'</span><span class="p">);</span>

    <span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">err</span><span class="p">));</span>
    <span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">disconnect</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`sdk disconnect event hit for account id: </span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">}</span><span class="s2">`</span><span class="p">));</span>
    <span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">reconnect</span><span class="dl">'</span><span class="p">,</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`sdk reconnect event hit for account id: </span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">}</span><span class="s2">`</span><span class="p">));</span>
    
    <span class="c1">// Open the connection</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Performing createRoutingTaskSubscription</span><span class="dl">'</span><span class="p">);</span>
    <span class="c1">// Register to be able to accept rings</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createRoutingTaskSubscription</span><span class="p">({</span> <span class="na">query</span><span class="p">:</span> <span class="p">{</span> <span class="na">agentId</span><span class="p">:</span> <span class="s2">`</span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">}</span><span class="s2">.</span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">agentId</span><span class="p">}</span><span class="s2">`</span><span class="p">,</span> <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span> <span class="p">}</span> <span class="p">});</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Subscribed for createRoutingTaskSubscription</span><span class="dl">'</span><span class="p">);</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Performing createConversationSubscription</span><span class="dl">'</span><span class="p">);</span>
    <span class="kd">const</span> <span class="nx">query</span> <span class="o">=</span> <span class="p">{</span><span class="na">stage</span><span class="p">:[</span><span class="dl">"</span><span class="s2">OPEN</span><span class="dl">"</span><span class="p">],</span> <span class="na">agentId</span><span class="p">:</span> <span class="s2">`</span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">}</span><span class="s2">.</span><span class="p">${</span><span class="nx">config</span><span class="p">.</span><span class="nx">agentId</span><span class="p">}</span><span class="s2">`</span><span class="p">};</span>
    <span class="kd">const</span> <span class="nx">waitForReady</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversationSubscription</span><span class="p">({</span><span class="nx">query</span><span class="p">,</span> <span class="nx">waitForReady</span><span class="p">});</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Subscribed for createConversationSubscription</span><span class="dl">'</span><span class="p">);</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Performing setAgentState</span><span class="dl">'</span><span class="p">);</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">setAgentState</span><span class="p">({</span> <span class="na">agentState</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">AgentState</span><span class="p">.</span><span class="nx">ONLINE</span> <span class="p">});</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Agent state is online</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>


</code></pre></div></div>

<h2 id="brand-examples-continued">Brand Examples (continued)</h2>

<h3 id="resume-conversation">Resume conversation</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example demonstrates how a brand bot can resume a closed conversation.
 *
 * Resuming a conversation creates a new conversation with a new conversationId, allowing the
 * brand to continue the interaction with the same consumer. The original conversation remains
 * closed — the resumed one is a fresh open conversation linked to the same consumer.
 *
 * NOTE: The 'close' event on the brand conversation is only emitted when the conversation is
 * closed by someone else (e.g. the consumer). If the brand closes it itself, the event is not
 * emitted. In this example the consumer closes the conversation, so the brand receives the event.
 *
 * The example runs both brand and consumer in one script:
 *   1. Brand connects and waits for incoming conversations
 *   2. Consumer connects, creates a conversation and sends a message
 *   3. After 10 seconds, the consumer closes the conversation
 *   4. The brand receives the 'close' event and calls resumeConversation()
 *   5. The resumed conversation has a new conversationId — the agent is already assigned
 *      by the server, so no join() is needed
 *   6. Brand sends a follow-up message in the resumed conversation
 *
 * Config file structure (config.json):
 * {
 *   "appId": "YOUR_APP_ID",
 *   "accountId": "YOUR_ACCOUNT_ID",
 *   "authData": {
 *     "oauth2": {
 *       "username": "YOUR_USERNAME",
 *       "client_id": "YOUR_CLIENT_ID",
 *       "client_secret": "YOUR_CLIENT_SECRET"
 *     }
 *   }
 * }
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">waitSeconds</span> <span class="o">=</span> <span class="p">(</span><span class="nx">time</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="k">new</span> <span class="nb">Promise</span><span class="p">(</span><span class="nx">resolve</span> <span class="o">=&gt;</span> <span class="nx">setTimeout</span><span class="p">(</span><span class="nx">resolve</span><span class="p">,</span> <span class="nx">time</span> <span class="o">*</span> <span class="mi">1000</span><span class="p">));</span>

<span class="c1">// ── Brand bot ─────────────────────────────────────────────────────────────────</span>

<span class="kd">const</span> <span class="nx">brandConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="nx">brandConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="dl">'</span><span class="s1">[brand] Connection error:</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span><span class="p">);</span>
<span class="p">});</span>

<span class="nx">brandConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`[brand] Joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>

        <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">sentByCurrentUser</span><span class="p">())</span> <span class="k">return</span><span class="p">;</span>
            <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`[brand] Received: "</span><span class="p">${</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">}</span><span class="s2">"`</span><span class="p">);</span>
        <span class="p">});</span>

        <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">close</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
            <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`[brand] Conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> closed. Resuming...`</span><span class="p">);</span>

            <span class="c1">// resumeConversation() creates a new conversation (new conversationId)</span>
            <span class="c1">// linked to the same consumer — the original conversation stays closed</span>
            <span class="kd">const</span> <span class="nx">resumedConversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">resumeConversation</span><span class="p">();</span>
            <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`[brand] Resumed as new conversation </span><span class="p">${</span><span class="nx">resumedConversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>

            <span class="c1">// The agent is already assigned by the server on resume — no join() needed.</span>
            <span class="k">await</span> <span class="nx">resumedConversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">The conversation has been resumed. How can I help you further?</span><span class="dl">'</span><span class="p">);</span>
        <span class="p">});</span>

    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s2">`[brand] Could not join </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">: </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>

<span class="c1">// ── Consumer ──────────────────────────────────────────────────────────────────</span>

<span class="kd">const</span> <span class="nx">consumerConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span>
<span class="p">});</span>

<span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="dl">'</span><span class="s1">[consumer] Connection error:</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span><span class="p">);</span>
<span class="p">});</span>

<span class="c1">// ── Main ──────────────────────────────────────────────────────────────────────</span>

<span class="p">(</span><span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">[brand] Connecting brand bot...</span><span class="dl">'</span><span class="p">);</span>
    <span class="k">await</span> <span class="nx">brandConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">[brand] Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>
    <span class="k">await</span> <span class="nx">brandConnection</span><span class="p">.</span><span class="nx">setAgentState</span><span class="p">({</span> <span class="na">agentState</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">AgentState</span><span class="p">.</span><span class="nx">ONLINE</span> <span class="p">});</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">[consumer] Connecting consumer...</span><span class="dl">'</span><span class="p">);</span>
    <span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">[consumer] Consumer connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`[consumer] Conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> created!`</span><span class="p">);</span>

    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Hello, I will close this conversation in 10 seconds.</span><span class="dl">'</span><span class="p">);</span>

    <span class="k">await</span> <span class="nx">waitSeconds</span><span class="p">(</span><span class="mi">10</span><span class="p">);</span>

    <span class="c1">// Closing from the consumer side ensures the brand receives the 'close' event</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">[consumer] Conversation closed.</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="private-messages">Private messages</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example demonstrates private messages (visible only to agents and managers, not the consumer).
 *
 * A brand bot joins each conversation and:
 *   - Sends a private message when it receives "#private"
 *   - Sends a normal public message when it receives "#public"
 *   - Closes the conversation when it receives "#close"
 *
 * Config file structure (config.json):
 * {
 *   "appId": "YOUR_APP_ID",
 *   "accountId": "YOUR_ACCOUNT_ID",
 *   "authData": {
 *     "oauth2": {
 *       "username": "YOUR_USERNAME",
 *       "client_id": "YOUR_CLIENT_ID",
 *       "client_secret": "YOUR_CLIENT_SECRET"
 *     }
 *   }
 * }
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">brandConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="nx">brandConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`[brand] Joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>

        <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
            <span class="kd">const</span> <span class="nx">body</span> <span class="o">=</span> <span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">;</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#private</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendPrivateMessage</span><span class="p">(</span>
                    <span class="dl">'</span><span class="s1">This is a PRIVATE message — only agents and managers can see this.</span><span class="dl">'</span>
                <span class="p">);</span>
            <span class="p">}</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#public</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">This is a PUBLIC message — everyone can see this.</span><span class="dl">'</span><span class="p">);</span>
            <span class="p">}</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#close</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
            <span class="p">}</span>
        <span class="p">});</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s2">`[brand] Could not join </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">: </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">await</span> <span class="nx">brandConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">[brand] Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="rich-text">Rich text</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example demonstrates sending rich text (structured content) messages.
 *
 * A brand bot joins each conversation and sends different rich content shapes
 * when triggered by specific consumer messages:
 *   "#card"        — a vertical card with text + buttons
 *   "#horizontal"  — a horizontal layout with two buttons
 *   "#quickreply"  — a plain text message with quick reply chips attached
 *   "#close"       — closes the conversation
 *
 * Config file structure (config.json):
 * {
 *   "appId": "YOUR_APP_ID",
 *   "accountId": "YOUR_ACCOUNT_ID",
 *   "authData": {
 *     "oauth2": {
 *       "username": "YOUR_USERNAME",
 *       "client_id": "YOUR_CLIENT_ID",
 *       "client_secret": "YOUR_CLIENT_SECRET"
 *     }
 *   }
 * }
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">cardContent</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">vertical</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">elements</span><span class="p">:</span> <span class="p">[</span>
        <span class="p">{</span> <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">text</span><span class="dl">'</span><span class="p">,</span> <span class="na">text</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Welcome! How can we help you today?</span><span class="dl">'</span><span class="p">,</span> <span class="na">tooltip</span><span class="p">:</span> <span class="dl">'</span><span class="s1">greeting</span><span class="dl">'</span> <span class="p">},</span>
        <span class="p">{</span>
            <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">horizontal</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">elements</span><span class="p">:</span> <span class="p">[</span>
                <span class="p">{</span>
                    <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">button</span><span class="dl">'</span><span class="p">,</span>
                    <span class="na">title</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Account inquiry</span><span class="dl">'</span><span class="p">,</span>
                    <span class="na">click</span><span class="p">:</span> <span class="p">{</span> <span class="na">actions</span><span class="p">:</span> <span class="p">[{</span> <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">publishText</span><span class="dl">'</span><span class="p">,</span> <span class="na">text</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Account inquiry</span><span class="dl">'</span> <span class="p">}]</span> <span class="p">}</span>
                <span class="p">},</span>
                <span class="p">{</span>
                    <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">button</span><span class="dl">'</span><span class="p">,</span>
                    <span class="na">title</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Technical support</span><span class="dl">'</span><span class="p">,</span>
                    <span class="na">click</span><span class="p">:</span> <span class="p">{</span> <span class="na">actions</span><span class="p">:</span> <span class="p">[{</span> <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">publishText</span><span class="dl">'</span><span class="p">,</span> <span class="na">text</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Technical support</span><span class="dl">'</span> <span class="p">}]</span> <span class="p">}</span>
                <span class="p">}</span>
            <span class="p">]</span>
        <span class="p">}</span>
    <span class="p">]</span>
<span class="p">};</span>

<span class="kd">const</span> <span class="nx">horizontalContent</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">horizontal</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">elements</span><span class="p">:</span> <span class="p">[</span>
        <span class="p">{</span>
            <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">button</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">title</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Yes</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">click</span><span class="p">:</span> <span class="p">{</span> <span class="na">actions</span><span class="p">:</span> <span class="p">[{</span> <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">publishText</span><span class="dl">'</span><span class="p">,</span> <span class="na">text</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Yes</span><span class="dl">'</span> <span class="p">}]</span> <span class="p">}</span>
        <span class="p">},</span>
        <span class="p">{</span>
            <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">button</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">title</span><span class="p">:</span> <span class="dl">'</span><span class="s1">No</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">click</span><span class="p">:</span> <span class="p">{</span>
                <span class="na">actions</span><span class="p">:</span> <span class="p">[{</span> <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">publishText</span><span class="dl">'</span><span class="p">,</span> <span class="na">text</span><span class="p">:</span> <span class="dl">'</span><span class="s1">No</span><span class="dl">'</span> <span class="p">}],</span>
                <span class="na">metadata</span><span class="p">:</span> <span class="p">[{</span> <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">ExternalId</span><span class="dl">'</span><span class="p">,</span> <span class="na">id</span><span class="p">:</span> <span class="dl">'</span><span class="s1">/user_declined</span><span class="dl">'</span> <span class="p">}]</span>
            <span class="p">}</span>
        <span class="p">}</span>
    <span class="p">]</span>
<span class="p">};</span>

<span class="kd">const</span> <span class="nx">quickReplies</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quickReplies</span><span class="dl">'</span><span class="p">,</span>
    <span class="na">itemsPerRow</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
    <span class="na">replies</span><span class="p">:</span> <span class="p">[</span>
        <span class="p">{</span>
            <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">button</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">tooltip</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Option A tooltip</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">title</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Option A</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">click</span><span class="p">:</span> <span class="p">{</span> <span class="na">actions</span><span class="p">:</span> <span class="p">[{</span> <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">publishText</span><span class="dl">'</span><span class="p">,</span> <span class="na">text</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Option A</span><span class="dl">'</span> <span class="p">}]</span> <span class="p">}</span>
        <span class="p">},</span>
        <span class="p">{</span>
            <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">button</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">tooltip</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Option B tooltip</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">title</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Option B</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">click</span><span class="p">:</span> <span class="p">{</span> <span class="na">actions</span><span class="p">:</span> <span class="p">[{</span> <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">publishText</span><span class="dl">'</span><span class="p">,</span> <span class="na">text</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Option B</span><span class="dl">'</span> <span class="p">}]</span> <span class="p">}</span>
        <span class="p">},</span>
        <span class="p">{</span>
            <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">button</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">tooltip</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Option C tooltip</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">title</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Option C</span><span class="dl">'</span><span class="p">,</span>
            <span class="na">click</span><span class="p">:</span> <span class="p">{</span> <span class="na">actions</span><span class="p">:</span> <span class="p">[{</span> <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">publishText</span><span class="dl">'</span><span class="p">,</span> <span class="na">text</span><span class="p">:</span> <span class="dl">'</span><span class="s1">Option C</span><span class="dl">'</span> <span class="p">}]</span> <span class="p">}</span>
        <span class="p">}</span>
    <span class="p">]</span>
<span class="p">};</span>

<span class="kd">const</span> <span class="nx">brandConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
    <span class="na">authData</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">authData</span>
<span class="p">});</span>

<span class="nx">brandConnection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">conversation</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">conversation</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">try</span> <span class="p">{</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">ASSIGNED_AGENT</span><span class="p">);</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`[brand] Joined conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>

        <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#card</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendRichText</span><span class="p">(</span><span class="nx">cardContent</span><span class="p">);</span>
            <span class="p">}</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#horizontal</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendRichText</span><span class="p">(</span><span class="nx">horizontalContent</span><span class="p">);</span>
            <span class="p">}</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#quickreply</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Please choose an option below:</span><span class="dl">'</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">quickReplies</span><span class="p">);</span>
            <span class="p">}</span>

            <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#close</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
                <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
            <span class="p">}</span>
        <span class="p">});</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s2">`[brand] Could not join </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2">: </span><span class="p">${</span><span class="nx">error</span><span class="p">.</span><span class="nx">message</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">await</span> <span class="nx">brandConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">[brand] Brand bot connected!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h2 id="consumer-examples">Consumer Examples</h2>

<p>The configuration for consumer examples do not contain authentication data. Additionally, they contain client 
properties and a skill. To run a consumer example, copy the example to a separate file and add the <code class="language-html highlighter-rouge">config.json</code> in the
same directory. The format looks as follows:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"accountId"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
  </span><span class="nl">"clientProperties"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"deviceFamily"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"deviceManufacturer"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"deviceModel"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"osName"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"osVersion"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"ipAddress"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"browser"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"browserVersion"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"timeZone"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"features"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"AUTO_MESSAGES"</span><span class="p">,</span><span class="w"> </span><span class="s2">"PHOTO_SHARING"</span><span class="p">]</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"appId"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
  </span><span class="nl">"skillId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"4725444232"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>The app id must contain at least one alphanumeric character, a <code class="language-html highlighter-rouge">-</code>, <code class="language-html highlighter-rouge">.</code> or <code class="language-html highlighter-rouge">_</code>. For example, <code class="language-html highlighter-rouge">example-test_123</code> is a 
valid id while <code class="language-html highlighter-rouge">example test 123</code> is not. Client properties contain free-form values for customer details. You can enter 
anything that you want. Note that, <code class="language-html highlighter-rouge">PHOTO_SHARING</code> and <code class="language-html highlighter-rouge">AUTO_MESSAGES</code> features are required for the examples to work, 
so they are already filled.</p>

<h3 id="basic-conversation-example">Basic conversation example</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This is the most basic example of a consumer connection, using all default values,
 * sends a message and closes the conversation after 5 seconds
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span>
<span class="p">});</span>

<span class="c1">// log any internal errors (auth errors, etc)</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
<span class="p">});</span>

<span class="kd">const</span> <span class="nx">waitSeconds</span> <span class="o">=</span> <span class="p">(</span><span class="nx">time</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">return</span> <span class="k">new</span> <span class="nb">Promise</span><span class="p">((</span><span class="nx">resolve</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">setTimeout</span><span class="p">(</span><span class="nx">resolve</span><span class="p">,</span> <span class="nx">time</span> <span class="o">*</span> <span class="mi">1000</span><span class="p">));</span>
<span class="p">};</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting consumer...</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// connect &amp; open conversation</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Consumer connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// create conversation</span>
    <span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Conversation created!</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// send a message</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Example message</span><span class="dl">'</span><span class="p">);</span>

    <span class="k">await</span> <span class="nx">waitSeconds</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span>

    <span class="c1">// close the main dialog</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>

    <span class="c1">// close the connection</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Conversation and connection closed!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="close-on-message">Close on Message</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example creates a connection and a conversation and subscribes to messages.
 * Upon receiving a message with exact content "42" it thanks the agent and closes the conversation.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span>
<span class="p">});</span>

<span class="c1">// log any internal errors (auth errors, etc)</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
<span class="p">});</span>

<span class="kd">const</span> <span class="nx">waitSeconds</span> <span class="o">=</span> <span class="p">(</span><span class="nx">time</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">return</span> <span class="k">new</span> <span class="nb">Promise</span><span class="p">((</span><span class="nx">resolve</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">setTimeout</span><span class="p">(</span><span class="nx">resolve</span><span class="p">,</span> <span class="nx">time</span> <span class="o">*</span> <span class="mi">1000</span><span class="p">));</span>
<span class="p">};</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting consumer...</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// connect &amp; open conversation</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Consumer connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// create conversation</span>
    <span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">();</span>

    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">42</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Thank you for answering everything!</span><span class="dl">'</span><span class="p">);</span>
            <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
            <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
            <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Conversation and connection closed!</span><span class="dl">'</span><span class="p">);</span>
        <span class="p">}</span>
    <span class="p">});</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Conversation created!</span><span class="dl">'</span><span class="p">);</span>

    <span class="k">await</span> <span class="nx">waitSeconds</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span>

    <span class="c1">// send a message</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Tell me everything</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>

</code></pre></div></div>

<h3 id="continue-consumer-session">Continue consumer session</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example creates a connection, gets its token, creates a conversation and sends a message in it,
 * then closes the connection, reopens a new connection with the same token and sends another message in the same conversation
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection1</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span>
<span class="p">});</span>

<span class="kd">const</span> <span class="nx">waitSeconds</span> <span class="o">=</span> <span class="p">(</span><span class="nx">time</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">return</span> <span class="k">new</span> <span class="nb">Promise</span><span class="p">((</span><span class="nx">resolve</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">setTimeout</span><span class="p">(</span><span class="nx">resolve</span><span class="p">,</span> <span class="nx">time</span> <span class="o">*</span> <span class="mi">1000</span><span class="p">));</span>
<span class="p">};</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting consumer...</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// connect &amp; open conversation</span>
    <span class="k">await</span> <span class="nx">connection1</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

    <span class="c1">// get and store the token</span>
    <span class="kd">const</span> <span class="nx">token</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection1</span><span class="p">.</span><span class="nx">getToken</span><span class="p">();</span>

    <span class="c1">// create conversation</span>
    <span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection1</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">();</span>
    <span class="kd">const</span> <span class="nx">conversationId</span> <span class="o">=</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">;</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Conversation #</span><span class="p">${</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> created!`</span><span class="p">);</span>

    <span class="c1">// send a message</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Example message #1 using the first connection</span><span class="dl">'</span><span class="p">);</span>

    <span class="k">await</span> <span class="nx">waitSeconds</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>

    <span class="c1">// close the first connection</span>
    <span class="k">await</span> <span class="nx">connection1</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">First connection closed!</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// open new connection with the same token</span>
    <span class="kd">const</span> <span class="nx">connection2</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
        <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
        <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
        <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
        <span class="nx">token</span><span class="p">,</span>
        <span class="na">waitForReady</span><span class="p">:</span> <span class="kc">true</span>
    <span class="p">});</span>

    <span class="k">await</span> <span class="nx">connection2</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Second connection created!</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// Find the conversation based on the conversation id, in case there are many conversations in the connection</span>
    <span class="kd">const</span> <span class="nx">conversation2</span> <span class="o">=</span> <span class="nb">Array</span><span class="p">.</span><span class="k">from</span><span class="p">(</span><span class="nx">connection2</span><span class="p">.</span><span class="nx">_conversations</span><span class="p">.</span><span class="nx">values</span><span class="p">()).</span><span class="nx">find</span><span class="p">((</span><span class="nx">conversation</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span> <span class="o">===</span> <span class="nx">conversationId</span><span class="p">);</span>
    <span class="k">await</span> <span class="nx">conversation2</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Example message #2 after reopening connection with the same token</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// close the second conversation</span>
    <span class="k">await</span> <span class="nx">conversation2</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>

    <span class="c1">// close the second connection</span>
    <span class="k">await</span> <span class="nx">connection2</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Second conversation and connection closed!</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="conversation-for-skill">Conversation for skill</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example creates a conversation for a specific skill only, and sends a message to it.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span>
<span class="p">});</span>


<span class="c1">// log any internal errors (auth errors, etc)</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting consumer...</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// connect &amp; open conversation</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Consumer connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// create conversation</span>
    <span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">({</span>
        <span class="na">skillId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">skillId</span>
    <span class="p">});</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Conversation created!</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// send a message</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Example message</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="conversation-for-language">Conversation for language</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example creates a connection and a conversation and subscribes to messages in a specific language.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="c1">// Make some Fake clientProperties</span>
<span class="kd">const</span> <span class="nx">clientProperties</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createClientProperties</span><span class="p">(</span><span class="nx">config</span><span class="p">.</span><span class="nx">clientProperties</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
    <span class="na">defaultSubscriptionQuery</span><span class="p">:</span> <span class="p">{</span>
        <span class="na">stage</span><span class="p">:</span> <span class="p">[</span><span class="dl">"</span><span class="s2">OPEN</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">CLOSE</span><span class="dl">"</span><span class="p">],</span>
    <span class="p">},</span>
    <span class="nx">clientProperties</span>
<span class="p">});</span>

<span class="kd">const</span> <span class="nx">context</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">type</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ConversationContextType</span><span class="p">.</span><span class="nx">SHARK</span><span class="p">,</span>
    <span class="na">lang</span><span class="p">:</span> <span class="dl">'</span><span class="s1">it-IT</span><span class="dl">'</span><span class="p">,</span> <span class="c1">//specify locale code for the language you want the conversation to be created</span>
    <span class="na">visitorId</span><span class="p">:</span> <span class="dl">''</span>
<span class="p">};</span>

<span class="c1">// log any internal errors (auth errors, etc)</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
<span class="p">});</span>

<span class="kd">const</span> <span class="nx">waitSeconds</span> <span class="o">=</span> <span class="p">(</span><span class="nx">time</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="k">return</span> <span class="k">new</span> <span class="nb">Promise</span><span class="p">((</span><span class="nx">resolve</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">setTimeout</span><span class="p">(</span><span class="nx">resolve</span><span class="p">,</span> <span class="nx">time</span> <span class="o">*</span> <span class="mi">1000</span><span class="p">));</span>
<span class="p">};</span>

<span class="p">(</span><span class="k">async</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting consumer...</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// connect &amp; open conversation</span>
    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Consumer connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// create conversation</span>
    <span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">({</span>
        <span class="nx">context</span>
    <span class="p">});</span>

    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">participant</span><span class="p">.</span><span class="nx">role</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">ParticipantRole</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">)</span> <span class="p">{</span>
            <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Message received - </span><span class="p">${</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
        <span class="p">}</span>
    <span class="p">});</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Conversation created!</span><span class="dl">'</span><span class="p">);</span>

    <span class="k">await</span> <span class="nx">waitSeconds</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span>

    <span class="c1">// send a message</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Tell me everything</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="multiple-conversations-with-threads">Multiple conversations with threads</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example demonstrates opening multiple consumer conversations concurrently using the
 * threads feature. Three conversations are created with different thread configurations
 * to verify that threadId is correctly assigned and isolated across conversations.
 *
 *   conversation1 — no thread option (default behaviour)
 *   conversation2 — thread: "-1" (auto-assigned thread)
 *   conversation3 — thread: "my-custom-thread" (explicit thread ID)
 *
 * Config file structure (config.json):
 * {
 *   "appId": "YOUR_APP_ID",
 *   "accountId": "YOUR_ACCOUNT_ID",
 *   "jwt": "YOUR_JWT_TOKEN"
 * }
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="k">async</span> <span class="kd">function</span> <span class="nx">runConversation</span><span class="p">(</span><span class="nx">conversation</span><span class="p">,</span> <span class="nx">name</span><span class="p">,</span> <span class="nx">connection</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`</span><span class="p">${</span><span class="nx">name</span><span class="p">}</span><span class="s2"> conversationId: `</span><span class="p">,</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">);</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`</span><span class="p">${</span><span class="nx">name</span><span class="p">}</span><span class="s2"> threadId: `</span><span class="p">,</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">threadId</span><span class="p">);</span>

    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">sentByCurrentUser</span><span class="p">())</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Message received in </span><span class="p">${</span><span class="nx">name</span><span class="p">}</span><span class="s2">: `</span><span class="p">,</span> <span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">agent asks to close</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
        <span class="p">}</span>
    <span class="p">});</span>

    <span class="k">try</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Starting to send messages for </span><span class="p">${</span><span class="nx">name</span><span class="p">}</span><span class="s2">...`</span><span class="p">);</span>
        <span class="k">for</span> <span class="p">(</span><span class="kd">let</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="s2">`Message from </span><span class="p">${</span><span class="nx">name</span><span class="p">}</span><span class="s2"> - </span><span class="p">${</span><span class="nx">i</span><span class="p">}</span><span class="s2">`</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Done sending messages for </span><span class="p">${</span><span class="nx">name</span><span class="p">}</span><span class="s2">.`</span><span class="p">);</span>
    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
        <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s2">`Error in </span><span class="p">${</span><span class="nx">name</span><span class="p">}</span><span class="s2">:`</span><span class="p">,</span> <span class="nx">error</span><span class="p">);</span>
        <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
        <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
    <span class="p">}</span>
<span class="p">}</span>

<span class="p">(</span><span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="kd">const</span> <span class="nx">clientProperties</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createClientProperties</span><span class="p">({</span>
        <span class="na">features</span><span class="p">:</span> <span class="p">[</span><span class="nx">lpm</span><span class="p">.</span><span class="nx">Features</span><span class="p">.</span><span class="nx">THREADS</span><span class="p">]</span>
    <span class="p">});</span>

    <span class="kd">const</span> <span class="nx">consumerConnection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
        <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span>
        <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
        <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
        <span class="na">jwt</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">jwt</span><span class="p">,</span>
        <span class="nx">clientProperties</span>
    <span class="p">});</span>

    <span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Consumer connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="kd">const</span> <span class="nx">conversation1</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">();</span>
    <span class="kd">const</span> <span class="nx">conversation2</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">({</span> <span class="na">thread</span><span class="p">:</span> <span class="dl">'</span><span class="s1">-1</span><span class="dl">'</span> <span class="p">});</span>
    <span class="kd">const</span> <span class="nx">conversation3</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">consumerConnection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">({</span> <span class="na">thread</span><span class="p">:</span> <span class="dl">'</span><span class="s1">my-custom-thread</span><span class="dl">'</span> <span class="p">});</span>

    <span class="k">await</span> <span class="nb">Promise</span><span class="p">.</span><span class="nx">all</span><span class="p">([</span>
        <span class="nx">runConversation</span><span class="p">(</span><span class="nx">conversation1</span><span class="p">,</span> <span class="dl">'</span><span class="s1">consumer 1</span><span class="dl">'</span><span class="p">,</span> <span class="nx">consumerConnection</span><span class="p">),</span>
        <span class="nx">runConversation</span><span class="p">(</span><span class="nx">conversation2</span><span class="p">,</span> <span class="dl">'</span><span class="s1">consumer 2</span><span class="dl">'</span><span class="p">,</span> <span class="nx">consumerConnection</span><span class="p">),</span>
        <span class="nx">runConversation</span><span class="p">(</span><span class="nx">conversation3</span><span class="p">,</span> <span class="dl">'</span><span class="s1">consumer 3</span><span class="dl">'</span><span class="p">,</span> <span class="nx">consumerConnection</span><span class="p">),</span>
    <span class="p">]);</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">All conversations done.</span><span class="dl">'</span><span class="p">);</span>
    <span class="nx">process</span><span class="p">.</span><span class="nx">exit</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

<h3 id="authenticated-connection">Authenticated connection</h3>

<div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="cm">/**
 * This example demonstrates how to create an authenticated consumer connection using a JWT.
 *
 * An authenticated consumer connection ties the conversation to a known identity in your
 * system. This is required when your platform issues JWTs for authenticated users (for example,
 * after a login flow). The JWT is passed to the SDK via the `jwt` option.
 *
 * The example:
 *   1. Opens an authenticated consumer connection with a JWT
 *   2. Creates a conversation
 *   3. Sends a message and listens for agent replies
 *   4. Closes the conversation and connection on the '#close' trigger
 *
 * Config file structure (config.json):
 * {
 *   "appId": "YOUR_APP_ID",
 *   "accountId": "YOUR_ACCOUNT_ID",
 *   "jwt": "YOUR_JWT_TOKEN"
 * }
 *
 * NOTE: The JWT must be issued by an identity provider configured for your LivePerson account.
 * If you do not have a JWT, omit the `jwt` option to fall back to an unauthenticated (anonymous)
 * consumer connection.
 */</span>

<span class="kd">const</span> <span class="nx">lpm</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">lp-messaging-sdk</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="dl">'</span><span class="s1">./config.json</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
    <span class="na">appId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">appId</span><span class="p">,</span> <span class="c1">// TODO: please change to something unique to your application</span>
    <span class="na">accountId</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">accountId</span><span class="p">,</span>
    <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">CONSUMER</span><span class="p">,</span>
    <span class="na">jwt</span><span class="p">:</span> <span class="nx">config</span><span class="p">.</span><span class="nx">jwt</span>      <span class="c1">// omit this line for an unauthenticated (anonymous) connection</span>
<span class="p">});</span>

<span class="c1">// log any internal errors (auth errors, etc)</span>
<span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connection error:</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span><span class="p">);</span>
<span class="p">});</span>

<span class="p">(</span><span class="k">async</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">{</span>
    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Connecting authenticated consumer...</span><span class="dl">'</span><span class="p">);</span>

    <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Authenticated consumer connected!</span><span class="dl">'</span><span class="p">);</span>

    <span class="c1">// create conversation</span>
    <span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createConversation</span><span class="p">();</span>

    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">`Conversation </span><span class="p">${</span><span class="nx">conversation</span><span class="p">.</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> created!`</span><span class="p">);</span>

    <span class="c1">// listen for agent replies</span>
    <span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">message</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">message</span> <span class="o">=&gt;</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">sentByCurrentUser</span><span class="p">())</span> <span class="k">return</span><span class="p">;</span>

        <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Agent:</span><span class="dl">'</span><span class="p">,</span> <span class="nx">message</span><span class="p">.</span><span class="nx">body</span><span class="p">);</span>

        <span class="c1">// close on '#close' trigger from the agent side</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">message</span><span class="p">.</span><span class="nx">body</span> <span class="o">===</span> <span class="dl">'</span><span class="s1">#close</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
            <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">close</span><span class="p">();</span>
            <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">'</span><span class="s1">Conversation and connection closed!</span><span class="dl">'</span><span class="p">);</span>
        <span class="p">}</span>
    <span class="p">});</span>

    <span class="c1">// send the opening message</span>
    <span class="k">await</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">sendMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Hello, I am an authenticated consumer.</span><span class="dl">'</span><span class="p">);</span>
<span class="p">})();</span>
</code></pre></div></div>

]]></description>
      <!-- <pubDate>Tue, 02 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Changelog</title>
      <link>https://developers.liveperson.com/messaging-platform-sdk-changelog.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/messaging-platform-sdk-changelog.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h1 id="changelog-for-messaging-platform-sdk">Changelog for Messaging Platform SDK</h1>
<h1 id="1202">1.20.2</h1>
<p><sub>Publish Date: 14th of April 2026</sub></p>

<p>Changes:</p>

<ul>
  <li><em>Conversation-scoped <code class="language-html highlighter-rouge">getUserProfile</code></em>: <code class="language-html highlighter-rouge">getUserProfile</code> now accepts an optional <code class="language-html highlighter-rouge">conversationId</code> parameter. When provided, the server returns the user profile snapshot scoped to that specific conversation (the profile state at the time the conversation was created). This is particularly useful for brand agents handling consumers with multiple open conversations (e.g. when using <code class="language-html highlighter-rouge">threadId</code>). The <code class="language-html highlighter-rouge">conversationId</code> is automatically passed when calling <code class="language-html highlighter-rouge">getUserProfile</code> on a conversation participant.</li>
</ul>

<h1 id="1201">1.20.1</h1>
<p><sub>Publish Date: 6th of April 2026</sub></p>

<p>Bug fixes:</p>
<ul>
  <li><em>Fix real-time notification stall after reconnect timeout</em>: When the SDK reconnected and UMS failed to deliver the initial <code class="language-html highlighter-rouge">deferred</code> notification within 60 seconds, <code class="language-html highlighter-rouge">_waitForDeferred</code> was left as a permanently unresolved Promise. Every subsequent real-time notification would hang on <code class="language-html highlighter-rouge">await _waitForDeferred</code>, delivering zero events despite the SDK reporting <code class="language-html highlighter-rouge">CONNECTED</code>. The Promise is now force-resolved when the ready timeout fires, unblocking all queued notifications. A late-arriving deferred notification is still applied correctly if UMS recovers.</li>
</ul>

<h1 id="1200">1.20.0</h1>
<p><sub>Publish Date: 24th of February 2026</sub></p>

<p>Changes:</p>

<ul>
  <li><em>Threaded Conversations</em>: Added support for threaded conversations. Consumers can now have multiple open conversations with a brand by providing a <code class="language-html highlighter-rouge">thread</code> identifier when creating a conversation. This requires the <code class="language-html highlighter-rouge">THREADS</code> feature to be enabled in <code class="language-html highlighter-rouge">clientProperties</code>.</li>
  <li><em>REST API Updates</em>: Updated <code class="language-html highlighter-rouge">agentRequestConversation</code> to support <code class="language-html highlighter-rouge">consumerId</code> and <code class="language-html highlighter-rouge">threadId</code>.</li>
  <li><em>getConversationById</em>: Updated to return <code class="language-html highlighter-rouge">threadId</code> in the conversation object.</li>
</ul>

<h1 id="1193">1.19.3</h1>
<p><sub>Publish Date: 20th of January 2026</sub></p>

<p>Bug fixes:</p>
<ul>
  <li><em>Web Build</em>: Fixed the web build of the SDK. It is now possible to build a web bundle and use the SDK in the browser. <strong>Note</strong>: It is recommended to only create consumer connections in the browser environment. Brand connections require secrets and tokens which should not be exposed on the client side.</li>
</ul>

<h1 id="1192">1.19.2</h1>
<p><sub>Publish Date: 15th of January 2026</sub>
Changes:</p>

<ul>
  <li>No functional changes. Version bump due to a publishing issue in the previous release.</li>
</ul>

<h1 id="1191">1.19.1</h1>
<p><sub>Publish Date: 24th of November 2025</sub>
Changes:</p>

<ul>
  <li>Security: Updated vulnerable dependencies via <code class="language-html highlighter-rouge">npm audit fix</code>. No functional changes to the SDK.</li>
</ul>

<h1 id="1190">1.19.0</h1>
<p><sub>Publish Date: 14th of July 2025</sub></p>

<p>Changes:</p>
<ul>
  <li><em>Improve resilience by retrying on 429 (Too many requests) errors</em>: The SDK now includes a retry when a 429 error is 
returned by the backend for WebSocket or REST requests. The mechanism uses a scheduled backoff strategy with the 
following intervals between attempts: 1, 1, 1, 5, 5, 5, 10, 10, 10, 60, 120, 240 seconds, for a total  of 12 attempts.</li>
  <li><em>Increase fetch rate for conversation not in cache</em>: When a conversation is not in the cache, it is being fetched from 
the REST API. Previous to this release, a new token was generated for each conversation. This change reuses the token 
created for the WebSocket connection, bypassing the token creation.</li>
  <li><em>Improve logging for unknown subscriptions</em>: When notifications are received for a subscription unknown to the SDK,
an error is emitted. Before this change, the error just contained the subscription id. Now, the whole event is added.</li>
</ul>

<p>Bug fixes:</p>
<ul>
  <li>Messages are not dropped when a sub-dialog closes and the conversation stays open. For example, after a CoBrowse session, 
callbacks on the conversation will receive further messages. Previous to this fix, these messages were ignored.</li>
</ul>

<h1 id="1181">1.18.1</h1>

<p><sub>Publish Date: 12th of May 2025</sub></p>

<p>Changes:</p>

<ul>
  <li><em>Set agents offline upon disconnect</em>: Added configuration flag <code class="language-html highlighter-rouge">setAgentOfflineOnDisconnect</code> to control whether to 
keep the agent ONLINE upon disconnect or not.</li>
</ul>

<p>Bug fixes:</p>

<ul>
  <li>Added CSDS support for QA accounts starting with cc.</li>
  <li>Do not emit an error under reconnect when OAuth 2 credentials are used.</li>
  <li>Updated browserify dependencies to mitigate <a href="https://www.cve.org/CVERecord?id=CVE-2024-48948">CVE-2024-48948</a></li>
</ul>

<h1 id="1180">1.18.0</h1>

<p><sub>Publish Date: 31st of March 2025</sub></p>

<p>Changes:</p>

<ul>
  <li><em>Conversation Not in Cache</em>: The SDK now handles cases where a content event is received before the corresponding 
conversation is present in the cache. This can occur because backend systems may send events out of order. In such 
scenarios, the SDK will first wait one second for the conversation to arrive, and if it doesn’t, it will perform an 
API call to fetch the conversation. An error is emitted if both strategies fail.</li>
  <li><em>ChatState Event for Unknown Participant</em>: The SDK now handles cases where a chat state event is received for a 
participant unknown to the SDK. If the participant was previously removed, a warning is emitted and the event is 
ignored. If the chat state event arrives before the corresponding conversation update, the SDK waits one second for the
update. If the participant is still unknown after that, an error is emitted.</li>
</ul>

<h1 id="1171">1.17.1</h1>

<p><sub>Publish Date: 05th of February 2025</sub></p>

<p>Bug Fixes:</p>

<ul>
  <li>Properly check if there is a conversation callback set up before delete a conversation from the cache which could cause the bot to fail.</li>
</ul>

<h1 id="1170">1.17.0</h1>

<p><sub>Publish Date: 31st of January 2025</sub></p>

<p>Changes:</p>

<ul>
  <li><em>Combined conversation handling</em>: The SDK now streamlines conversation processing by coordinating events triggered 
either when a <code class="language-html highlighter-rouge">conversation</code> event occurs or when a <code class="language-html highlighter-rouge">ring</code> is accepted. This ensures that each conversation is processed 
only once. For more details, please refer to the <a href="messaging-platform-sdk-overview.html#combined-conversation-handling">documentation</a>.</li>
</ul>

<p>Bug Fixes:</p>

<ul>
  <li><em>Queue requests on SDK reconnect</em>: When the SDK is reconnecting, requests were not queued before this change. Now, 
requests are queued and sent once the connection is reestablished.</li>
  <li><em>Client-Source header for REST API calls</em>: A Client-source header is added as a parameter when a REST requests are 
made. Defaults to lp-messaging-sdk-{accountId}.</li>
</ul>

<h1 id="1160">1.16.0</h1>

<p><sub>Publish Date: 16th of December 2024</sub></p>

<p>Changes:</p>

<ul>
  <li><em>Add message event to error when conversation is not in cache</em>: If a message event arrived before the conversation change 
event, the message event will not be emitted on the conversation because the conversation does not yet exist in the SDK. 
This <code class="language-html highlighter-rouge">conversation not found in cache</code> error now carries the raw <code class="language-html highlighter-rouge">event</code> and can be processed. See
<a href="messaging-platform-sdk-overview.html#error-handling">error-handling</a>.</li>
  <li><em>Added example for responding to all messages on restart or disconnect</em>: See 
<a href="messaging-platform-sdk-examples.html#respond-to-all-messages-on-restart-or-disconnect-with-a-downtime">respond to all messages if there is a downtime or restart/reconnect</a></li>
  <li><em>Added third party bot example</em>: One of the most common use cases for the SDK is to create a bot that accepts 
conversations and performs actions based on those conversations. A detailed example has been added to demonstrate 
how this can be achieved. See the <a href="messaging-platform-sdk-examples.html#third-party-bot">third party bot</a>
example for more information.</li>
</ul>

<p>Bug Fixes:</p>

<ul>
  <li><em>Emit error in dialog#queryMessages instead of throwing one</em>: The dialog allows you to query its messages from the 
backend. However, if the corresponding conversation was already closed or removed, then an error was thrown which
causes the SDK to stop. Instead of throwing the error, it is now emitted as error on the dialog, conversation and 
corresponding connection.</li>
</ul>

<h1 id="1150">1.15.0</h1>

<p><sub>Publish Date: 25th of July 2024</sub></p>

<p>Changes:</p>

<ul>
  <li><em>Adding oAuth2 authentication support</em>: This release offers a new brand authentication mechanism using oAuth2. For more 
information please refer to the documentation about 
<a href="messaging-platform-sdk-overview.html#different-authentication-mechanisms">different authentication mechanisms</a>.</li>
</ul>

<h1 id="1141">1.14.1</h1>

<p><sub>Publish Date: 4th of July 2024</sub></p>

<p>Changes:</p>

<ul>
  <li><em>Brand authentication using agent session data</em>: This release offers a new brand authentication mechanism using agent
session data. For more information please refer to the documentation about
<a href="messaging-platform-sdk-overview.html#brand-authentication-with-existing-bearer-token">brand authentication with existing bearer token</a>.</li>
  <li><em>Brand Authentication using TokenMaintainer</em>: Authentication information can now be shared between multiple brand<br />
connections. For more information please refer to the documentation about
<a href="messaging-platform-sdk-overview.html#brand-authentication-using-tokenmaintainer">brand authentication using TokenMaintainer</a>.</li>
  <li><em>Emit warning instead of error when conversation is missing during delete</em>: When a delete notification is received for
an already closed conversation, a warning is  emitted instead of an error. This change was made because it is possible
for the conversation close event to be received before the last message.</li>
</ul>

<h1 id="1140">1.14.0</h1>

<p><sub>Publish Date: 11th of June 2024</sub></p>

<p>Changes:</p>
<ul>
  <li><em>Detailed subscription query documentation</em>: All possible <a href="messaging-platform-sdk-overview.html#query-properties">query properties</a>
are now explained and examples are provided.</li>
  <li><em>Enhance get last consumer message example</em>: The example does not pause execution while waiting for a conversation.
See <a href="messaging-platform-sdk-examples.html#get-last-consumer-message">get last consumer message</a></li>
</ul>

<p>Bug Fixes:</p>
<ul>
  <li><em>No message subscription for closed conversations</em>: When a closed conversation is received on a consumer connection,
there is no open dialog. The SDK will not subscribe to any message events of any closed conversations. This fixes, the
error when a consumer closed a conversation and a step-up is performed on a new conversation.</li>
  <li><em>Updated dependencies</em>: Updated dependencies to versions which stay compatible with node version 16.</li>
</ul>

<h1 id="1130">1.13.0</h1>

<p><sub>Publish Date: 4th of April 2024</sub></p>

<p>Changes:</p>

<ul>
  <li><em>Consumer authentication and step up</em>. This release changes how consumers can establish an authenticated connection. By 
default, consumers connections are unauthenticated and sometimes anonymous. For certain actions a brand has to verify 
the authenticity of a consumer. This verification can be done in two ways: Establish an authenticated connection or 
step up an unauthenticated one. For both  of these cases a JSON Web Token is necessary. For more information please 
refer to the documentation about
<a href="messaging-platform-sdk-overview.html#consumer-auth-flow">consumer auth flow</a> and
<a href="messaging-platform-sdk-overview.html#consumer-step-up">consumer step up</a>. <strong>Note</strong>: 
If you have been using authenticated connections before this change, you need to adapt your implementation. The changes 
are explained in the consumer auth flow documentation.</li>
  <li><em>Code examples</em>. Starting from this release <a href="messaging-platform-sdk-examples.html">code examples</a> for brand and consumer
use cases are documented.</li>
</ul>

<p>Bug Fixes:</p>
<ul>
  <li><em>Transfers to agents are more robust</em>. When a conversation is transferred to a different agent, the agent id is always 
sent in the following format <code class="language-html highlighter-rouge">accountId.agentId</code>.</li>
</ul>

<h1 id="11213">1.12.13</h1>
<p><sub>Publish Date: 28th of February 2024</sub></p>

<p>Bug Fixes:</p>
<ul>
  <li>Fixing missing messageAudience for the latest message while calling the <code class="language-html highlighter-rouge">queryMessages</code> method. Instead of
<code class="language-html highlighter-rouge">null</code> the correct audience of the message will be returned.</li>
  <li>Adding content-type header when using uploadFile method. Previews for preview able file types, for example PNG, are now
properly created for conversations.</li>
</ul>

<h1 id="11212">1.12.12</h1>
<p><sub>Publish Date: 7th of February 2024</sub></p>

<p>Bug Fixes:</p>
<ul>
  <li>Fixed typo when emitting a warning about outdated conversations over a certain threshold. For example, if there were 
200 outdated conversations for account <code class="language-html highlighter-rouge">accountId1</code>, the connection will emit a warning in the following way:
    <div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">warning</span><span class="dl">'</span><span class="p">,</span> <span class="nx">msg</span> <span class="o">=&gt;</span> <span class="p">{</span>
   <span class="nx">expect</span><span class="p">(</span><span class="nx">message</span><span class="p">).</span><span class="nx">toEqual</span><span class="p">(</span><span class="dl">'</span><span class="s1">200 outdated conversations found for account accountId1, which is above the threshold of 100.</span><span class="dl">'</span><span class="p">);</span>
<span class="p">});</span>
</code></pre></div>    </div>
  </li>
</ul>

<h1 id="11211">1.12.11</h1>
<p><sub>Publish Date: 5th of February 2024</sub></p>

<p>Bug Fixes:</p>
<ul>
  <li>Added configuration parameter <code class="language-html highlighter-rouge">unsubscribeFromOutdatedConversationsOnReconnect</code> (defaults to true) whether to close 
outdated conversations on reconnect or not. True is recommended, but should be set to false if issues with lost 
messages are encountered. For example:
    <div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span>
  <span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span>
  <span class="nx">accountId</span><span class="p">,</span>
  <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span>
  <span class="nx">authData</span><span class="p">,</span>
  <span class="na">unsubscribeFromOutdatedConversationsOnReconnect</span><span class="p">:</span> <span class="kc">false</span>
<span class="p">});</span>
</code></pre></div>    </div>
    <p>More information can be found in the <a href="messaging-platform-sdk-overview.html#connection-maintenance">documentation</a>.</p>
  </li>
</ul>

<h1 id="11210">1.12.10</h1>
<p><sub>Publish Date: 30th of January 2024</sub></p>

<p>Bug Fixes:</p>
<ul>
  <li>Updated URL path for all message/conversation related REST endpoints. From <code class="language-html highlighter-rouge">/v1/conversations/</code> to <code class="language-html highlighter-rouge">/messaging/v1/conversations/</code>.</li>
  <li>Fixed issue with <code class="language-html highlighter-rouge">agentId</code> being null if message is sent by an agent that has been removed from the 
conversation before the connection. The <code class="language-html highlighter-rouge">agentId</code> now contains the right <code class="language-html highlighter-rouge">agentId</code>.</li>
</ul>

<h1 id="1129">1.12.9</h1>
<p><sub>Publish Date: 17th of January 2024</sub></p>

<p>Changes:</p>
<ul>
  <li>Adding anonymous  async function as param of the ring which could be resolved if rings need to use directly the conversation</li>
  <li>Adding <code class="language-html highlighter-rouge">ringConversationTimeout</code> param to <code class="language-html highlighter-rouge">createConnection</code> so brands can configure it.</li>
  <li>Adding <code class="language-html highlighter-rouge">conversation.getLatestConsumerMessage()</code> to allow brand users to get latest consumer message.</li>
</ul>

<p>Example:</p>
<ul>
  <li>The code below showcases how a conversation can be accepted on the ring and how to retrieve the last consumer message:
    <div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code>  <span class="c1">// connect as admin for brand</span>
  <span class="kd">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">createConnection</span><span class="p">({</span><span class="na">appId</span><span class="p">:</span> <span class="dl">'</span><span class="s1">quick_start</span><span class="dl">'</span><span class="p">,</span> <span class="na">userType</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">UserType</span><span class="p">.</span><span class="nx">BRAND</span><span class="p">,</span> <span class="nx">accountId</span><span class="p">,</span> <span class="nx">authData</span><span class="p">,</span> <span class="na">ringConversationTimeout</span><span class="p">:</span> <span class="mi">2000</span><span class="p">});</span>
  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">open</span><span class="p">();</span>
    
  <span class="c1">// agent state must be "ONLINE" in order to receive rings</span>
  <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">setAgentState</span><span class="p">({</span><span class="na">agentState</span><span class="p">:</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">AgentState</span><span class="p">.</span><span class="nx">ONLINE</span><span class="p">});</span>
    
  <span class="c1">// subscribe to routing tasks (rings)</span>
  <span class="kd">const</span> <span class="nx">taskRoutingSubscription</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">createRoutingTaskSubscription</span><span class="p">();</span>
    
  <span class="c1">// process the rings as they arrive</span>
  <span class="nx">connection</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">ring</span><span class="dl">'</span><span class="p">,</span> <span class="k">async</span> <span class="nx">ring</span> <span class="o">=&gt;</span> <span class="p">{</span>
    
      <span class="c1">// ignore old rings</span>
      <span class="k">if</span> <span class="p">(</span><span class="nx">ring</span><span class="p">.</span><span class="nx">ringState</span> <span class="o">!==</span> <span class="nx">lpm</span><span class="p">.</span><span class="nx">RingState</span><span class="p">.</span><span class="nx">WAITING</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
        
      <span class="c1">// accept the ring</span>
      <span class="k">await</span> <span class="nx">ring</span><span class="p">.</span><span class="nx">accept</span><span class="p">();</span>
    
      <span class="c1">// await conversation or null if waiting times out after 2000 ms</span>
      <span class="kd">const</span> <span class="nx">conversation</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">ring</span><span class="p">.</span><span class="nx">conversation</span><span class="p">();</span>
        
      <span class="c1">// Get the latest consumer message</span>
      <span class="kd">const</span> <span class="nx">latestConsumerMessage</span> <span class="o">=</span> <span class="nx">conversation</span><span class="p">.</span><span class="nx">getLatestConsumerMessage</span><span class="p">();</span>
  <span class="p">});</span>
</code></pre></div>    </div>
    <p>More information can be found in the <a href="messaging-platform-sdk-overview.html#accepting-conversation-on-the-ring">documentation</a>.</p>
  </li>
</ul>

<h1 id="1128">1.12.8</h1>
<p><sub>Publish Date: 15th of January 2024</sub></p>

<p>Bug Fixes:</p>
<ul>
  <li>Fixed issue with consumer connection not properly reflecting assigned agent change on skill transfer.</li>
  <li><code class="language-html highlighter-rouge">conversation-deleted</code> now emitted when <code class="language-html highlighter-rouge">DELETE</code> notification is received, previously this was only emitted when a 
conversation was removed during disconnect.</li>
</ul>

<h1 id="1127">1.12.7</h1>
<p><sub>Publish Date: 9th of January 2024</sub></p>

<p>Bug Fixes:</p>
<ul>
  <li>Bumped axios version to 1.6.5 due to security vulnerabilities.</li>
</ul>

<h1 id="1126">1.12.6</h1>
<p><sub>Publish Date: 12th of December 2023</sub></p>

<p>Bug Fixes:</p>
<ul>
  <li>Adding check for existing dialog before trying to transfer conversation on the <code class="language-html highlighter-rouge">transfer</code> method. If there is no open
dialog an <code class="language-html highlighter-rouge">error</code> will be emitted:
    <div class="language-js highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">conversation</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="dl">'</span><span class="s1">error</span><span class="dl">'</span><span class="p">,</span> <span class="nx">err</span> <span class="o">=&gt;</span> <span class="nx">expect</span><span class="p">(</span><span class="nx">err</span><span class="p">.</span><span class="nx">message</span><span class="p">).</span><span class="nx">toEqual</span><span class="p">(</span><span class="dl">'</span><span class="s1">Cannot transfer without open dialog present.</span><span class="dl">'</span><span class="p">));</span>
</code></pre></div>    </div>
  </li>
</ul>

<h1 id="1125">1.12.5</h1>
<p><sub>Publish Date: 7th of December 2023</sub></p>

<p>Bug Fixes:</p>
<ul>
  <li>Omit Accept-Encoding header when invoking UMS REST API</li>
</ul>

<h1 id="1124">1.12.4</h1>
<p><sub>Publish Date: 6th of December 2023</sub></p>

<p>Bug Fixes:</p>
<ul>
  <li>Support additional query parameters for <code class="language-html highlighter-rouge">getMessages</code> in <code class="language-html highlighter-rouge">BrandRestConnection</code></li>
</ul>

<h1 id="1123">1.12.3</h1>
<p><sub>Publish Date: 28th of November 2023</sub></p>

<p>Bug Fixes:</p>
<ul>
  <li>Fixing proxy web socket connection configuration issue</li>
</ul>

<h1 id="1122">1.12.2</h1>
<p><sub>Publish Date: 22nd of November 2023</sub></p>

<p>Changes:</p>
<ul>
  <li>Adding <code class="language-html highlighter-rouge">responseTimeout</code> param to <code class="language-html highlighter-rouge">createConnection</code> so brands can configure it.</li>
</ul>

<h1 id="1121">1.12.1</h1>
<p><sub>Publish Date: 10th of November 2023</sub></p>

<p>Changes:</p>
<ul>
  <li>Add support for proxy http request</li>
</ul>

<p>Bug Fixes:</p>
<ul>
  <li>Fix documenting example inside of the README about <code class="language-html highlighter-rouge">createConversationSubscription</code></li>
</ul>

<h1 id="1113">1.11.3</h1>
<ul>
  <li>Fixing missing metadata for some messages while calling the <code class="language-html highlighter-rouge">queryMessages</code> method.</li>
</ul>

<h1 id="1112">1.11.2</h1>
<ul>
  <li>Fix a race condition when creating a new conversation which caused some conversations to have multiple conversation objects</li>
  <li>add <code class="language-html highlighter-rouge">originatorId</code> and <code class="language-html highlighter-rouge">originatorRole</code> as optional args for the rest <code class="language-html highlighter-rouge">publishMessage</code></li>
</ul>

<h1 id="1111">1.11.1</h1>
<ul>
  <li>RoutingTaskSubscriptions are now restored upon reconnect.</li>
</ul>

<h1 id="1110">1.11.0</h1>
<ul>
  <li>For Brand Rest Connections, getConversationById will now make a fetch call, parse the data, and return a conversation object. Previously it would only return the raw result of the HTTP request.</li>
</ul>

<h1 id="1100">1.10.0</h1>
<ul>
  <li>Added <code class="language-html highlighter-rouge">await connection.getMessageStatisticsForUser()</code> and <code class="language-html highlighter-rouge">await connection.getMessageStatisticsForBrand()</code> to allow brand users to get message statistics information.</li>
  <li>Added <code class="language-html highlighter-rouge">conversation.resumeConversation()</code> to allow brand users to resume previously closed conversation with a consumer.</li>
  <li>Added <code class="language-html highlighter-rouge">connection.on('failed-to-connect')</code> event which will fire when moving to FAILED_TO_CONNECT state, ie when failed attempt occurs while trying to establish websocket connection.</li>
</ul>

<h2 id="196">1.9.6</h2>
<ul>
  <li><code class="language-html highlighter-rouge">connection.closeConversation(conversationId)</code> is now available. With this function conversations can be closed without a conversation object.</li>
</ul>

<h2 id="195">1.9.5</h2>
<ul>
  <li><code class="language-html highlighter-rouge">Conversation.assignedAgent</code> should return active assigned agent only. Also handled edge case where suggested agents do not have <code class="language-html highlighter-rouge">userId</code></li>
</ul>

<h2 id="194">1.9.4</h2>
<ul>
  <li>Fix <code class="language-html highlighter-rouge">chatStateEvent for unknown participant undefined</code> error after moving message originator transformation in <code class="language-html highlighter-rouge">1.9.2</code></li>
</ul>

<h2 id="193">1.9.3</h2>
<ul>
  <li>Exposed <code class="language-html highlighter-rouge">TTRType</code> enum</li>
  <li>Added <code class="language-html highlighter-rouge">message.sentByCurrentUser</code> method to the Message class</li>
  <li>Added <code class="language-html highlighter-rouge">getConversationById</code> &amp; <code class="language-html highlighter-rouge">getAllKnownConversations</code> methods to <code class="language-html highlighter-rouge">Connection</code></li>
  <li>Added <code class="language-html highlighter-rouge">notificationType</code> of <code class="language-html highlighter-rouge">child</code> for deferred notifications from child subscriptions</li>
</ul>

<h2 id="192">1.9.2</h2>
<ul>
  <li>Move message originator transformation from <code class="language-html highlighter-rouge">connection</code> to <code class="language-html highlighter-rouge">MessageFactory</code>, fixes issues where <code class="language-html highlighter-rouge">Message</code> objects created from <code class="language-html highlighter-rouge">lastContentEventNotification</code> and <code class="language-html highlighter-rouge">queryMessages</code> did not have the correct sender</li>
</ul>

<h2 id="191">1.9.1</h2>
<ul>
  <li>Use <code class="language-html highlighter-rouge">HTTPS</code> for the <code class="language-html highlighter-rouge">baseURI</code> call to <code class="language-html highlighter-rouge">CSDS</code></li>
</ul>

<h2 id="190">1.9.0</h2>
<ul>
  <li>Rename <code class="language-html highlighter-rouge">waitForFirstNotification</code> to <code class="language-html highlighter-rouge">waitForReady</code>. <code class="language-html highlighter-rouge">waitForFirstNotification</code> will still function to ensure backwards compatibility, but is now deprecated.</li>
  <li>Use of <code class="language-html highlighter-rouge">notificationType</code> in <code class="language-html highlighter-rouge">ConversationSubscription</code> to determine notification type, fixes issues around <code class="language-html highlighter-rouge">onFirstNotification</code> and child subscriptions</li>
  <li><code class="language-html highlighter-rouge">userId</code> for brand connections is now userId uuid, rather than the un-prefixed <code class="language-html highlighter-rouge">agentId</code></li>
  <li>Fix <code class="language-html highlighter-rouge">limit-break</code> chain for subscriptions with more than 2002 conversations</li>
</ul>

<h2 id="182">1.8.2</h2>
<ul>
  <li>Truncate <code class="language-html highlighter-rouge">setAgentNote</code> to 5000-character limit, throw error if note cannot be added</li>
</ul>

<h2 id="181">1.8.1</h2>
<ul>
  <li>Don't delete lastContentEventNotification when emitting it to subscriptions</li>
  <li>Update participant role when they are removed and then re-added</li>
</ul>

<h2 id="180">1.8.0</h2>
<ul>
  <li>Add <code class="language-html highlighter-rouge">setAgentNote</code> method to conversation, which deprecates <code class="language-html highlighter-rouge">setNote</code></li>
  <li><code class="language-html highlighter-rouge">BrandWebsocketConnection</code> now has <code class="language-html highlighter-rouge">userProfile</code> parameter, available after opening the connection</li>
  <li>Fix to allow connection with existing unauthenticated token to step up</li>
  <li>Added documentation for continuing an anonymous user session between two connections</li>
</ul>

<h2 id="172">1.7.2</h2>
<ul>
  <li>Add <code class="language-html highlighter-rouge">consumer-step-up</code> event to the conversation</li>
</ul>

<h2 id="171">1.7.1</h2>
<ul>
  <li>Removed reference to a test module that was preventing code execution</li>
</ul>

<h2 id="170">1.7.0</h2>
<ul>
  <li>File sharing - Upload and Download for both node.js and browser</li>
  <li>Authenticated consumer flow</li>
  <li>Consumer stepup via <code class="language-html highlighter-rouge">connection.stepUp()</code> function</li>
  <li><code class="language-html highlighter-rouge">participant.getUserProfile()</code> is now available</li>
  <li><code class="language-html highlighter-rouge">dialog.leave()</code> and <code class="language-html highlighter-rouge">conversation.leave()</code> are now available</li>
  <li>Arbitrary websocket requests with <code class="language-html highlighter-rouge">connection.send()</code></li>
  <li>Listen to all websocket notifications via <code class="language-html highlighter-rouge">connection.on('notification')</code></li>
  <li>Expanded documentation</li>
</ul>

<h2 id="166">1.6.6</h2>
<ul>
  <li>added <code class="language-html highlighter-rouge">conversation.consumer</code> getter to help get the conversation's consumer participant</li>
</ul>

<h2 id="165">1.6.5</h2>
<ul>
  <li>Fixed bug in 1001 conversation limit break for LP originating disconnects</li>
  <li>Lower default max reconnection time limit from 4 hours to 10 minutes</li>
</ul>

<h2 id="164">1.6.4</h2>
<ul>
  <li>Bug fixes
    <ul>
      <li>When reconnecting, only drop conversations that have actually been closed while we were disconnected</li>
      <li>When a conversation is dropped for any reason and it is later seen in a notification, re-add it to the cache</li>
    </ul>
  </li>
</ul>

<h2 id="163">1.6.3</h2>
<ul>
  <li>Added <code class="language-html highlighter-rouge">assignedAgent</code> getter to <code class="language-html highlighter-rouge">Conversation</code> class</li>
</ul>

<h2 id="162">1.6.2</h2>
<ul>
  <li>Update appId with correct capitalization</li>
</ul>

<h2 id="161">1.6.1</h2>
<ul>
  <li>appId must be limited to alphanumeric plus special characters -_.</li>
</ul>

<h2 id="160">1.6.0</h2>
<ul>
  <li><strong>MA-238</strong> appId is now a required argument when calling createConnection</li>
</ul>

<h2 id="157">1.5.7</h2>
<ul>
  <li>Handle notifications that have missing <code class="language-html highlighter-rouge">participantsDetails</code></li>
</ul>

<h2 id="155">1.5.5</h2>
<ul>
  <li>Add support for quickReplies, available by setting the third argument on sendMessage and sendRichText <code class="language-html highlighter-rouge">conversation.sendMessage('test', null, quickReplies);</code></li>
</ul>

<h2 id="154">1.5.4</h2>
<ul>
  <li>Pass through getShiftStatus#response &amp; getShiftStatus#error events to the connection</li>
</ul>

<h2 id="153">1.5.3</h2>
<ul>
  <li>TokenMaintainer fixes - prevent caching token generation errors to allow reconnections</li>
  <li>getToken now blocks until token generation succeeds or TokenMaintainer is stopped</li>
</ul>

<h2 id="152">1.5.2</h2>
<ul>
  <li><strong>CO-6234</strong>: Add APIs to change TTR and ManualETTR of a conversation, which consequently emits <code class="language-html highlighter-rouge">ttr-change</code> and <code class="language-html highlighter-rouge">manual-ettr-change</code> events respectively</li>
  <li>Whitelist <code class="language-html highlighter-rouge">dialog:close</code> event and bubble up to conversation &amp; connection</li>
</ul>

<h2 id="151">1.5.1</h2>
<ul>
  <li><strong>CO-6394</strong>: fix for conversation.sendRichText, metadata was populated with message audience</li>
  <li>expose ConversationContextType, add conversationContext and campaignInfo to readme</li>
</ul>

<h2 id="150">1.5.0</h2>
<ul>
  <li>shift-status polling now encapsulated and exposed in <code class="language-html highlighter-rouge">lpmsdk.ShiftStatusPoller</code></li>
  <li>rest helper functions exposed through <code class="language-html highlighter-rouge">lpmsdk.rest</code></li>
</ul>

<h2 id="146">1.4.6</h2>
<ul>
  <li>Bubble up dialog and conversation events to the connection. These will have a <code class="language-html highlighter-rouge">conversation:</code> prefix to them e.g. <code class="language-html highlighter-rouge">conversation:close</code></li>
  <li>Minor refactor of <code class="language-html highlighter-rouge">refreshSession</code> internal method</li>
</ul>

<h2 id="145">1.4.5</h2>
<ul>
  <li>Fix for serialization of rich content events</li>
</ul>

<h2 id="144">1.4.4</h2>
<ul>
  <li><code class="language-html highlighter-rouge">TokenMaintainer</code> ctor now expects an object. Also added <code class="language-html highlighter-rouge">getAuthSessionInfo()</code> method and extended support for refreshing tokens when authSessionInfo is passed in ctor</li>
</ul>

<h2 id="143">1.4.3</h2>
<ul>
  <li><code class="language-html highlighter-rouge">loadConversation(serializedConversationData)</code> function on connection, which allows previously serialized conversations to be resumed by the connection.</li>
  <li><code class="language-html highlighter-rouge">unload()</code> function on conversation that allows a conversation to bemanually removed from the SDK's memory.</li>
</ul>

<h2 id="142">1.4.2</h2>
<ul>
  <li>Expose TokenMaintainer class</li>
</ul>

<h2 id="141">1.4.1</h2>
<ul>
  <li>Added a queue when processing onNotificationPart</li>
</ul>

<h2 id="140">1.4.0</h2>
<ul>
  <li><strong>CO-6062</strong>: Create ConversationNotificationFeed, WebhooksIntake, and NullConnection classes to consume notifications from webhooks/kafka. Accessed via <code class="language-html highlighter-rouge">connection.processWebhooksNotification(notification)</code></li>
</ul>

<h2 id="130">1.3.0</h2>
<ul>
  <li>Public documentation now available @ www.npmjs.com/package/lp-messaging-sdk</li>
  <li>Introduced TokenMaintainer class to keep bearer tokens valid</li>
  <li>TokenMaintainer now used in BrandWebsocketConnection &amp; BrandRestConnection</li>
  <li>Bug fixes for <code class="language-html highlighter-rouge">simple-websocket</code> library related to retrieving close and error codes</li>
  <li><strong>CO-6063</strong>: Add <code class="language-html highlighter-rouge">setCsat</code> function to conversation, available for consumers</li>
  <li><strong>CO-6099</strong>: Expose <code class="language-html highlighter-rouge">connection.getToken()</code> async method to obtain token from connection</li>
  <li><strong>CO-5613</strong>: Static <code class="language-html highlighter-rouge">deserialize</code> function to recreate a hydrated Conversation object from DB</li>
</ul>

<h2 id="1231">1.2.31</h2>
<ul>
  <li>add "consumer" getter helper to dialog</li>
  <li>expose ParticipantChatState enum</li>
</ul>

<h2 id="1230">1.2.30</h2>
<ul>
  <li><strong>CO-5950</strong>: Always create context and attach clientProperties</li>
</ul>

<h2 id="1229">1.2.29</h2>
<ul>
  <li><strong>CO-5989</strong>: Add setNote function to conversation</li>
</ul>

<h2 id="1228">1.2.28</h2>
<ul>
  <li><strong>CO-5907</strong>: Allow campaignInfo argument on createConversation to pass through correctly</li>
  <li><strong>CO-5880</strong>: RoutingTaskSubscriptions and Rings are now available</li>
  <li>Browser stand alone build is now available /web/lpm-sdk.js</li>
  <li>Websocket library "ws" has been replaced with "simple-websocket" for browser compatibility</li>
  <li><strong>CO-5987</strong>: use v2.1 of the WS API to allow suggested agents</li>
  <li>Increased default wait to reconnect time to 2 seconds, as per UMS recommendation</li>
</ul>

<h2 id="1223">1.2.23</h2>
<ul>
  <li>Added Conversation REST APIs under <code class="language-html highlighter-rouge">lib/api/rest/conversation</code></li>
</ul>

<h2 id="1222">1.2.22</h2>
<ul>
  <li>Minor fix so <code class="language-html highlighter-rouge">conversationContext</code> is passed in correctly when consumers create conversations</li>
</ul>

<h2 id="1219">1.2.19</h2>
<ul>
  <li>BrandWebsocketConnection now emits <code class="language-html highlighter-rouge">skill-entered-work-hours</code> and <code class="language-html highlighter-rouge">skill-entered-off-hours</code> for any of its skills</li>
</ul>

<h2 id="1218">1.2.18</h2>
<ul>
  <li>Allow access to <code class="language-html highlighter-rouge">ParticipantRole</code> enum</li>
  <li><strong>CO-5713</strong>: Added ability to attach metadata to messages in <code class="language-html highlighter-rouge">sendMessage</code>, <code class="language-html highlighter-rouge">sendPrivateMessage</code>, and <code class="language-html highlighter-rouge">sendRichText</code></li>
  <li><strong>CO-5612</strong>: <code class="language-html highlighter-rouge">serialize</code> method added for Conversation object to allow it to be persisted in DBs</li>
  <li>Added Messaging &amp; General REST APIs under <code class="language-html highlighter-rouge">lib/api/rest</code></li>
</ul>

<h2 id="1217">1.2.17</h2>
<ul>
  <li><strong>CO-5322</strong>: Subscriptions now have a process to get more than 1001 conversations, there is now no limit to the number 
of conversations. This feature is enabled by default, but can be disabled by passing <code class="language-html highlighter-rouge">limitBreakEnabled: 
false</code> as an option to <code class="language-html highlighter-rouge">createConnection</code></li>
  <li><strong>CO-5603</strong>: Removed errors when receiving duplicate read or accept message notifications from UMS</li>
  <li><strong>CO-5604</strong>: Fixed issue where onReconnect calls could be doubled up in certain scenarios</li>
</ul>

<h2 id="1214">1.2.14</h2>
<ul>
  <li><strong>CO-5512</strong>: <code class="language-html highlighter-rouge">maintainConnection</code> is now true by default when calling <code class="language-html highlighter-rouge">createConnection</code></li>
</ul>

<h2 id="1211">1.2.11</h2>
<ul>
  <li><strong>CO-4981</strong>: Added tracking info to WS connection URL params</li>
  <li><strong>CO-5532</strong>: Mock stepup: automatic consumer take over</li>
  <li><strong>CO-5463</strong>: Shift-status will now start and retrieve initial data before default subscription is created</li>
</ul>

<h2 id="1210">1.2.10</h2>
<ul>
  <li><strong>CO-5436</strong>: Skill.isInOffHours helper function</li>
</ul>

<h2 id="127">1.2.7</h2>
<ul>
  <li><strong>CO-5517</strong>: Conversation Deleted Event</li>
</ul>

<h2 id="125">1.2.5</h2>
<ul>
  <li><strong>CO-5295</strong>: Media Handler File upload requests</li>
  <li><strong>CO-5013</strong>: Wait for the first MS notification</li>
</ul>

<h2 id="124">1.2.4</h2>
<ul>
  <li><strong>CO-5322</strong>: Conversation subscriptions async .init() which must be called to create subscription</li>
</ul>

<h2 id="123">1.2.3</h2>
<ul>
  <li>_callShiftStatus now has a return value</li>
  <li><strong>CO-5321</strong>: dialog.getAll() retrieves all messages</li>
</ul>

<h2 id="122">1.2.2</h2>
<ul>
  <li><strong>CO-5470</strong>: Remove optional chaining parameter for compatibility with old versions of node.js</li>
  <li><strong>CO-5470</strong>: add wait option to createSubscription</li>
</ul>

<h2 id="121">1.2.1</h2>

<ul>
  <li><strong>CO-4978</strong>: dialog.setChatState function</li>
  <li>Shift-status poller</li>
</ul>

<h2 id="111">1.1.1</h2>

<ul>
  <li><strong>CO-4866</strong>: Resubscribe Subscriptions on Reconnect</li>
  <li><strong>CO-5232</strong>: Private messages</li>
  <li><strong>CO-5154</strong>: Support for Multiple Dialogs of the same Type</li>
</ul>
]]></description>
      <!-- <pubDate>Tue, 02 Jun 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Overview</title>
      <link>https://developers.liveperson.com/conversation-assist-overview.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-overview.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="watch-the-video">Watch the video</h3>

<iframe src="https://player.vimeo.com/video/1094174369?h=c044c195bd" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<h3 id="whats-conversation-assist">What's Conversation Assist?</h3>

<p>Conversation Assist offers recommended bots and answers to your agents inline in their conversations with consumers, and on-demand within a dedicated widget.</p>

<p><img width="400" alt="Animation showing inline recommendations being offered" src="img/agentassist/example2.gif" align="left" style="margin: 0 25px 0 0;" /></p>

<p>When your agents take advantage of these just-in-time recommendations, they become more efficient and save time. What's more, their conversational outcomes are improved and more consistent. Conversation Assist can even help to reduce the time to onboard new agents.</p>

<p>You can set up bot and answer recommendations in just a few clicks.</p>

<p>On the <strong>Home</strong> page of Conversation Assist, you'll find a dashboard of rich analytics, which you can use to continuously monitor and tune recommendation performance. Use this valuable data to understanding the impact that your solution is having on your agent operations.</p>

<p><img width="800" alt="View of the top of the Conversation Assist dashboard" src="img/agentassist/dashboard.png" /></p>

<p class="attn-note"><a href="conversation-assist-key-terms-concepts.html">Learn key concepts.</a></p>

<h3 id="access-conversation-assist">Access Conversation Assist</h3>

<ol>
  <li>Log into Conversational Cloud.</li>
  <li>
    <p>Open the menu on the left side of the page, and select <strong>Automate</strong> &gt; <strong>Conversation Assist</strong>.</p>

    <p><img class="fancyimage" alt="The Automate menu with the Conversation Assist menu option highlighted" style="width:300px" src="img/ConvoBuilder/automate_ca.png" /></p>
  </li>
</ol>

<h3 id="try-the-tutorial">Try the tutorial</h3>

<p>If you're just beginning with Conversation Assist, we recommend the <a href="tutorials-use-conversation-assist-overview.html">Using Conversation Assist</a> tutorial.</p>

<h3 id="whats-next">What's next?</h3>

<p>Review key terms and concepts. Get started <a href="conversation-assist-key-terms-concepts-basic-concepts.html">here</a>.</p>
]]></description>
      <!-- <pubDate>Wed, 27 May 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>User Queries - Contextualize</title>
      <link>https://developers.liveperson.com/knowledgeai-key-terms-concepts-user-queries-contextualize.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-key-terms-concepts-user-queries-contextualize.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="enhancing-the-users-query-using-conversation-context">Enhancing the user’s query using conversation context</h3>

<p>By default, when a user’s query is used to find an answer (a matched article) in a knowledge base, that query is just a single utterance—the most recent one—in the conversation.</p>

<p>The challenge with that is that often a single utterance doesn’t provide enough context to effectively retrieve a high quality answer.</p>

<p>Consider the following fictitious conversation between a consumer and an agent. Note the consumer’s final query:</p>

<p><strong>Consumer</strong>: <code class="language-html highlighter-rouge">Hi there! I’m interested in signing up for a new mobile phone plan. Could you help me with that?</code></p>

<p><strong>Agent</strong>: <code class="language-html highlighter-rouge">Absolutely! I'd be happy to help. Are you looking for a specific type of plan, or would you like me to go over our options with you?</code></p>

<p><strong>Consumer</strong>: <code class="language-html highlighter-rouge">I’m not entirely sure yet. I need something with a good amount of data, as I stream a lot of videos. But I don’t want to spend too much.</code></p>

<p><strong>Agent</strong>: <code class="language-html highlighter-rouge">Got it. We have a few options that might suit your needs. Our most popular plan includes 10GB of high-speed data, unlimited calls, and texts for $40 per month. If you think you'll need more data, we also have a 20GB plan for $60 per month.</code></p>

<p><strong>Consumer</strong>: <code class="language-html highlighter-rouge">Hmm, I think the first option might be enough. Sign me up!</code></p>

<p>As is so often the case in a natural conversation, the consumer’s final query above lacks specificity: What’s the first option? Sign up for what? This info is understood only if one has more of the conversation’s context.</p>

<p>KnowledgeAI™ solves the issue of a suboptimal consumer query by way of <strong>query contextualization</strong>. When requested, KnowledgeAI gathers additional “turns” in the conversation, and sends them and the user’s latest utterance to an in-house, state-of-the-art, LivePerson small language model. The model uses the info to rephrase the consumer’s query. The rephrased query is then used to search the knowledge base for relevant answers.</p>

<p>In our example above, the consumer’s final query might be rephrased to something like:</p>

<p><strong>Consumer</strong>: <code class="language-html highlighter-rouge">I need to sign up for a new mobile phone plan that includes 10GB of high-speed data, unlimited calls, and texts for $40 per month.</code></p>

<p>Or:</p>

<p><strong>Consumer</strong>: <code class="language-html highlighter-rouge">I'm interested in signing up for a new mobile phone plan. The first choice might be enough. Sign me up.</code></p>

<h3 id="key-benefits">Key benefits</h3>

<p>LivePerson strongly recommends that you turn on this feature. When used in Conversation Assist, it yields answer recommendations that are more accurate and relevant, which increases the rate at which your agents use recommendations.</p>

<p>In turn, this reduces the effort (in-focus time) expended by your agents, increases their efficiency (response time), and ultimately improves the overall conversational experience (CSAT, NPS) for the consumer.</p>

<h3 id="how-query-contextualization-works">How query contextualization works</h3>

<p><a href="knowledgeai-key-terms-concepts-search-methods.html#search-flow">See how query contextualization fits into the overall KnowledgeAI search and retrieval flow.</a></p>

<p>When a calling application, such as Conversation Assist, sends a request to KnowledgeAI to retrieve answers (articles) that match a user’s query, query contextualization works as follows:</p>

<ol>
  <li>The request from the calling application is checked to see if the query should be enhanced using the conversation’s context. If the answer is No, it moves the flow directly to KnowledgeAI’s search flow (query enhancement is skipped). If the answer is Yes, it moves the flow to the next step.</li>
  <li>The query’s type is checked: request for help, small talk (chitchat), etc. If the type is small talk, it moves the flow directly to the <a href="knowledgeai-key-terms-concepts-search-methods.html">knowledge base search</a> (query enhancement is skipped). If the type is not small talk, it moves the flow to the next step.</li>
  <li>The query is rephrased using the conversation’s context (using <strong>6 turns</strong>; this <strong>isn't</strong> configurable), and then the flow moves on.</li>
</ol>

<h3 id="limitations">Limitations</h3>

<h4 id="small-talk-limitation">Small talk limitation</h4>

<p>Queries that are only small talk (chitchat) are <strong>not</strong> rephrased.</p>

<h4 id="language-limitation">Language limitation</h4>

<p>Queries that are not in English are <strong>not</strong> rephrased. The model automatically rejects the request and simply returns the original query.</p>

<p>The above said, we appreciate your feedback here on areas for enhancement. If you have a request for support of another language, please contact your LivePerson representative.</p>

<h3 id="original-query-versus-enhanced-query-comparing-the-results">Original query versus enhanced query: Comparing the results</h3>

<p>Worried that the original query might yield a superior result? Our testing has revealed that this is an unlikely scenario. But in this event, we have this covered: When you choose to use query contextualization, KnowledgeAI automatically performs a parallel search of the knowledge base using the original query. The confidence scores of the results are then compared. The inferior results are discarded, and the superior results (the ones with the top scoring article) are kept and passed along in the flow.</p>

<h3 id="slm-used-for-query-contextualization">SLM used for query contextualization</h3>

<p>The SLM that rephrases the query is a state-of-the-art, LivePerson small language model (a decoder) that’s fine tuned for query contextualization tasks.</p>

<p class="attn-note">It’s not possible to customize the prompt that’s sent to the model. The prompt is tailored to suit the model.</p>

<h3 id="applications-using-this">Applications using this</h3>

<ul>
  <li><strong>Conversation Assist</strong>: You can turn on query contextualization in a <a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">knowledge base rule</a>.</li>
  <li><strong>KnowledgeAI agents</strong> (and Conversation Builder bots integrating knowledge but not using Generative AI to enrich answers): You can turn on query contextualization on <a href="conversation-builder-interactions-integrations.html#knowledge-bases">the face of the interaction</a>.</li>
</ul>

<h3 id="faqs">FAQs</h3>

<h4 id="i-have-an-external-kb-without-liveperson-ai-can-i-use-query-contextualization">I have an “external KB without LivePerson AI.” Can I use query contextualization?</h4>

<p>Yes, the feature is supported with all types of knowledge bases, including <a href="knowledgeai-external-knowledge-bases-external-kbs-without-liveperson-ai.html">external knowledge bases without LivePerson AI</a>. This is because query contextualization has to do with enhancing (rephrasing) the query <em>before</em> it is used to fetch matched articles from the knowledge base.</p>

<h4 id="can-i-use-an-llm-instead-of-livepersons-slm-to-perform-query-contextualization">Can I use an LLM instead of LivePerson’s SLM to perform query contextualization?</h4>

<p>Yes, you can. <a href="knowledgeai-key-terms-concepts-user-queries-custom-process-via-generative-ai.html">Learn about custom processing of the user’s query via Generative AI.</a> We provide the following prompt templates to get you started quickly:</p>

<ul>
  <li>Query Contextualization - Conversation Assist (Messaging)</li>
  <li>Query Contextualization - Conversation Assist (Voice)</li>
</ul>
]]></description>
      <!-- <pubDate>Tue, 24 Mar 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage Conversation Flow</title>
      <link>https://developers.liveperson.com/conversation-builder-scripting-functions-manage-conversation-flow.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-scripting-functions-manage-conversation-flow.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>Use the following built-in functions to affect the flow of a conversation.</p>

<h3 id="transfer-to-bots-dialog">Transfer to bot’s dialog</h3>

<p class="attn-note">Contact your LivePerson representative to enable support for this scripting function.</p>

<p>Use <code class="language-html highlighter-rouge">transferToBotDialog</code> to transfer the conversation to a specific dialog in a different Conversation Builder bot. This method gives you precise control over bot-to-bot transfers within LivePerson Conversational Cloud. It means more granular routing and a smoother hand-off experience for the consumer.</p>

<p>Be aware that this function, unlike <a href="conversation-builder-scripting-functions-manage-conversation-flow.html#set-trigger-next-message">setTriggerNextMessage</a>, <strong>doesn't</strong> immediately interrupt the current interaction's flow, so use it with caution. As a best practice, we recommend that you use it in the interaction's Post-Process Code.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">transferToBotDialog(botId, dialogName, transferMessage)</code></td>
      <td><em>botId (string)</em> - The unique identifier of the target bot. You can find a bot’s ID in <strong>Bot Settings</strong>.<br /><br /><em>dialogName (string)</em> - The name of the dialog in the target bot where the conversation should continue. You can find a dialog’s name in <strong>Dialog Settings</strong>.<br /><br /><em>transferMessage (string)</em> - Specify the message to send to the consumer before the transfer happens. Or, specify an empty string or leave null if no message is needed.</td>
      <td>None</td>
    </tr>
  </tbody>
</table>

<h4 id="implementation-approaches">Implementation approaches</h4>

<ul>
  <li><strong>Post-processing transfers</strong>: Use this function in the post-process code in a particular interaction to automatically transfer the consumer to a specific dialog in another bot after the interaction is complete. For example, if a user finishes an FAQ flow in one bot, you can seamlessly transfer them to a "feedback" dialog in a different bot.</li>
  <li><strong>Pre-processing transfers</strong>: Despite our best practice guidance above, cases do exist where you might want to use <code class="language-html highlighter-rouge">transferToBotDialog</code> in the interaction's Pre-Process Code. For example, you might have a text interaction that contains <code class="language-html highlighter-rouge">BLANK_MESSAGE</code> as the message to send, which means that <strong>no message</strong> is sent to the consumer. In a case like this, using the function is safe, as there's no concern regarding whether a specified message is or isn't sent.</li>
</ul>

<p class="attn-alert">Don’t use the <code class="language-html highlighter-rouge">transferToBotDialog</code> function within the <code class="language-html highlighter-rouge">__initConversation</code> function within <a href="conversation-builder-global-functions.html">Global Functions</a>. <code class="language-html highlighter-rouge">__initConversation</code> is used to initialize the conversation context before anything happens. Using <code class="language-html highlighter-rouge">transferToBotDialog</code> within <code class="language-html highlighter-rouge">__initConversation</code> doesn’t work because the context isn’t fully initialized until <code class="language-html highlighter-rouge">__initConversation</code> has been fully executed.</p>

<h4 id="example">Example</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">botContext</span><span class="p">.</span><span class="nx">transferToBotDialog</span><span class="p">(</span>
  <span class="dl">"</span><span class="s2">e5522243-ba22-439e-b253-e5e8b123999f</span><span class="dl">"</span><span class="p">,</span>
  <span class="dl">"</span><span class="s2">Upgrade Plan</span><span class="dl">"</span><span class="p">,</span>
  <span class="dl">"</span><span class="s2">One sec. We're transferring you to an agent who can help.</span><span class="dl">"</span>
<span class="p">);</span>
</code></pre></div></div>

<h3 id="set-message-delay-value">Set message delay value</h3>

<p>Use <code class="language-html highlighter-rouge">setMessageDelay</code> to set a delay for a message, so the conversation appears more human-like. As a best practice, use the function within the Pre-Process code of interaction. Note the following:</p>

<ul>
  <li>If you use this function in the Pre-Process code, it overrides the value that’s set in the <a href="conversation-builder-interactions-configuration-settings.html#basic-settings">Interaction Delay setting</a> in the interaction.</li>
  <li>If you use this function multiple times within your code, only the last instance is applied. In the code below, both Message1 and Message2 have a 5-second delay. Message1 doesn’t have a 3-second delay.</li>
</ul>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>      botContext.setMessageDelay(3000);
      botContext.sendMessage(“Message1”);
      botContext.setMessageDelay(5000);
      botContext.sendMessage(“Message2”);
</code></pre></div></div>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">setMessageDelay(delay_value)</code></td>
      <td>delay_value (integer)</td>
      <td>None</td>
    </tr>
  </tbody>
</table>

<h4 id="example-1">Example</h4>

<p>In the below example, we send three messages to the user with a delay of 2000 milliseconds between them.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// setting a delay of 2000 for each message……</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">setMessageDelay</span><span class="p">(</span><span class="mi">2000</span><span class="p">);</span>
<span class="c1">//  sending message to user…</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">sendMessages</span><span class="p">([</span><span class="dl">'</span><span class="s1">Sorry to hear that you lost your credit card.</span><span class="dl">'</span><span class="p">,</span><span class="dl">'</span><span class="s1">I just put the stop on your credit card</span><span class="dl">'</span><span class="p">,</span> <span class="dl">'</span><span class="s1">If you find any unauthorized transaction please let us know as soon as possible so we can remove them from your bill</span><span class="dl">'</span><span class="p">]);</span>
</code></pre></div></div>

<h3 id="set-allow-max-text-response">Set allow max text response</h3>

<p>By default, a single text interaction has a limit of 1000 characters on the word boundary before it gets split into 2 parts. However, you can override this behavior with the <code class="language-html highlighter-rouge">setAllowMaxTextResponse</code> function so that all text is within a single message.</p>

<p>To accomplish this, use this function in the pre-process code of the interaction (i.e., before the interaction is rendered). You can then revert it if desired in a subsequent interaction.</p>

<p class="attn-note">Keep in mind the limits of the targeted channel(s), which might take precedence over this setting.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">setAllowMaxTextResponse(value)</code></td>
      <td>value (Boolean)</td>
      <td>None</td>
    </tr>
  </tbody>
</table>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">botContext</span><span class="p">.</span><span class="nx">setAllowMaxTextResponse</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="set-trigger-next-message">Set trigger next message</h3>

<p><code class="language-html highlighter-rouge">setTriggerNextMessage</code> is used for directing the conversation flow, i.e., for triggering a specified interaction in the bot. This function interrupts the current interaction's flow and is immediately executed.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">setTriggerNextMessage(messagename)</code></td>
      <td>messagename (string) — The name of the interaction to trigger. (An interaction's name can be found in the interaction's settings.)</td>
      <td>None</td>
    </tr>
  </tbody>
</table>

<p class="attn-alert">Don’t use the <code class="language-html highlighter-rouge">setTriggerNextMessage</code> function within the <code class="language-html highlighter-rouge">__initConversation</code> function within <a href="conversation-builder-global-functions.html">Global Functions</a>. <code class="language-html highlighter-rouge">__initConversation</code> is used to initialize the conversation context before anything happens. Using <code class="language-html highlighter-rouge">setTriggerNextMessage</code> within <code class="language-html highlighter-rouge">__initConversation</code> doesn’t work because the context isn’t fully initialized until <code class="language-html highlighter-rouge">__initConversation</code> has been fully executed.</p>

<h4 id="example-2">Example</h4>

<p>In the example below, we test for which company the user selected, and, if "LivePerson", we trigger the interaction "Welcome LivePerson". Otherwise, we trigger "Welcome Other".</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">company</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getCurrentUserMessage</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">company</span> <span class="o">==</span> <span class="dl">'</span><span class="s1">LivePerson</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
      <span class="nx">botContext</span><span class="p">.</span><span class="nx">setTriggerNextMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Welcome LivePerson</span><span class="dl">'</span><span class="p">);</span>
<span class="p">}</span><span class="k">else</span><span class="p">{</span>
      <span class="nx">botContext</span><span class="p">.</span><span class="nx">setTriggerNextMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Welcome Other</span><span class="dl">'</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<h3 id="evaluate-options">Evaluate options</h3>

<p><code class="language-html highlighter-rouge">evaluateOptions</code> is used for matching the user’s input against an array of options.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">evaluateOptions(userResponse, options)</code></td>
      <td><em>userResponse</em> — the user's message text<br /><br /><em>options</em> — array of strings</td>
      <td>string: matched option from an array of options.</td>
    </tr>
  </tbody>
</table>

<h4 id="example-3">Example</h4>

<p>In the below example, we create an array of possible options. Then we test for a response using the evaluateOptions() function by including the userResponse and the array of options. If the user types “A” or “A)” or “Yes” the result returned will be “A) Yes”.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">userResponse</span> <span class="o">=</span> <span class="p">(</span><span class="nx">botContext</span><span class="p">.</span><span class="nx">getCurrentUserMessage</span><span class="p">()).</span><span class="nx">toLowerCase</span><span class="p">();</span>
<span class="c1">// match options</span>
<span class="kd">var</span> <span class="nx">options</span> <span class="o">=</span> <span class="p">[</span><span class="dl">"</span><span class="s2">A)Yes</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">B)No</span><span class="dl">"</span><span class="p">];</span>
<span class="kd">var</span> <span class="nx">result</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">evaluateOptions</span><span class="p">(</span><span class="nx">userResponse</span><span class="p">,</span> <span class="nx">options</span><span class="p">);</span>
<span class="c1">// what was user's response?</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">====&gt; User Said: </span><span class="dl">'</span> <span class="o">+</span> <span class="nx">userResponse</span> <span class="o">+</span> <span class="dl">'</span><span class="s1"> and MATCH result = </span><span class="dl">'</span><span class="o">+</span> <span class="nx">result</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="add-quick-replies">Add quick replies</h3>

<p>The <code class="language-html highlighter-rouge">addQuickReplies</code> function is used for adding quick replies to a message in JavaScript rather than defining in bot creation. This allows for the dynamic addition of the buttons to accommodate various scenarios.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">addQuickReplies()</code></td>
      <td>array</td>
      <td>None</td>
    </tr>
  </tbody>
</table>

<h4 id="example-4">Example</h4>

<p>The example below shows how quick replies can be added easily to your message.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// Add these quick replies to an existing message</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">addQuickReplies</span><span class="p">([</span><span class="dl">'</span><span class="s1">Ranch~sauce01</span><span class="dl">'</span><span class="p">,</span><span class="dl">'</span><span class="s1">Honey Mustard~sauce02</span><span class="dl">'</span><span class="p">,</span><span class="dl">'</span><span class="s1">BBQ~sauce03</span><span class="dl">'</span><span class="p">,</span><span class="dl">'</span><span class="s1">Hot~sauce04</span><span class="dl">'</span><span class="p">]);</span>
</code></pre></div></div>

<h3 id="get-button-payload">Get button payload</h3>

<p><code class="language-html highlighter-rouge">getButtonPayload</code> is used to retrieve a button’s callback value that is sent to the bot when the consumer selects that button in a question.</p>

<p>By default, when you specify a callback value for a button in a Structured or Button question, that value is sent to the bot when the consumer selects the button. What’s more, that value, not the button’s label, is displayed to the consumer as their selected choice. The latter means you can retrieve the button’s callback value with <a href="conversation-builder-scripting-functions-get-set-session-data.html#get-current-user-message">getCurrentUserMessage</a>.</p>

<p>However, in cases where you’re using the <a href="conversation-builder-testing-deployment-deploy-the-bot.html#enablebuttontextonpostback">enableButtonTextOnPostback</a> custom configuration field in the bot’s agent connector, the button’s label instead, not the callback value, is displayed to the consumer as their selected choice. In these cases, you need a different way to retrieve the button’s callback value. <code class="language-html highlighter-rouge">getButtonPayload</code> meets this need.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">getButtonPayload()</code></td>
      <td>None</td>
      <td>(string) The button’s callback value that is sent to the bot</td>
    </tr>
  </tbody>
</table>

<h4 id="example-5">Example</h4>

<p>In this example, we use <code class="language-html highlighter-rouge">getButtonPayload</code> in the Process User Response code of the question interaction to retrieve and store the callback value that is sent to the bot after the consumer selects a button:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">callbackValue</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getButtonPayload</span><span class="p">();</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">Callback : </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">callbackValue</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="dl">"</span><span class="s2">callback</span><span class="dl">"</span><span class="p">,</span> <span class="nx">callbackValue</span><span class="p">,</span> <span class="kc">true</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
</code></pre></div></div>
]]></description>
      <!-- <pubDate>Thu, 19 Mar 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Get Started with Tags</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-tags-get-started-with-tags.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-tags-get-started-with-tags.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>Tags facilitate rapid filtering and organization, allowing you to quickly identify scenarios based on specific technical topics, difficulty levels, teams or departments, or emotional complexity.</p>

<h3 id="best-practices">Best practices</h3>

<ul>
  <li>Use tags to organize. Group by department, use case, channel, difficulty level, etc. This is especially useful when your library grows to include many scenarios or personas.</li>
</ul>
]]></description>
      <!-- <pubDate>Wed, 18 Mar 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Get Started with Synthetic Customer Profiles</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-synthetic-customer-profiles-get-started-with-synthetic-customer-profiles.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-synthetic-customer-profiles-get-started-with-synthetic-customer-profiles.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="starter-pack">Starter pack</h3>

<p>To accelerate your setup process and help you quickly get to the process of analyzing outcomes, Syntrix provides a starter pack. The starter pack includes one profile, i.e., one pre-built combination of scenarios and personas.</p>

<p>Find the starter pack here: <strong>Synthetic customer builder &gt; Synthetic customer</strong>.</p>

<p>While the prebuilt profile is ready for immediate use, it's also fully editable. You can customize it to better align with your specific organizational requirements.</p>
]]></description>
      <!-- <pubDate>Wed, 18 Mar 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Get Started with Scenarios</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-scenarios-get-started-with-scenarios.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-scenarios-get-started-with-scenarios.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="customer-centric-scenario-design">Customer-centric scenario design</h3>

<p>As a scenario author, you don’t need to script internal routing or multi-leg logic. Syntrix simplifies the process by focusing strictly on the <strong>customer perspective</strong>.</p>

<ul>
  <li><strong>Black Box testing</strong>: Scenario authors only need to define the customer's goal and important context. You do not need to map out complex backend routing, transfers, or system logic.</li>
  <li><strong>Automated visibility</strong>: Syntrix automatically detects and logs the entire multi-leg journey—including hand-offs between AI agents and live agents. This ensures you get deep analytical lineage without burdening scenario authors with system complexity.</li>
</ul>

<h3 id="starter-pack">Starter pack</h3>

<p>To accelerate your setup process and help you quickly get to the process of analyzing outcomes, Syntrix provides a starter pack of prebuilt scenarios. The starter pack includes a set of pre-built customer journeys that are typical in many verticals.</p>

<p>Find the starter pack right where you create and manage scenarios: <strong>Synthetic customer builder &gt; Scenarios</strong> page.</p>

<p>While the prebuilt scenarios are ready for immediate use, they are also fully editable. You can use one as a baseline and customize individual aspects to better align with your specific organizational requirements.</p>

<p class="attn-note">Before you use a prebuilt scenario, edit it and assign to it an appropriate skill.</p>

<p class="attn-alert">Take care when deleting a prebuilt scenario; this can't be undone.</p>
]]></description>
      <!-- <pubDate>Wed, 18 Mar 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Best Practices</title>
      <link>https://developers.liveperson.com/work-in-the-simulation-and-training-studio-synthetic-customer-profiles-best-practices.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/work-in-the-simulation-and-training-studio-synthetic-customer-profiles-best-practices.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="logically-align-assets">Logically align assets</h3>

<p>Pair personas with scenarios that naturally align. Avoid unlikely combinations—such as a hostile customer calling to join a positive promotion—as they produce unrealistic data and lack real-world utility.</p>

<h3 id="selecting-personas-focus-on-objectives-not-numbers">Selecting personas: Focus on objectives, not numbers</h3>

<p>Instead of focusing on the number of personas to include in a profile (test suite), prioritize the specific results that you want to achieve. To find the right balance, define your main testing goal:</p>

<table>
  <tbody>
    <tr>
      <td>Testing goal</td>
      <td>Number of personas</td>
    </tr>
    <tr>
      <td>Agent readiness across customer types</td>
      <td>5-10 personas. Expose your agents to the full spectrum during training.</td>
    </tr>
    <tr>
      <td>A specific edge case or failure mode</td>
      <td>1-2 specific personas that reliably trigger the behavior you're investigating.</td>
    </tr>
    <tr>
      <td>A specific AI agent interaction (repeatedly and reliably)</td>
      <td>1 persona + 1 scenario. This minimizes variables, so you can isolate the flow being tested.</td>
    </tr>
    <tr>
      <td>AI agent quality and helpfulness (for example, an FAQ agent)</td>
      <td>5-10 personas. Test that the bot handles different communication styles well.</td>
    </tr>
    <tr>
      <td>Comprehensive QA</td>
      <td>As many distinct personas as practical. Maximize variance for realistic coverage.</td>
    </tr>
  </tbody>
</table>

<p class="attn-note"><strong>Key principle</strong>: Prioritize unique personas over a high volume of similar ones. While more personas increase variety and realism, adding those with overlapping traits provides little extra value.</p>

<h3 id="validate-your-strategy">Validate your strategy</h3>

<p>Ensure every combination is realistic and directly supports the specific testing results you aim to achieve.</p>

<ul>
  <li><strong>Negative scenarios</strong>: Pair disputes, outages, and complaints with any persona, from friendly to irate. Use the persona to dictate the intensity of the frustration rather than the situation itself.</li>
  <li><strong>Positive scenarios</strong>: Match sign-ups and inquiries with neutral or positive personas. Reserve hostile pairings for rare edge-case testing rather than standard simulations.</li>
  <li><strong>Complex scenarios</strong>: Pair technical or multi-step tasks with confused or impatient personas. This stress-tests an agent’s ability to guide difficult customers through challenging processes.</li>
</ul>
]]></description>
      <!-- <pubDate>Wed, 18 Mar 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Best Practices</title>
      <link>https://developers.liveperson.com/trustworthy-generative-ai-prompt-library-best-practices.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/trustworthy-generative-ai-prompt-library-best-practices.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>This guide covers effective prompting strategies for getting high-quality results from large language models, with a focus on Google’s Gemini models.</p>

<p>Prompt engineering is iterative!</p>

<p>Treat these as starting points and refine based on what works for your specific use cases.</p>

<p>The strategies below are ordered roughly from foundational to advanced. Start with clear instructions and few-shot examples before reaching for more complex techniques.</p>

<h3 id="structure-the-prompt-with-specific-sections">Structure the prompt with specific sections</h3>

<p>A well-organized prompt has distinct sections that the model can parse independently. Think of it like a document with clear headings—the model knows where to look for what. We recommend the following structure as a starting template:</p>

<ul>
  <li><strong>Role or task</strong>: Define who the model is and what it’s trying to accomplish. This anchors the model’s behavior for the rest of the prompt. Example: “You are a helpful AI assistant for LivePerson Bank specialized in Question Answering.”</li>
  <li><strong>Instructions</strong>: The core behavioral rules. What should the model do? What should it avoid? How should it handle edge cases? Order these by importance—the model pays more attention to instructions that appear first.</li>
  <li><strong>Examples (if applicable)</strong>: Few-shot examples that show the model what a correct input/output pair looks like. Keep them relevant to the actual task. Generic or off-topic examples waste tokens and can confuse the model.</li>
  <li><strong>Output format</strong>: Specify tone, structure, length, and any formatting rules (JSON, bullet points, etc.). This section can go before or after the prompt input depending on your use case.</li>
  <li><strong>Prompt inputs or context</strong>: The actual data the model needs to work with: knowledge articles, conversation transcripts, user queries, etc. Place this after your instructions, so the model is already primed on what to do before it reads the data.</li>
</ul>

<p>Use clear delimiters (XML tags or Markdown headings) between each section, so the model knows where one ends and the next begins. See the <em>Use structured markup…</em> section below for specific examples.</p>

<h3 id="write-clear-specific-instructions">Write clear, specific instructions</h3>

<p>One of the most impactful things you can do is be explicit about what you want.</p>

<p>Remove ambiguity by specifying:</p>

<ul>
  <li><strong>Constraints</strong>: How long should the response be? What should be included or excluded?</li>
  <li><strong>Format</strong>: Do you want a table, bullet list, JSON, paragraph, or something else?</li>
  <li><strong>Tone and style</strong>: Set conversational vs. formal tone, verbosity level, etc.</li>
</ul>

<p class="attn-tip">From our experimentation and literature review, we have found that instructions <strong>at the beginning of the prompt</strong> are given more attention by the model. This means that you should order your instructions by how important they are for completing the task. For example, a description of exactly how information should be extracted from a conversation is more crucial than an output format constraint like length.</p>

<h3 id="use-few-shot-examples">Use Few-Shot examples</h3>

<p>Including examples in your prompt is one of the most reliable ways to steer Gemini’s behavior. Few-shot prompts—those with examples—consistently outperform zero-shot prompts (no examples). Google’s own guidance recommends always including them.</p>

<h4 id="best-practices-for-examples">Best practices for examples</h4>

<ul>
  <li><strong>Show, don’t tell</strong>. Clear examples can sometimes replace written instructions entirely.</li>
  <li><strong>Use positive patterns</strong>. Show what the model should do, not what it should avoid. Positive examples are more effective than anti-patterns.</li>
  <li><strong>Keep formatting consistent</strong>. If your examples use different structures, the model may produce inconsistent output. Standardize your XML tags, whitespace, and delimiters.</li>
  <li><strong>Don’t overdo it</strong>. Gemini picks up patterns from just a few examples. Too many can cause overfitting, where the model mimics examples too literally.</li>
</ul>

<h3 id="provide-context">Provide context</h3>

<p>Don’t assume the model knows what you know. Include the reference material, data, or background information it needs to give you a useful answer.</p>

<p>Grounding the model in provided context produces far more specific and accurate responses than relying on its general training knowledge.</p>

<p class="attn-tip">From our experimentation, we have found that including your retrieved context <strong>after</strong> your instructions leads to better results, allowing the model to prime on the task, and then focus on grounding that task with the appropriate context.</p>

<h3 id="use-prefixes-to-structure-prompts">Use prefixes to structure prompts</h3>

<p>Prefixes are labels that you add to different parts of the prompt to help the model parse your intent. There are three types:</p>

<table>
  <thead>
    <tr>
      <th>Prefix type</th>
      <th>What it does</th>
      <th>Example</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Input prefix</td>
      <td>Labels the input data so the model knows what it’s working with</td>
      <td><em>"Text: ", "English: ", "Order: "</em></td>
    </tr>
    <tr>
      <td>Output prefix</td>
      <td>Signals what format or type the response should be</td>
      <td><em>"JSON: ", "The answer is: "</em></td>
    </tr>
    <tr>
      <td>Example prefix</td>
      <td>Labels examples in few-shot prompts so outputs are easier to parse</td>
      <td><em>"Input: ", "Output: ", "Q: ", "A: "</em></td>
    </tr>
  </tbody>
</table>

<h3 id="use-structured-markup-to-organize-prompts">Use structured markup to organize prompts</h3>

<p>When your prompt has multiple distinct parts—instructions, context, examples, constraints—wrapping them in XML-style tags or Markdown headings makes it much easier for the model to parse what’s what. This is especially effective with newer models, which are tuned to respond well to structured input.</p>

<p>XML tags work well because they create unambiguous boundaries. The model can clearly see where your context ends and your task begins, which reduces the chance of it confusing data for instructions (or vice versa). Markdown headings serve a similar purpose and feel more natural if you’re already writing in a conversational style.</p>

<h4 id="xml-example">XML example</h4>

<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="syntax"><code>
<span class="nt">&lt;task&gt;</span>
Write a 3-sentence executive summary of this quarter’s performance.
<span class="nt">&lt;/task&gt;</span>

<span class="nt">&lt;constraints&gt;</span>
- Tone: professional, optimistic
- Do not include exact dollar figures
<span class="nt">&lt;/constraints&gt;</span>

<span class="nt">&lt;context&gt;</span>
Our Q4 revenue was $2.3M, up 15% from Q3. Customer churn dropped to 4.2%.
<span class="nt">&lt;/context&gt;</span>

</code></pre></div></div>

<h4 id="markdown-example">Markdown example</h4>

<pre><code class="language-Markdown"># Task
Write a 3-sentence executive summary of this quarter’s performance.

# Constraints
- Tone: professional, optimistic
- Do not include exact dollar figures

# Context
Our Q4 revenue was $2.3M, up 15% from Q3. Customer churn dropped to 4.2%.
</code></pre>

<h3 id="iterate-on-the-prompt">Iterate on the prompt</h3>

<p>If your prompt isn’t producing the results you want, try these adjustments before starting from scratch:</p>

<ul>
  <li><strong>Rephrase</strong>. Different wording can yield significantly different results, even when the meaning is the same.</li>
  <li><strong>Reframe the task</strong>. If classification isn’t working well, try framing it as a multiple-choice question instead.</li>
  <li><strong>Reorder content</strong>. The placement of examples, context, and instructions relative to each other can affect the response.</li>
</ul>

<h3 id="tune-model-parameters">Tune model parameters</h3>

<p>Beyond the prompt itself, you can control model behavior through hyperparameters (settings) configured in the prompt's settings in the Prompt Library, in the API call, or in the Vertex AI playground (i.e., not in the prompt text).</p>

<ul>
  <li><strong>Temperature</strong>: This value between 0.0 and 2.0 inclusive controls randomness. Lower = more deterministic and repeatable; higher = more creative but riskier.</li>
</ul>

<p>Google recommends 1.0 as the default for Gemini 2.5 models, since these models have improved internal calibration. However, for our use cases like KnowledgeAI and Conversation Assist, we recommend a temperature of 0 (zero) to ensure repeatable, reliable responses. When the model is grounding answers in retrieved context, we want consistency, not creativity.</p>

<p class="attn-note">LivePerson's Promp Library only supports values between 0.0 and 1.0 inclusive, as values above 1 are not particularly useful.</p>

<p>For some newer models, like the Gemini 3 series, it is actually recommended that you keep the temperature at 1.0 to avoid unexpected behavior, regardless of the use case.</p>

<h3 id="use-of-variables">Use of variables</h3>

<p><a href="trustworthy-generative-ai-prompt-library-work-with-variables.html#best-practices">Learn about best practices when using variables.</a></p>

<h3 id="prompt-management">Prompt management</h3>

<p>When creating and managing prompts, follow these best practices. They’ll help you to avoid impacting your Generative AI solution in ways that you don’t intend.</p>

<ul>
  <li><strong>Minor changes</strong>: These include changes like typo fixes. It’s okay to edit the prompt directly.</li>
  <li><strong>Major changes</strong>: To make these, we recommend duplicating the prompt and testing the changes in the copy first. This avoids impacting your Production solution while you’re testing and verifying. Always test before changing your Production solution.</li>
  <li><strong>Duplicate feature</strong>: Take advantage of this feature. It lets you implement self-managed versioning: Duplicate Prompt A v1.0 to create Prompt A v2.0. Duplicate Prompt A 2.0 to create Prompt A v3.0. And so on. This kind of strategy has two very important benefits: 1) Your Production solution isn’t impacted as you work on new, independent copies of prompts. 2) By keeping versions distinct, it enables you to  revert your solution to an earlier version of a prompt if needed.</li>
  <li><strong>Edit feature</strong>: This feature lets you make changes to a prompt. But for safety, we recommend using the duplicate feature for major changes. Always fully test any substantive changes, especially major ones.</li>
</ul>

<h3 id="prompt-testing">Prompt testing</h3>

<p>Even modest changes to prompts can produce very different results, so <strong>always</strong> test a prompt fully before using it in Production. Take advantage of the following tools:</p>

<ul>
  <li><strong><a href="knowledgeai-optimizing-your-content-tune-a-knowledge-base.html">KnowledgeAI’s testing tools</a></strong>: Use these to test the article matching, and to see enriched answers that are generated without any conversation context as input to the LLM. In the results, you can see the articles that were matched, the prompt sent to the LLM service, and the enriched answer that was returned. This tool can help you to tune the performance of the knowledge base. It also gives you some insight into how well the Generative AI piece of your solution is performing.</li>
  <li>
    <p><strong>Conversation Builder’s <a href="conversation-builder-testing-deployment-preview-the-bot.html">Preview</a> and <a href="conversation-builder-testing-deployment-test-debug-post-deployment.html">Conversation Tester</a></strong>: Use either of these tools to fully test your Generative AI solution. Both tools give you a better view into performance because both pass previous turns from the current conversation to the LLM service, not just the matched articles and the prompt. This added context enhances the quality of the enriched answers. So these tools give you the most complete picture.</p>

    <p>Use the Conversation Tester to test the end-to-end flow. With Preview, the conversation only flows between the tool and the underlying bot server. With Conversation Tester, it goes through Conversational Cloud.</p>
  </li>
</ul>

<p class="attn-note"><strong>Using Generative AI in Conversation Assist?</strong> To fully test prompt changes and include the conversation context as input to the LLM, you’ll need to create a messaging bot in Conversation Builder. Configure it to match your Conversation Assist configuration, for example, use the same answer threshold. You can quickly <a href="conversation-builder-bot-templates-overview.html#industry-specific-bot-templates">create a messaging bot via a bot template</a>. Use the <a href="conversation-builder-bot-templates-generative-ai-messaging.html">Generative AI - Messaging bot template</a> in specific.</p>

<h3 id="releasing-prompt-changes">Releasing prompt changes</h3>

<ul>
  <li><strong>Generative AI in Conversation Assist</strong>: First test via a Conversation Builder test bot. Then update the prompt configuration in Conversation Assist.</li>
  <li><strong>Generative AI in Conversation Builder bots</strong>: We recommend you take advantage of Conversation Builder’s <a href="conversation-builder-versions-releases.html">Release feature</a> to control and manage how prompt changes are made live in your Production bots. First make the updates in a Development or Sandbox bot and test. When you’re ready, push those changes to the Production bot.</li>
</ul>

<h3 id="external-guides">External guides</h3>

<ul>
  <li><a href="https://learnprompting.org/docs/intro">https://learnprompting.org/docs/intro</a></li>
  <li><a href="https://www.promptingguide.ai/introduction/tips">https://www.promptingguide.ai/introduction/tips</a></li>
</ul>
]]></description>
      <!-- <pubDate>Tue, 03 Mar 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Post-Conversation Survey Bots</title>
      <link>https://developers.liveperson.com/conversation-builder-bots-post-conversation-survey-bots.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-bots-post-conversation-survey-bots.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="whats-a-post-conversation-survey-bot">What's a post-conversation survey bot?</h3>

<p>A post-conversation survey bot lets you collect feedback from consumers at the end of a conversation with a custom bot or human agent. The survey bot can ask:</p>

<ul>
  <li>Specialized questions designed to provide First Call Resolution (FCR), Customer Satisfaction (CSAT), and Net Promoter Score (NPS) survey metrics</li>
  <li>Questions that reflect your brand's key performance indicators</li>
  <li>Free-text questions</li>
</ul>

<p>Use a post-conversation survey bot to measure bot/agent and skill performance and to identify opportunities to improve on your quality targets.</p>

<p><img style="width:400px" src="img/ConvoBuilder/surveyBot_example.png" alt="An example survey as seen in the Preview tool" /></p>

<p>See also this <a href="https://community.liveperson.com/kb/articles/1379-post-conversation-survey-bots">in-depth introduction to surveys and survey metrics</a> in the Community Center.</p>

<p class="attn-note">To use survey bots created in LivePerson Conversation Builder, you must be on the LivePerson platform, i.e., you log into Conversation Builder via single sign-on through Conversational Cloud. This feature isn't supported on the Google Cloud Platform (GCP) where you log into Conversation Builder directly.<br /><br />Survey bots are supported only in Messaging, not in Live Chat.</p>

<h3 id="the-survey-flow">The survey flow</h3>

<h4 id="survey-triggering">Survey triggering</h4>

<p>When a conversation is ended (either by the consumer or the agent), if the conversation's last skill matches one assigned to the survey bot, the survey bot automatically begins the survey.</p>

<p>The above also means that:</p>

<ul>
  <li>There is no need to "transfer" to the survey. This happens automatically.</li>
  <li>A conversation that doesn't have an assigned skill can't trigger a survey.</li>
</ul>

<p>If a conversation is closed automatically because it's been idle for a time, a survey <strong>isn't</strong> triggered.</p>

<h4 id="survey-timeout">Survey timeout</h4>

<p>By default, a survey times out (expires) after one hour, but you can change this time period if desired. You can also configure a "Session Expired" message to send to the consumer if they try to enter text after the session has expired. Both of these settings are found in Bot Settings, discussed farther below.</p>

<h4 id="survey-outcomes">Survey outcomes</h4>

<p>A survey can be closed in the following ways:</p>

<ul>
  <li>The survey is completed.</li>
  <li>The survey times out.</li>
</ul>

<p>Both outcomes are tracked and reported on as part of the Analytics Builder, so you can fully analyze the results.</p>

<h3 id="prerequisite-steps">Prerequisite steps</h3>

<h4 id="enable-the-feature">Enable the feature</h4>

<p>Before you can begin building survey bots, the feature must be enabled in Conversation Builder by LivePerson. Please contact your LivePerson account representative (other contact options: chat with us on this page, or <a href="https://community.liveperson.com/kb/articles/1576-how-to-contact-support">message Support</a>) to enable this feature.</p>

<h4 id="configure-account-level-settings">Configure account-level settings</h4>

<p>There are a few account-level, survey settings that you can configure. These settings affect all survey bots in the account. Unless explicitly called out below as an exception, these settings can't be overridden in an individual bot.</p>

<p class="attn-note">For changes to take effect, you must <a href="conversation-builder-bot-status-manage-post-conversation-survey-bots.html#redeploy-the-connector">redeploy the Post-Conversation Survey connector</a>.</p>

<p><strong>To configure account-level settings</strong></p>

<p>1 - <a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access the Bot Accounts application.</a></p>

<p>2 - Select the organization.</p>

<p>3 - On the <strong>Account Details</strong> tab, specify the following:</p>

<ul>
  <li>
    <p><strong>Name &amp; Avatar for Survey Bots</strong>: Click the edit (pencil) icon to display the settings for customizing the survey bot's name and picture that are shown to consumers during conversations. Note that the domain in the picture URL is whitelisted automatically; there is no action required by you. If you leave the picture URL unspecified (this is an optional field), no picture is used.</p>
  </li>
  <li>
    <p><strong>Button Styling for Survey Bots</strong>: To customize the style of buttons, i.e., the response options in post-conversation survey bots, click the edit (pencil) icon, enter the JSON, and click <strong>Save</strong>. <a href="getting-started-with-rich-messaging-introduction.html#element-styling">Learn about specifying styling.</a> Note that the styling isn’t applied when testing the survey bot in the <a href="conversation-builder-testing-deployment-preview-the-bot.html">Preview tool</a> because that isn’t an end-to-end flow.</p>
  </li>
</ul>

<p><img style="width:500px" src="img/ConvoBuilder/surveyBot_buttonStyling.png" alt="Example JSON to specify button styling" /></p>

<ul>
  <li>
    <p><strong>Target Interactive Conversations</strong>: Sending surveys to consumers who aren't interacting with your brand can negatively impact your CSAT score without cause. You can enable this setting to send surveys to engaged consumers only.</p>

    <p>Once you enable the setting, you specify the minimum number of messages that must be sent (by the consumer and by the bot/human agent) for the survey to be sent. You must specify values for <em>all</em> the subsettings, though default values are provided.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/surveyBot_targetInteractiveConvs.png" alt="The Target Interactive Conversations setting in the UI, including its subsettings for specifying the minimum number of messages that must be sent for the survey to be triggered" /></p>

    <p>During a conversation, each condition is checked. A survey is only sent if <em>all</em> conditions are true.</p>

    <p>Note that a message's status isn't taken into account when counting the number of messages sent by an agent or a user. This means that a message will be counted as sent in the situation where the message was sent but wasn't delivered to the recipient for some reason.</p>

    <p>This is an account-level setting, so it's applied to all your post-conversation survey bots. However, you can override this setting on a per bot basis; do this in an individual bot's <strong>Bot Settings</strong>.</p>
  </li>
  <li>
    <p><strong>Survey Request Interval</strong>: This setting determines how often a consumer is sent a survey. When configuring this, consider how frequently you want a response from the same consumer, as sending surveys too often can create a poor experience.</p>

    <p>When this setting is disabled, the consumer always receives a survey when all conditions are met.</p>

    <p>When this setting is enabled, the time interval you specify applies to your entire account. While the wait time (number of days) is a <strong>single global value</strong>, you can choose how that wait time is triggered:</p>

    <p><strong>Option 1: Account level (collective)</strong> - A single exclusion period applies to all survey bots. Once any survey is triggered, the consumer will not receive any other survey from your account until the specified interval has passed.</p>

    <p><strong>Option 2: Survey bot level (individual tracking)</strong> - The wait time is tracked independently for each bot. Once a specific survey is triggered, the consumer is only restricted from receiving that specific survey again. They remain eligible to receive your other surveys during this time.</p>

    <p>As an example, assume you have surveys A, B and C, and you enable this setting with a value to 20 days. With Option 1, if survey bot A joins the conversation with the consumer, the consumer will not receive survey A again, or receive surveys B and C, until 20 days have passed. With Option 2, they will not receive survey A again until 20 days have passed. During this time, they still might receive surveys B and C.</p>
  </li>
  <li>
    <p><strong>Survey Sampling</strong>: If you have high traffic, you don’t need to send surveys to all your consumers; you can send them to a subset. That’s what this setting is designed for. If it's disabled, <em>all</em> consumers are sent surveys when all conditions are met. You can enable this setting to send surveys to a percentage of randomly sampled consumers. Use the slider to specify the percentage. The default value is 50%.</p>
  </li>
</ul>

<p class="attn-note"><strong>Tying it together</strong>: The three settings described above control when consumers get surveys and how often. Collectively, they work as follows:<br /><br />First, recognize that the point at which a survey bot <em>joins a conversation</em> is distinct from the point at which the survey is sent to the consumer.<br /><br />When the survey bot joins the conversation, the system first checks <strong>Survey Sampling</strong>. If it’s enabled, the flow continues or the survey is rejected based on the outcome of the sampling logic. If it continues, the system checks if there’s an existing throttling value based on <strong>Survey Request Interval</strong>. If one is found, the flow continues or the survey is rejected based on whether the time interval has lapsed. If no throttling value is found, it sets the throttling value immediately. After that, messages are fetched and evaluated against <strong>Target Interactive Conversations</strong>. If the targeting conditions aren’t met, the survey is rejected, but the throttling value remains in use. If the conditions are met, the consumer is sent the survey.<br /><br />Keep in mind that the fact that the throttling value is set when the survey bot joins the conversation with the consumer—<strong>not</strong> when the survey is sent to the consumer—means that consumers can be throttled even though they have never received a survey.</p>

<p>4 - <a href="conversation-builder-bot-status-manage-post-conversation-survey-bots.html#redeploy-the-connector">Redeploy the Post Conversation Survey connector</a> for your changes to take effect.</p>

<h3 id="create-the-survey-bot">Create the survey bot</h3>

<ol>
  <li><a href="conversation-builder-overview.html#access-conversation-builder">Access Conversation Builder</a>.</li>
  <li>From the Bots dashboard, click <strong>New Bot</strong> in the upper-right corner.</li>
  <li>In the Choose a Bot Template window, select <strong>Survey Bot</strong>.</li>
  <li>In the Survey Bot window, specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a name for the bot that's concise and clear.</li>
      <li><strong>Description</strong>: Enter a description that's meaningful to you and others.</li>
      <li><strong>Bot Language</strong>: Select a language.</li>
      <li><strong>Skill</strong>: Select the skill(s) that will trigger this survey bot. You can use the available controls to sort and filter the skills and to search for a skill. A skill can be assigned to only one survey bot. You can add skills in Conversational Cloud.</li>
    </ul>
  </li>
  <li>
    <p>Click <strong>Create Bot</strong>.</p>

    <p>This creates a survey bot that includes a single dialog of type "Survey" (that's also named "survey" by default). Define the survey in this dialog.</p>

    <p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/surveyBot_newSurvey.png" alt="The Survey dialog, with a pointer to the dialog name and a pointer to the survey-specific interactions on the Interactions tool palette" /></p>

    <p>For easy visibility, in the dashboard that lists your bots, the skill(s) assigned to a survey bot are listed beneath the bot name.</p>

    <p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/surveyBot_dashboard.png" alt="A survey bot as it appears on the Bots dashboard, with the assigned skill name just below the bot name" /></p>
  </li>
</ol>

<h3 id="build-out-the-survey-bot">Build out the survey bot</h3>

<p>In the dialog that's of type "Survey," define the survey. There are several types of survey questions:</p>

<h4 id="first-call-resolution-fcr">First Call Resolution (FCR)</h4>

<p>This question is used to measure operational efficiency in resolving consumer issues. This interaction asks a standard FCR question: <em>Were you able to resolve your inquiry today?</em> Feedback on this helps you to measure and improve agent/bot and skill performance.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_fcr.png" alt="An example of a First Call Resolution interaction" /></p>

<h4 id="customer-satisfaction-csat">Customer Satisfaction (CSAT)</h4>

<p>Customer Satisfaction (CSAT) metrics are used to measure the frequency at which your brand meets or exceeds consumer expectations. This interaction asks a standard CSAT question: <em>How would you rate your overall satisfaction with the service you received?</em></p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_csat.png" alt="An example of a Customer Satisfaction interaction" /></p>

<h4 id="net-promoter-score-nps">Net Promoter Score (NPS)</h4>

<p>Net Promoter Score (NPS) metrics are commonly used to measure the loyalty of a consumer to a brand. This interaction asks a standard NPS question: <em>Based on your experience today, how likely are you to recommend us to a friend or colleague?</em></p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_nps.png" alt="An example of a Net Promoter Score interaction" /></p>

<h4 id="closed-ended-custom">Closed-ended, custom</h4>

<p>A closed-ended question is a multiple choice question that has a custom, predefined list of answer choices. Use this interaction when you need quantifiable data and want to categorize your consumers.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_closed.png" alt="An example of a closed-end, custom interaction" /></p>

<p>In the closed-ended question, every answer choice has two values:</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_closed2.png" alt="The Text value and Reporting value for an answer choice in a closed-ended, custom interaction" /></p>

<ul>
  <li><strong>Text value</strong>: This value is shown to the consumer as the answer choice.</li>
  <li><strong>Reporting value</strong>: When the answer choice is selected by the consumer, this value is reported in Analytics Builder.</li>
</ul>

<p>As you can see from the Acknowledgment checkbox in the image above, changing the <strong>Reporting value</strong> causes answer IDs to be regenerated. Therefore, if you change the <strong>Reporting value</strong>, you'll need to update accordingly any custom reports that are based on answer IDs.</p>

<h4 id="open-ended-custom">Open-ended, custom</h4>

<p>An open-ended question allows the consumer to provide an answer in their own words, instead of being constrained by a predefined list of answer choices. Use this interaction when you want to offer the opportunity for this type of free-form feedback.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_open.png" alt="An open-ended, custom interaction" /></p>

<h4 id="all-survey-questions">All survey questions</h4>

<ul>
  <li>Cannot be changed from one interaction type to another.</li>
  <li>Have a limit of 256 characters for the survey question.</li>
  <li>Support any emojis. Just copy and paste them in, but remember to update the rules accordingly.</li>
</ul>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_emoji1.png" alt="An example of emoji use in a Customer Satisfaction interaction" />
<img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_emoji2.png" alt="An example of updating the rules accordingly in the interaction when its changed to use emojis" /></p>

<h4 id="fcr-csat-and-nps-questions">FCR, CSAT and NPS questions</h4>

<ul>
  <li>These are predefined in the sense that you can't edit their structure, i.e., add or remove answer choices. However, you can change the question and answer text.</li>
  <li>In a survey bot, you can include only one of each of these.</li>
  <li>You can add a skip option to each of these.</li>
</ul>

<h4 id="closed-ended-and-open-ended-custom-questions">Closed-ended and open-ended, custom questions</h4>

<ul>
  <li>In a survey bot, you can include as many of these as required.</li>
  <li>You can add a skip option to closed-ended questions but not to open-ended questions.</li>
</ul>

<p class="attn-note">When the target channel is Apple Messages for Business, applicable survey questions are automatically sent to the consumer as List Picker interactions.</p>

<h4 id="customize-interaction-text-fcr-csat-and-nps">Customize interaction text (FCR, CSAT and NPS)</h4>

<p>You can customize the question text and the answer choice text for the FCR, CSAT and NPS interactions. To do so, simply replace the text with your own. For example, you might want to change the language that’s used.</p>

<p>When working with the answer choices, if you move your mouse over an answer, you can see both the answer text (text value) and the actual, underlying value that’s reported to <a href="https://community.liveperson.com/kb/articles/1098-analytics-builder-overview">Analytics Builder</a>.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_actualvalue1.png" alt="The tooltip that shows the Text value and Actual value for an answer choice when you move your mouse over an answer" /></p>

<p>The actual value never changes, not even when you change the answer text (text value).</p>

<p class="attn-note">Take care when changing the answer text; remember to update the conditions in the rules accordingly.</p>

<h4 id="reorder-answer-choices-fcr-csat-and-nps">Reorder answer choices (FCR, CSAT and NPS)</h4>

<p>Reordering an answer choice has no impact on its text value or actual value. You must manually change the answer text (text value) if desired. The actual value never changes.</p>

<p>To reorder an answer choice, select it so that it’s in focus, and click the “&lt;” (Previous) or “&gt;” (Next) button.</p>

<p><img class="fancyimage" style="width:350px" src="img/ConvoBuilder/surveyBot_reorderanswers.png" alt="The left and right arrow buttons you can use to reorder answer choices" /></p>

<p>Alternatively, you can use the hotkeys:</p>

<ul>
  <li>Previous = Shift + Ctrl</li>
  <li>Next = Shift + Alt</li>
</ul>

<h4 id="make-survey-questions-optional">Make survey questions optional</h4>

<p>To add a Skip option to an FCR, CSAT or NPS question and thereby make the question optional, click the <strong>+Skip</strong> response and turn it from Off (blue) to On (white).</p>

<p><img class="fancyimage" style="width:350px" src="img/ConvoBuilder/surveyBot_skip.png" alt="The Skip option you can turn on to make a survey question optional" /></p>

<p>Clicking <strong>Skip</strong> automatically adds a custom rule for the "skip" response, so you can build out the survey logic as you require.</p>

<p>To add a Skip option to a closed-ended, custom question, manually add "Skip" as one of the answer choices. This too adds a custom rule for the "skip" response, so you can build out the survey logic as you require.</p>

<p>You cannot add a Skip opton to an open-ended, custom question.</p>

<p class="attn-note">In an NPS interaction, don't enable Skip if your targeted channel is Facebook. Facebook doesn't support structured content that has more than 11 quick replies. The NPS question plus the Skip option is 12 quick replies. Using Skip will cause the conversation to end abruptly.</p>

<h4 id="configure-the-display-format">Configure the display format</h4>

<p>In the <strong>Advanced Settings</strong> of many of the survey interactions, you can configure several display settings:</p>

<ol>
  <li>Display Choices As</li>
  <li>Choices per Row</li>
  <li>Text Only Fallback → List Style for Choices</li>
</ol>

<p>1 — Use the <strong>Display Choices As</strong> setting to specify whether and how to send the answer choices to the consumer. You can select:</p>

<ul>
  <li><strong>Quick Reply</strong>: Select this to send the answer choices as quick replies in channels that support them. In text-based channels, the format specified in <strong>List Style for Choices</strong> will be used.</li>
  <li><strong>Button</strong>: Select this to send the answer choices as buttons in channels that support them. In text-based channels, the format specified in <strong>List Style for Choices</strong> will be used.</li>
  <li><strong>Do not display</strong>: Select this to hide the answer choices in <em>all</em> channels. Only the survey question will be sent to the consumer. If you select this, the <strong>List Style for Choices</strong> setting plays no role.</li>
</ul>

<p><img style="width:500px" src="img/ConvoBuilder/surveyBot_displayChoices.png" alt="An illustration of the visual rendering of quick replies versus buttons, for comparison purposes" /></p>

<p>2 — The <strong>Choices per Row</strong> setting is available when you select to display the choices as quick reply "chips" (in <strong>Display Choices as</strong>). Select the number of answer choices to present in a single row in the Web Messaging channel. Example: You have 8 answer choices, and you select "3" here. So, 3 choices will be presented in the first row, 3 in the second row, and the remaining 2 in the last row. Note that a maximum of 3 rows are used; the third row includes all the answer choices not included in the first 2 rows. <strong>Important</strong>: Used in Web messaging only. In all other channels, all choices are on 1 row.</p>

<p>3 — When you deploy your survey bot to a channel that doesn't support rich content formatting (for example, SMS), the survey questions are automatically sent as plain text. Use the <strong>List Style for Choices</strong> setting to control how the choices are presented in a text-only fallback scenario. You can select:</p>

<ul>
  <li><strong>1. 2. 3. 4.</strong> or <strong>a. b. c. d.</strong>: Select either of these to send the answer choices using the indicated format. For the Net Promoter Score (NPS) interaction in specific, we recommend the letter format. The numeric format can confuse consumers because the NPS scores themselves range from 0 to 10 (note they start with zero), but the numeric format starts numbering the options with 1. Since these don’t match, selecting a score can be confusing.</li>
  <li><strong>no list</strong>: Select this to hide the answer choices. Only the survey question will be sent to the consumer. In the question, make sure to include information on how to respond (e.g., “type 1 for very bad, 5 for excellent, or something in-between.”).</li>
</ul>

<h4 id="handle-free-text-answers">Handle free text answers</h4>

<p>The handling of free text answers works in a survey bot just like it does in a custom bot. For example, when presented with the CSAT yes/no question, if the consumer types "yes" or "Yes" instead of selecting "Yes," the response is understood. If the consumer enters anything else, the fallback response is sent. You can use conditions to catch other patterns if desired.</p>

<h4 id="handle-unrecognizable-responses">Handle unrecognizable responses</h4>

<p>In the survey interactions in a survey bot, the fallback response is required, and there's a default value provided.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/surveyBot_fallback.png" alt="The Message When Response Unrecognized field in the Advanced settings of a survey interaction" /></p>

<p>You can customize the default fallback responses in the survey interactions.</p>

<p>You cannot create a <a href="conversation-builder-dialogs-fallback-dialogs.html">Fallback dialog</a>.</p>

<h4 id="add-standard-interactions">Add standard interactions</h4>

<p>You can use only a subset of the standard interaction types in the Survey dialog; unavailable interactions are hidden from view on the toolbar.</p>

<h3 id="configure-the-survey-bots-settings">Configure the survey bot's settings</h3>

<p><a href="conversation-builder-bots-bot-basics.html#configure-bot-settings">Learn about basic bot settings and how to configure bot settings.</a></p>

<p>Settings that are specific to survey bots include:</p>

<ul>
  <li><strong>Skill</strong>: If desired, change the skill(s) that will trigger this survey bot. You can use the available controls to sort and filter the skills and to search for a skill.</li>
  <li><strong>Max number of fallback responses</strong>: Consumer responses that are repeatedly unrecognized by the bot result in a loop where the fallback response is sent repeatedly. This setting stops the loop and closes the survey. You can specify the maximum number of fallback responses to send (the default is 3) before closing the survey. You can't specify zero to disable this behavior; it is always on. You can customize the closing message that is sent just before the survey is closed.</li>
  <li><strong>Target Interactive Conversations</strong>: Use this setting to override, on a per bot basis, the rules for targeting surveys based on consumer engagement. When this setting is disabled, the account-level <strong>Target Interactive Conversations</strong> setting that's set in <strong>Account Details</strong> in the Bot Accounts application is used. However, when this bot-level setting is enabled, it has priority over the account-level setting. This bot-level setting works just like the account-level setting. For more details, see the discussion on <em>configuring account-level settings</em> farther above on this page.</li>
  <li><strong>Email Transcript</strong>: Enable this to offer an emailed transcript of the survey to the consumer. For more on this, see farther below.</li>
  <li><strong>Thank You Message</strong>: Enable this to send a Thank You message before the survey conversation is closed. For more on this, see farther below.</li>
  <li><strong>Session Expired Message</strong>: Enable this to customize the message to the consumer that's proactively sent when the session expires. You can customize the message to suit your requirements. If you disable this setting, the default message is proactively sent instead of a custom message. The default message is, "The survey has expired. Thank you for your time." (See also the <a href="conversation-builder-bots-bot-basics.html#configure-bot-settings">Session Length setting</a>, a related setting that's displayed for all bots.)</li>
</ul>

<h3 id="add-support-for-emailed-transcripts">Add support for emailed transcripts</h3>

<p>If desired, you can add support for emailing a transcript of the main conversation to the consumer, and grant the consumer the option to accept or decline this at the end of the survey.</p>

<p><img class="fancyimage" style="width:300px" src="img/ConvoBuilder/surveyBot_offerTranscript.png" alt="An example conversation with the consumer where the consumer is offered an emailed transcript" /></p>

<p>There are a few steps involved in the setup.</p>

<p>First, there are some configuration steps to complete to allow LivePerson’s email servers to send emails to your consumers on your behalf.</p>

<p>To prevent phishing and spoofing attacks, many email providers enforce strict security measures, requiring that incoming emails be authenticated using the Sender Policy Framework (SPF) together with DomainKeys Identified Mail (DKIM).</p>

<h4 id="about-spf-and-dkim">About SPF and DKIM</h4>

<p><em>SPF</em> is a protocol that allows the owner of a domain to specify which mail servers are permitted to send emails on behalf of that domain. It works by adding a DNS record that lists the IP addresses or hostnames of authorized mail servers. When an email is received, the receiving mail server checks the SPF record to verify that the email came from an authorized server. If the email's origin matches the SPF record, it's considered legitimate; otherwise, it may be marked as spam or rejected.</p>

<p><em>DKIM</em> is an authentication method that allows the sender to sign their emails with a digital signature. The signature is added to the email headers and is created using a private key. The corresponding public key is published in the domain's DNS records. When the email is received, the receiving server can use the public key to verify the signature, ensuring that the email has not been altered in transit and that it indeed comes from the claimed domain. This helps confirm the integrity and authenticity of the message.</p>

<h4 id="adding-support-for-spf-plus-dkim">Adding support for SPF plus DKIM</h4>

<p>To use LivePerson’s email servers, you must set up support for SPF plus DKIM. Follow this workflow:</p>

<ol>
  <li>
    <p><strong>Contact your LivePerson representative</strong> to request support for SPF plus DKIM. Provide us with the email address of your administrator. You’ll also need to provide the name of your Domain Name Server (DNS) host. This is the domain that you want to authenticate, e.g., mycompanyname.com. Often, but not always, this is the same place that you host your website.</p>
  </li>
  <li>
    <p><strong>LivePerson will configure</strong> the backend to use a specific outgoing email server that supports SPF and DKIM.</p>
  </li>
  <li>
    <p><strong>LivePerson will prepare</strong> the necessary DNS records for you to add to your domain’s configuration as a part of DKIM setup and send them to the email address that you provided in step 1.</p>
  </li>
  <li>
    <p><strong>Set up SPF and DKIM</strong> as instructed below.</p>
  </li>
</ol>

<h5 id="setting-up-spf">Setting up SPF</h5>

<p>Access your domain’s Domain Name System (DNS) settings, and create a new SPF record or update your existing SPF record.</p>

<p>If you don't have an existing SPF record, publish the following SPF record:</p>

<p><code class="language-html highlighter-rouge">v=spf1 include:sendgrid.net -all</code></p>

<p>If you already have an existing SPF record, insert <code class="language-html highlighter-rouge">include:sendgrid.net</code> right before the terminating mechanism in the record. For example, if your current SPF record looks like this:</p>

<p><code class="language-html highlighter-rouge">v=spf1 a -all</code></p>

<p>Then update it to:</p>

<p><code class="language-html highlighter-rouge">v=spf1 a include:sendgrid.net -all</code></p>

<h5 id="setting-up-dkim">Setting up DKIM</h5>

<p>Access your domain’s Domain Name System (DNS) settings, and add the DNS records that you received from LivePerson (step 3 above) to your configuration.</p>

<p class="attn-note">It can take up to 48 hours for the records to be verified after you upload them into your DNS host, so you will likely have to come back later to verify everything is working.</p>

<h4 id="adding-support-for-emailed-transcripts-to-the-bot">Adding support for emailed transcripts to the bot</h4>

<p>Open the post-conversation survey bot. In the bot's <a href="conversation-builder-bots-bot-basics.html#configure-bot-settings">Bot Settings</a>, enable the <strong>Email Transcript</strong> bot setting. This adds an Email Transcript survey interaction to the end of the survey dialog.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_email1.png" alt="The Email Transcript survey interaction that gets added to the end of the dialog" /></p>

<p>(Disabling the bot setting removes the Email Transcript interaction from the dialog. And if you manually delete the interaction, this disables the bot setting.)</p>

<p>Next, configure the Email Transcript interaction:</p>

<ul>
  <li>Change the message text and the label for the Decline button as desired.</li>
  <li>
    <p>Configure the interaction's basic and advanced settings. Most notably, specify the <strong>Sender Name</strong> and <strong>Sender Email</strong>. These are the name and email address from whom the consumer receives the email.</p>

    <p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_email2.png" alt="The settings in the Email Transcript interaction for specifying the sender name and sender email address" /></p>
  </li>
  <li>Keep the Next Action as "Close Dialog" (which is the default) to close the conversation if appropriate.</li>
</ul>

<p>Note the following:</p>

<ul>
  <li>For convenience, the Email Transcript interaction includes two default rules. One rule uses a Regular Expression to validate whether the consumer has entered a valid email address. If you inadvertently delete this rule, you can easily add it back manually; to enter the RegEx, use the "Hints" feature that's available.</li>
  <li>The Email Transcript interaction can precede or follow a Thank You Message interaction (discussed below), if used. However, the two must be last in the dialog flow. You can <a href="conversation-builder-interactions-interaction-basics.html#move-an-interaction">move</a> them to reorder them, but this constraint is enforced.</li>
</ul>

<h3 id="add-support-for-a-thank-you-message">Add support for a Thank You message</h3>

<p>If desired, you can add support for sending a Thank You message to the consumer at the end of the survey.</p>

<p><img class="fancyimage" style="width:300px" src="img/ConvoBuilder/surveyBot_thanks1.png" alt="An example conversation where the consumer is thanked by the survey bot" /></p>

<p>There are a few steps involved in the setup.</p>

<p>First, in the bot's <a href="conversation-builder-bots-bot-basics.html#configure-bot-settings">Bot Settings</a>, enable the <strong>Thank You Message</strong> bot setting. This adds a Thank You Message interaction to the end of the survey dialog.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/surveyBot_thanks2.png" alt="An example of a Thank You Message interaction that gets added to the end of the dialog" /></p>

<p>(Disabling the bot setting removes the Thank You Message interaction from the dialog. And if you manually delete the interaction, this disables the bot setting.)</p>

<p>Second, configure the Thank You Message interaction:</p>

<ul>
  <li>Enter the Thank You message.</li>
  <li>Configure the interaction's basic and advanced settings.</li>
  <li>Keep the Next Action as "Close Dialog" (which is the default) to close the conversation if appropriate.</li>
</ul>

<p>The Thank You Message interaction can precede or follow an Email Transcript interaction (discussed above), if used. However, the two must be last in the dialog flow. You can <a href="conversation-builder-interactions-interaction-basics.html#move-an-interaction">move</a> them to reorder them, but this constraint is enforced.</p>

<h3 id="close-the-survey-conversation">Close the survey conversation</h3>

<p>Close a survey conversation by setting <a href="conversation-builder-dialogs-dialog-basics.html#close-the-conversation-and-trigger-a-survey">Close Dialog</a> as the Next Action in the final interaction in the survey dialog.</p>

<p class="attn-note">Make sure that a custom bot <em>that triggers a survey bot</em> also uses Close Dialog. <a href="conversation-builder-dialogs-dialog-basics.html#close-the-conversation-and-trigger-a-survey">Close Dialog</a> allows a post-conversation survey to be triggered, but <a href="conversation-builder-dialogs-dialog-basics.html#close-the-conversation">Close Conversation</a> does not.</p>

<h3 id="deploy-the-survey-bot">Deploy the survey bot</h3>

<p>You don't manually deploy a survey bot. When LivePerson enables this feature for your brand, this deploys the underlying agent connector that's shared by all survey bots. Therefore, <strong>as soon as you create a survey bot and assign it a skill, the bot is active and can receive conversations.</strong> Typically, brands don't develop in their Production environments, but if you do, for this reason, it's recommended that you assign to the survey bot a "test" skill that isn't used in a production campaign and use that to validate the bot before assigning it a production skill.</p>

<h3 id="trigger-the-survey-bot">Trigger the survey bot</h3>

<p>In order to trigger the survey, start a conversation on the account and skill on which you’ve defined the survey and bring the conversation to an end, either from the consumer or the agent side. Once the conversation closes, the survey will be triggered, and the agent workspace will show the caption, “Survey in progress.”</p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/surveyBot_triggerSurvey.png" alt="The Survey in progress indicator in the Agent Workspace" /></p>

<p>While the survey is active the agent won’t be able to write in the conversation. The survey will end when the consumer finishes entering the survey (if you've specified "Close Conversation" as the next action) or when the survey times out. In cases of an error with the survey flow or the survey bot, Conversational Cloud will close the survey after 48 hours as part of a conversation cleanup process.</p>

<h3 id="the-agent-experience">The agent experience</h3>

<p>Once a conversation ends and a survey begins, the conversation no longer appears in the <strong>Open Conversations</strong> list in Conversational Cloud. Instead, it appears in the <strong>All Conversations</strong> list with a status that indicates the survey is in progress:</p>

<p><img class="fancyimage" style="width:850px" src="img/ConvoBuilder/surveyBot_agent1.png" alt="The All Conversations list with a pointer to the status icon that indicates a survey is in progress for the conversation" /></p>

<p>If an agent has permissions to view survey results, the agent can see the survey transcript.</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/surveyBot_agent2.png" alt="An example of the survey transcript that the agent can see" /></p>

<h3 id="the-manager-experience">The manager experience</h3>

<p>In the <strong>Conversations panel</strong> of the <strong>Manager Workspace</strong>, managers can view the survey scores (CSAT and NPS only) for all conversations shown.</p>

<p><img class="fancyimage" style="width:1000px" src="img/ConvoBuilder/surveyBot_manager1.png" alt="The survey metrics that the agent manager can see in the Manager Workspace" /></p>

<h3 id="reporting">Reporting</h3>

<h4 id="analytics-builder">Analytics Builder</h4>

<p>Metrics from survey questions are captured in Conversational Cloud and exposed via the <a href="https://community.liveperson.com/kb/articles/1098-analytics-builder-overview">Analytics Builder</a> application. You'll find this information in the predefined <a href="https://community.liveperson.com/kb/articles/1461-survey-dashboard-for-messaging">Survey Dashboard for Messaging</a>, which you can use out-of-the-box or manipulate to create customized reports.</p>

<h4 id="bot-analytics">Bot Analytics</h4>

<p>In the <a href="bot-analytics-overview.html">Bot Analytics</a> application, you'll see survey bots reported in the same way as custom bots. There is no difference between the two.</p>

<h4 id="report-of-ids">Report of IDs</h4>

<p>If you make use of survey, question, and answer IDs in your reporting, you can download a report on these for a given survey bot. In Conversation Builder, open the survey bot, access the <strong>Bot Settings</strong>, scroll down to <strong>Generate IDs report</strong>, and click the <strong>Download</strong> icon. This type of report is often helpful for users that have migrated from Bot Studio to Conversation Builder for creation and management of survey bots. It can help you quickly build or rebuild custom reports that use the IDs.</p>

<h3 id="monitoring">Monitoring</h3>

<p>If you have Bot Status Access <a href="conversation-builder-bot-accounts-permissions.html">permissions</a>, you can use the Bot Status application that's intended for monitoring agent connectors to <a href="conversation-builder-bot-status-manage-post-conversation-survey-bots.html">monitor your survey bots</a>. In Bot Status, you can redeploy the connector as a troubleshooting technique.</p>

<h3 id="troubleshooting">Troubleshooting</h3>

<p>Sometimes, an interaction in a survey bot gets into a state where its ID isn’t synchronized with underlying systems. This can adversely affect reporting. You can fix this situation quickly with the <img class="inlineimage" style="width:25px" alt="Refresh icon" src="img/ConvoBuilder/icon_pcs_synchids.png" /> (Synchronize interaction ID) icon that dynamically appears:</p>

<p><img style="width:700px" src="img/ConvoBuilder/surveyBot_synchids.png" alt="In interaction, a warning icon in lower-right corner is displayed when there's an issue with interaction's ID. Click refresh button in upper-right corner to synchronize ID and resolve issue." /></p>

<h3 id="faqs">FAQs</h3>

<h4 id="how-do-i-disable-a-survey-bot">How do I disable a survey bot?</h4>

<p>If you need to temporarily remove a survey bot from your customer traffic flow (i.e., prevent it from triggering), access the bot's <strong>Skill</strong> setting in <strong>Bot Settings</strong>, and assign a test skill or any unused skill.</p>

<h4 id="are-survey-bots-supported-in-text-only-channels">Are survey bots supported in text-only channels?</h4>

<p>Yes, this works just like for a custom bot. The survey questions are displayed as plain text.</p>

<h4 id="can-a-consumer-skip-a-survey-entirely">Can a consumer skip a survey entirely?</h4>

<p>There's no way for the consumer to indicate they want to skip the survey entirely (e.g., no Skip button). However, the consumer can close the window to leave the survey.</p>

<h4 id="if-a-consumer-starts-then-abandons-a-survey-what-gets-captured">If a consumer starts, then abandons a survey, what gets captured?</h4>

<p>Responses are counted (captured) as they are sent. If, for example, the consumer answers the first 2 of 5 survey questions, then the results would still include the first 2.</p>
]]></description>
      <!-- <pubDate>Tue, 24 Feb 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Import Content</title>
      <link>https://developers.liveperson.com/knowledgeai-internal-knowledge-bases-import-content.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-internal-knowledge-bases-import-content.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="best-practices">Best practices</h3>

<p><a href="knowledgeai-best-practices.html">Learn best practices for using KnowledgeAI.</a></p>

<h3 id="integrate-with-a-kms-or-cms">Integrate with a KMS or CMS</h3>

<p><a href="knowledgeai-internal-knowledge-bases-integrate-a-kms-or-cms.html">Integrating with KMS or CMS</a> is a great way to get content into a knowledge base in KnowledgeAI™ and manage it over time because this approach is very powerful.</p>

<h3 id="import-content-from-a-csv-file">Import content from a CSV file</h3>

<p class="attn-alert">When creating one knowledge base based off of another, don't reuse the same CSV file for a second knowledge base in the same hosted region. The article IDs must be unique within the region. In the file for the second knowledge base, clear the article IDs; the application will create article IDs for new articles.</p>

<h4 id="import-csv">Import CSV</h4>

<ol>
  <li>
    <p>When you <a href="knowledgeai-internal-knowledge-bases-knowledge-bases.html#add-an-internal-knowledge-base">add the knowledge base</a>, for <strong>Content source</strong>, select “CSV.” Then browse to and upload the CSV file. (For details on creating a CSV import file, see the section farther below in this article.)</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_importcsv1.png" alt="Add knowledge base dialog with a callout to the Import content from setting" /></p>
  </li>
  <li>
    <p>Click <strong>Save</strong>.</p>

    <p>If the system finds errors in the CSV file you are importing, you’re notified of this and offered a <strong>Download errors</strong> button. Use the button to download info on the errors that were found in the import file. Make sure your browser is configured to allow pop-ups, or you won’t be able to complete the download.</p>
  </li>
</ol>

<h3 id="import-content-from-a-google-sheet">Import content from a Google sheet</h3>

<p>To import content from a Google sheet, the sheet must be public, i.e., with no file restrictions in place.</p>

<p class="attn-alert">When creating one knowledge base based off of another, don't reuse the same Google sheet for a second knowledge base in the same hosted region. The article IDs must be unique within the region. In the file for the second knowledge base, clear the article IDs; the application will create article IDs for new articles.</p>

<h4 id="import-google-sheet">Import Google sheet</h4>

<ol>
  <li>
    <p>When you <a href="knowledgeai-internal-knowledge-bases-knowledge-bases.html#add-an-internal-knowledge-base">add the knowledge base</a>, for <strong>Content source</strong>, select “Google Sheet.” Then specify the Google sheet to upload. (For details on creating the import file, see the section farther below in this article.)</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_importgsheet1.png" alt="Add knowledge base dialog with a callout to the Import content from setting" /></p>
  </li>
  <li>
    <p>Click <strong>Save</strong>.</p>
  </li>
</ol>

<h3 id="create-an-import-file-csv-or-google-sheet">Create an import file (CSV or Google sheet)</h3>

<p>If you want to import a set of articles into a knowledge base when you add the knowledge base, you'll need to create the import file.</p>

<p><img class="fancyimage" style="width:800px" alt="An example of a well-formed import file" src="img/ConvoBuilder/kb_importFile.png" /></p>

<p class="attn-note">The import file can contain <a href="knowledgeai-internal-knowledge-bases-articles.html#format-text-in-an-article">a subset of HTML</a>, and it should adhere to <a href="knowledgeai-limits.html">these limits</a>. Additionally, as a best practice, ensure the file is saved as a UTF-8 encoded CSV file before you import it. This is particularly important if you need to support special language characters (e.g., ö, ü, ß).</p>

<p><strong>To create an import file</strong></p>

<ol>
  <li>Create a new CSV file or Google sheet. A Google sheet must be public, i.e., with no file restrictions in place.</li>
  <li>Add the column headers listed below; use the order listed in the table below.</li>
  <li>Fill out the rows with your article data. It's recommended that you complete at least these columns: title, summary, detail, tags, and alternates (if using Knowledge Base intents) or intentName (if using Domain intents).</li>
</ol>

<h4 id="column-headers">Column headers</h4>

<table>
  <thead>
    <tr>
      <th>Column header name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>id</td>
      <td>A String; a unique ID assigned to an article. <br /><br />This column isn't required when you initially create the knowledge base. However, if you're using a Google sheet that you plan to sync periodically, it does play a role then. Before performing a sync, update the Google sheet to include the "id" column and enter the IDs for all existing articles.<br /><br />When creating one knowledge base based off of another, don't reuse the same CSV import file or Google sheet for a second knowledge base in the same hosted region. The article IDs must be unique within the region. In the file for the second knowledge base, clear the article IDs; the application will create article IDs for new articles.</td>
    </tr>
    <tr>
      <td>tags</td>
      <td>A comma-separated list of relevant keywords. These highlight the key noun(s) or word(s) in the training phrases. For example, for an article about health insurance, the tags should be "health", “insurance”, “benefits”. These should be words, not sentences.</td>
    </tr>
    <tr>
      <td>title</td>
      <td>The article title. This should be a complete sentence or question that the user might ask. Adhere to <a href="knowledgeai-best-practices.html">best practices</a>. <a href="knowledgeai-limits.html#article-level-limits-for-internal-knowledge-bases">Learn about the limit for the number of characters.</a></td>
    </tr>
    <tr>
      <td>summary</td>
      <td>A short response or message to be sent to the user. You can include web links, although depending on the channel they might not display correctly. For SMS/Messaging, you might need to show the URL by itself, not wrapped in HTML, since the HTML will be sent as plain text over these channels. <br /><br /> <code class="language-html highlighter-rouge">summary</code> is a required field, so if you leave it empty, a truncated version of <code class="language-html highlighter-rouge">detail</code> is populated in <code class="language-html highlighter-rouge">summary</code>. The content is truncated to the nearest punctuation and <a href="knowledgeai-limits.html#article-level-limits-for-internal-knowledge-bases">character limit</a>. Since the content of <code class="language-html highlighter-rouge">detail</code> is merely truncated and used for <code class="language-html highlighter-rouge">summary</code>, it might not be ideal. We recommend that you compose a well-written summary (see our <a href="knowledgeai-best-practices.html#adding-articles">best practices</a>). Many brands use Generative AI to accomplish this task.</td>
    </tr>
    <tr>
      <td>alternates</td>
      <td>Applicable if you're using <a href="knowledgeai-internal-knowledge-bases-introduction.html#domain-intents-versus-knowledge-base-intents">Knowledge Base intents</a>, not Domain intents. In the UI, these are called "intent qualifiers." Intent qualifiers are alternative ways that people ask for the article, i.e., alternative ways to communicate the same intent. Adhere to <a href="knowledgeai-best-practices.html">best practices</a>. <strong>Important note</strong>: As of March 5, 2021, you can no longer create a knowledge base that uses Knowledge Base intents. So "alternates" are only relevant to a limited subset of brands.</td>
    </tr>
    <tr>
      <td>detail</td>
      <td>A longer message to the user. For messaging, it's recommended that you keep the responses as brief as possible. <a href="knowledgeai-limits.html#article-level-limits-for-internal-knowledge-bases">Learn about the limit for the number of characters.</a></td>
    </tr>
    <tr>
      <td>content_url</td>
      <td>The URL of a hyperlink. For info on usage, see <a href="knowledgeai-internal-knowledge-bases-articles.html#add-content-links">this section</a>.</td>
    </tr>
    <tr>
      <td>image_url</td>
      <td>The URL of an image. For info on usage, see <a href="knowledgeai-internal-knowledge-bases-articles.html#add-content-links">this section</a>.</td>
    </tr>
    <tr>
      <td>audio_url</td>
      <td>The URL of an audio file. For info on usage, see <a href="knowledgeai-internal-knowledge-bases-articles.html#add-content-links">this section</a>.</td>
    </tr>
    <tr>
      <td>video_url</td>
      <td>The URL of a video file. For info on usage, see <a href="knowledgeai-internal-knowledge-bases-articles.html#add-content-links">this section</a>.</td>
    </tr>
    <tr>
      <td>category</td>
      <td>Assigning a category lets you <a href="knowledgeai-internal-knowledge-bases-articles.html#find-articles-with-a-specific-category">filter and find articles based on categories</a> in the KnowledgeAI application. Additionally, during a search, <a href="knowledgeai-key-terms-concepts-search-methods.html#how-does-ai-search-work">AI Search checks the input query against the category</a>. Use only alphanumeric and underscore characters in the category name; only these are permitted.</td>
    </tr>
    <tr>
      <td>intentName</td>
      <td>Applicable if you're using <a href="knowledgeai-internal-knowledge-bases-introduction.html#domain-intents-versus-knowledge-base-intents">Domain intents</a>, not Knowledge Base intents. This is the intent associated with the article.</td>
    </tr>
    <tr>
      <td>validFrom</td>
      <td>Specify the date and time on which the article becomes <a href="knowledgeai-internal-knowledge-bases-introduction.html#active-versus-inactive-articles">active</a> in Epoch time in milliseconds.</td>
    </tr>
    <tr>
      <td>validTo</td>
      <td>Specify the date and time on which the article becomes <a href="knowledgeai-internal-knowledge-bases-introduction.html#active-versus-inactive-articles">inactive</a> in Epoch time in milliseconds.</td>
    </tr>
  </tbody>
</table>

<h3 id="update-content">Update content</h3>

<p>When updating content in knowledge bases, be mindful that you can’t mix content types within a knowledge base.</p>

<table>
  <thead>
    <tr>
      <th>Content type</th>
      <th>How updates are made</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>KMS or CMS</td>
      <td><a href="knowledgeai-internal-knowledge-bases-integrate-a-kms-or-cms.html#key-customization-points">Schedule updates automatically.</a></td>
    </tr>
    <tr>
      <td>CSV file</td>
      <td>Perform updates manually within the knowledge base. Or, use the <strong>Source</strong> page to replace the CSV file.<br /><br /><em>Replacing</em> the file means replacing all the content in the knowledge base with that in a different file. Articles will be added, updated, and deleted, all based on the contents in the new file. New articles are enabled by default, so ensure the content is suitable before you replace the CSV file.</td>
    </tr>
    <tr>
      <td>Google sheet</td>
      <td>In the knowledge base, use the <strong>Source</strong> page to sync the knowledge base with the contents of the Google sheet, or to replace the sheet with another.<br /><br /><em>Syncing</em> overwrites the content in the knowledge base with that in the sheet, so adds, updates, and deletes do occur. New articles are enabled by default, so ensure the content is suitable before you sync.<br /><br /><em>Replacing</em> the sheet means replacing all the content with that in a different sheet. Articles will be added, updated, and deleted, all based on the contents in the new sheet. Here again, new articles are enabled by default, so ensure the content is suitable before you replace the sheet.</td>
    </tr>
  </tbody>
</table>

<h3 id="delete-content">Delete content</h3>

<p>You can delete a knowledge base's source at any time, but be aware that this permanently deletes all of the articles that were created using the source.</p>

<p><img style="width:800px" alt="The Sources page within a knowledge base, with a callout to the Delete action link for a source" src="img/ConvoBuilder/kb_deleteSource1.png" /></p>

<p class="attn-note">Integrating with an external CMS/KMS? <a href="knowledgeai-internal-knowledge-bases-integrate-a-kms-or-cms.html#delete-content">Learn more about deleting content.</a></p>
]]></description>
      <!-- <pubDate>Fri, 20 Feb 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Parts of a Prompt</title>
      <link>https://developers.liveperson.com/trustworthy-generative-ai-prompt-library-parts-of-a-prompt.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/trustworthy-generative-ai-prompt-library-parts-of-a-prompt.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>Got questions about prompt configuration? This article provides info on all available fields that are exposed in the UI.</p>

<p>Also see our <a href="trustworthy-generative-ai-prompt-library-best-practices.html">best practices on writing and managing prompts</a>.</p>

<h3 id="important-note">Important note</h3>

<p>This article provides a comprehensive discussion of all of the settings that are available in the Prompt Library. However, every setting might not be available to you for a few reasons:</p>

<ul>
  <li>We've chosen to hide the setting in contexts where it isn't relevant. This makes the Prompt Library simpler to use and provides guardrails.</li>
  <li>We haven't yet had the opportunity to add support for the setting in some contexts (applications). Such cases are rare.</li>
</ul>

<h3 id="basic-settings">Basic settings</h3>

<p><img style="width:800px" src="img/PromptLibrary/prompt_tab_basic.png" alt="The Basic tab of a prompt" /></p>

<h4 id="name">Name</h4>

<p>Enter a short, descriptive name. The name must be unique.</p>

<p>Establish, document, and socialize a naming convention to be used by all prompt creators. Consider referencing the environment (Dev, Prod, etc.). Consider including a version number (v1.0, v2.0, etc.).</p>

<h4 id="description">Description</h4>

<p>Enter a meaningful description of the prompt’s purpose. If the prompt has been updated, describe the new changes. Also, list where the prompt is used in your solution, so you can readily identify the impact of making changes to the prompt. Consider identifying the prompt owner here. If the prompt is only used for testing, you might want to mention that. Generally speaking, include any info that you find useful.</p>

<h4 id="id">ID</h4>

<p>The ID of the prompt. This value is informational only.</p>

<h4 id="client-type">Client type</h4>

<p>The client type identifies the use case for the prompt, for example, Conversation Assist, Conversation Builder KnowledgeAI™ agent, etc.</p>

<p>For ease of use—and as a safeguard—the list of available client types depends on the application from which you access the Prompt Library. For example, if you open the Prompt Library from Conversation Assist, you’ll see only “Conversation Assist” client types in the list. We do this because the client type determines which variables are exposed for use in the prompt, as not all variables work (or make sense) in all use cases. So, we limit the client types based on your goal, i.e., based on the location from which you access the Prompt Library.</p>

<p>If there are multiple options available for <strong>Client type</strong>, select the intended use case:</p>

<ul>
  <li><strong>Auto Summarization</strong>: This use case involves <a href="https://community.liveperson.com/kb/articles/1571-conversation-copilot">LLM-generated summaries of ongoing and historical conversations</a>. These summaries make it possible for agents to swiftly catch up on conversations that are handled by bots or other agents. If you’re working on a prompt to support automatic summarization, select this.</li>
  <li><strong>Conversation Assist (Messaging)</strong>: This use case involves recommending answers from KnowledgeAI to agents as they converse with consumers. <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">The answers can be enriched by an LLM.</a> This results in answers that are not only grounded in knowledge base content, but also contextually aware and natural-sounding. If you’re working on a KnowledgeAI prompt to support Conversation Assist, select this.</li>
  <li><strong>Conversation Assist (Voice)</strong>: This is the same as immediately above except the use case involves the voice channel.</li>
  <li><strong>Copilot Rewrite</strong>: This use case involves enhancing agents' communications in the workspace by <a href="https://community.liveperson.com/kb/articles/1216-copilot-rewrite-overview">interpreting and refining their messages</a> for improved clarity and professionalism. If you're working on prompt to support this type of LLM-powered rewriting, select this.</li>
  <li><strong>Copilot Translate</strong>: This use case involves <a href="https://community.liveperson.com/kb/articles/2228-overview-of-copilot-translate">translating inbound and outbound messages</a> in real time: Consumer messages are automatically translated into the agent’s language, and agent messages are translated on demand into the consumer’s language. If you’re working on a translation prompt, select this.</li>
  <li><strong>KnowledgeAI agent (messaging bot)</strong>: This is the <a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html">KnowledgeAI agent</a> use case for a messaging channel, where you’re automating answers that are enriched by an LLM. Enriched answers are grounded in knowledge base content, contextually aware, and natural-sounding. If you’re working on a KnowledgeAI prompt to support this type of messaging bot, select this.</li>
  <li><strong>KnowledgeAI agent (voice bot)</strong>: This is the same as immediately above except the use case involves the voice channel.</li>
  <li><strong>Routing AI agent (messaging bot)</strong>: This is the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html">Routing AI agent</a> use case for a messaging channel. A Routing AI agent is an LLM-powered bot that’s specialized: It focuses on solving one specific problem in your contact center, namely, routing the consumer to the appropriate bot or agent that can help them with their query. If you’re working on a prompt that guides the LLM to discern the consumer’s intent and to route the consumer to the right flow for resolution of that intent, select this.</li>
  <li><strong>Routing AI agent (voice bot)</strong>: This is the same as immediately above except the use case involves the voice channel.</li>
</ul>

<h4 id="language">Language</h4>

<p>Select the language of the prompt. This value is informational only.</p>

<h4 id="editing-history">Editing history</h4>

<p>Every time you save a change to a prompt, a new version is created using a date|timestamp. This new version becomes the <a href="trustworthy-generative-ai-prompt-library-key-terms-concepts.html#released-prompts">released version</a>.</p>

<p>When you have a prompt open for edit, you can use the <strong>Editing history</strong> to refer back to earlier versions of the prompt. Just select an earlier version to view its properties and info.</p>

<p><img style="width:500px" src="img/PromptLibrary/prompt_editing_history.png" alt="The Editing History dropdown that lists all the versions of a prompt" /></p>

<p>If you make changes to any version and then save them, as mentioned above, this creates a new version with a date|timestamp. The new version becomes the <a href="trustworthy-generative-ai-prompt-library-key-terms-concepts.html#released-prompts">released version</a>.</p>

<h3 id="advanced-settings">Advanced settings</h3>

<p><img style="width:800px" src="img/PromptLibrary/prompt_tab_advanced1.png" alt="The Advanced tab of a prompt" /></p>

<p class="attn-note">The availability of <strong>Advanced</strong> settings is dependent on the prompt’s <strong>Client type</strong>.</p>

<h4 id="provider-subscription-and-llm">Provider, Subscription, and LLM</h4>

<p>If you’re just trialing our Generative AI features, or if your LivePerson plan doesn’t allow for it, this group of settings isn’t customizable. Contact your LivePerson representative if you’d like to change this.</p>

<h5 id="provider">Provider</h5>

<p>Select the provider of the LLM that you want to use.</p>

<h5 id="subscription">Subscription</h5>

<p>Select the subscription that represents the endpoint/resource that interacts with the LLM.</p>

<h5 id="llm">LLM</h5>

<p>Select the LLM to which to send requests when using this prompt. The list of options is dependent on the prompt's <strong>Client type</strong>.</p>

<p>If you want to <a href="trustworthy-generative-ai-bring-your-own-llm.html">use your own in-house LLM</a>, contact your LivePerson representative. We'll set that up for you.</p>

<h4 id="include-conversation-transcript">Include conversation transcript</h4>

<p><img style="width:325px" src="img/PromptLibrary/prompt_conv_context.png" alt="The prompt settings for including conversation context in the prompt" /></p>

<p>It’s optional to send some of the conversation transcript to the LLM so that the LLM can use it when generating a response. That said, doing so typically results in a contextually relevant response from the LLM and, therefore, a superior experience that’s more human-like.</p>

<p>Select <strong>Include conversation transcript</strong> to send the previous N turns in the conversation, where N is a number that you select (the minimum value is 1). Or, you can send the full conversation if possible, i.e., depending on the available <a href="trustworthy-generative-ai-prompt-library-key-terms-concepts.html#tokens">context window</a>. Note that a turn represents one complete exchange between the participants in the conversation. If only one person replies in a single exchange, the number of turns is rounded up. So, for example, the following is considered 2 turns:</p>

<p><em>Consumer</em>: Hi</p>

<p><em>Agent</em>: Hi there. How can I help?</p>

<p><em>Consumer</em>: I want to book a flight.</p>

<p>You can select <strong>Include conversation transcript</strong>, <strong>Include last user message</strong>, or neither. But you can't select both options at the same time.</p>

<p>Keep the following in mind:</p>

<ul>
  <li>The more turns you send, the higher the cost.</li>
  <li>The more turns you send, the more of the LLM’s <a href="trustworthy-generative-ai-prompt-library-key-terms-concepts.html#tokens">context window</a> is used for this info.</li>
  <li><strong>Less performant models</strong>: The more turns you send, the more likely the LLM is to stop following the prompt instructions. This is because there is greater distance between the top of the prompt (where the instructions are found) and the bottom of the prompt. It’s as if the LLM has “forgotten” what was first said. You can mitigate this risk by using the <strong>User content suffix</strong> tab to specify guidance. Doing this is like “reminding” the LLM of certain instructions.</li>
</ul>

<h4 id="include-last-user-message">Include last user message</h4>

<p><img style="width:325px" src="img/PromptLibrary/prompt_last_message.png" alt="The prompt setting for including the consumer's last message in the prompt" /></p>

<p>Select this to include only the most recent user message in the prompt.</p>

<p>You can select <strong>Include last user message</strong>, <strong>Include conversation transcript</strong>, or neither. But you can't select both options at the same time.</p>

<h4 id="max-tokens">Max. tokens</h4>

<p>The maximum number of output tokens to receive back from the LLM. There are several possible use cases for adjusting this value. For example, you might want shorter responses. Or, you might want to adjust this to control your costs, as output tokens are more expensive than input tokens.</p>

<p class="attn-alert">Take care when changing this value; setting it too low can result in truncated responses from the LLM.</p>

<h4 id="temperature">Temperature</h4>

<p>A floating-point number between 0 and 1, inclusive. You can edit this field to control the randomness of responses. The higher the number, the more random the responses. There are valid use cases for a higher number, as it offers a more human-like experience.</p>

<p>If you set this to zero, the responses are very deterministic: You can expect responses that are consistently the same every time.</p>

<h3 id="prompt">Prompt</h3>

<p><img style="width:800px" src="img/PromptLibrary/prompt_tab_instructions.png" alt="The Prompt tab within a prompt, where the instructions for the LLM go" /></p>

<p>The <strong>Prompt</strong> tab is where you write the system content, that is, the instructions to the LLM regarding what it should do with the conversation transcript and/or contextual input (for example, the matched articles from the knowledge base). This content can include:</p>

<ul>
  <li>The objective or goal of the prompt</li>
  <li>A clear, concise statement of the context</li>
  <li>Specific instructions or guidelines to direct the LLM’s response</li>
  <li>Examples or sample inputs that demonstrate the desired response</li>
  <li>The desired level of detail for the response</li>
  <li>Any relevant background or other info that’s important for generating an accurate and appropriate response from the LLM</li>
</ul>

<p>Review our <a href="trustworthy-generative-ai-prompt-library-best-practices.html">best practices for writing prompts</a>.</p>

<h3 id="variables">Variables</h3>

<p><a href="trustworthy-generative-ai-prompt-library-work-with-variables.html">Learn how to work with variables.</a></p>

<p><a href="trustworthy-generative-ai-prompt-library-variables-for-solutions.html">Learn about specific variables used in different Generative AI solutions in Conversational Cloud.</a></p>

<h3 id="user-content-suffix">User content suffix</h3>

<p><img style="width:800px" src="img/PromptLibrary/user_content_suffix_tab.png" alt="The User Content Suffix tab within a prompt, where instructions that you want reinfored for the LLM go" /></p>

<p>The purpose of the <strong>User content suffix</strong> tab is to allow you to append additional guidance for the LLM to the last user message that’s provided via the prompt. Just enter it like so:</p>

<p><img style="width:800px" src="img/PromptLibrary/user_content_suffix_tab2.png" alt="Specifying guidance in the User Content Suffix tab" /></p>

<p>Such guidance can be helpful to “remind” the LLM of certain instructions, for example, "Always refer to the consumer as <code class="language-html highlighter-rouge">{botContext_firstName}</code>."</p>

<p class="attn-note">If you’ve selected (on the <strong>Advanced</strong> tab) not to include the conversation transcript or the last user message in the prompt, the <strong>User content suffix</strong> tab is disabled. This is because there’s no opportunity to append guidance for the LLM to the last user message.</p>

<p>The power of the <strong>User content suffix</strong> capability is best explained by way of an example: Consider an ongoing conversation between a consumer speaking British English with a bot representing a company that’s based in the United States, where American English is spoken. The most recent input to the LLM looks like this:</p>

<p><code class="language-html highlighter-rouge">“role” : ”system”</code><br />
<code class="language-html highlighter-rouge">“content”: “You are a helpful assistant. Respond to the consumer’s questions using only the Knowledge Articles as the basis for your answers. Always respond in American English.”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “assistant”</code><br />
<code class="language-html highlighter-rouge">“content” : “Hi there! How can I help you today?”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “user”</code><br />
<code class="language-html highlighter-rouge">“content” : “Hi! Do you have any voucher codes available to use at checkout?”</code></p>

<p>The conversation continues on, and the next input looks like this:</p>

<p><code class="language-html highlighter-rouge">“role” : ”system”</code><br />
<code class="language-html highlighter-rouge">“content”: “You are a helpful assistant. Respond to the consumer’s questions using only the Knowledge Articles as the basis for your answers. Always respond in American English.”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “assistant”</code><br />
<code class="language-html highlighter-rouge">“content” : “Hi there! How can I help you today?”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “user”</code><br />
<code class="language-html highlighter-rouge">“content” : “Hi! Do you have any voucher codes available to use at checkout?”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “assistant”</code><br />
<code class="language-html highlighter-rouge">“content” : “Certainly! You can use coupon code ABC12345 when you checkout for 10% off.”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “user”</code><br />
<code class="language-html highlighter-rouge">“content” : “Brilliant! Is there a limit to how many items I can purchase with this voucher?”</code></p>

<p>But things go subtly awry in the next turn:</p>

<p><code class="language-html highlighter-rouge">“role” : ”system”</code><br />
<code class="language-html highlighter-rouge">“content”: “You are a helpful assistant. Respond to the consumer’s questions using only the Knowledge Articles as the basis for your answers. Always respond in American English.”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “assistant”</code><br />
<code class="language-html highlighter-rouge">“content” : “Hi there! How can I help you today?”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “user”</code><br />
<code class="language-html highlighter-rouge">“content” : “Hi! Do you have any voucher codes available to use at checkout?”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “assistant”</code><br />
<code class="language-html highlighter-rouge">“content” : “Certainly! You can use coupon code ABC12345 when you checkout for 10% off.”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “user”</code><br />
<code class="language-html highlighter-rouge">“content” : “Brilliant! Is there a limit to how many items I can purchase with this voucher?”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “assistant”</code><br />
<code class="language-html highlighter-rouge">“content” : “Not at all. This voucher has no limit regarding the number of items in your basket.”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “user”</code><br />
<code class="language-html highlighter-rouge">“content” : “Perfect! Thank you.”</code></p>

<p>You can see above that the bot has shifted in its last response to using British English like the consumer, using terms like “voucher” and “basket.”</p>

<p>You can also see that—as the conversation gets longer and longer—there is more and more distance between the top of the prompt (where the instructions are found) and the bottom of the prompt. It’s as if the LLM has “forgotten” some of what was first said in the instructions, most notably the part about always responding in American English.</p>

<p>You can mitigate this risk by using the <strong>User content suffix</strong> tab to specify guidance to be appended to the consumer’s most recent message. Doing this is like “reminding” the LLM of certain instructions. Check out the <strong>last user message</strong> below:</p>

<p><code class="language-html highlighter-rouge">“role” : ”system”</code><br />
<code class="language-html highlighter-rouge">“content”: “You are a helpful assistant. Respond to the consumer’s questions using only the Knowledge Articles as the basis for your answers. Always respond in American English.”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “assistant”</code><br />
<code class="language-html highlighter-rouge">“content” : “Hi there! How can I help you today?”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “user”</code><br />
<code class="language-html highlighter-rouge">“content” : “Hi! Do you have any voucher codes available to use at checkout?”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “assistant”</code><br />
<code class="language-html highlighter-rouge">“content” : “Certainly! You can use coupon code ABC12345 when you checkout for 10% off.”</code></p>

<p><code class="language-html highlighter-rouge">“role” : “user”</code><br />
<code class="language-html highlighter-rouge">“content” : “Brilliant! Is there a limit to how many items I can purchase with this voucher?\n Always respond in American English.”</code></p>

<p>In particular, the following is appended to the last user message:</p>

<p><code class="language-html highlighter-rouge">\n Always respond in American English.</code></p>

<p>Reinforcing guidance like this can be helpful. In our example, we might expect the following response from the LLM:</p>

<p><code class="language-html highlighter-rouge">…</code><br />
<code class="language-html highlighter-rouge">“role” : “assistant”</code><br />
<code class="language-html highlighter-rouge">“content” : “No, this coupon code has no limit regarding the number of items in your cart.”</code><br />
<code class="language-html highlighter-rouge">…</code></p>

<p>Note the use of American English terms like "coupon" and "cart."</p>

<h3 id="json">JSON</h3>

<p>This read-only tab shows the JSON for the assembled prompt that will be sent to the LLM. Use this view to help you debug issues.</p>

<p><img style="width:800px" src="img/PromptLibrary/prompt_tab_json.png" alt="The JSON tab of a prompt" /></p>

<p>There isn’t a universal JSON specification for sending prompts to LLMs. Different vendors might have their own APIs and protocols for interacting with their models, so what you see here varies based on the prompt’s <strong>Provider</strong> and <strong>LLM</strong>.</p>

<p>Note the following:</p>

<ul>
  <li>The <strong>JSON</strong> tab shows the JSON for just the system prompt that's editable on the <strong>Prompt</strong> tab. No conversation context is added or represented.</li>
  <li>Since no conversation context is represented, any guidance that you've specified on the <strong>User content suffix</strong> tab isn't represented either (because that guidance is appended to the consumer's last message).</li>
  <li>Variables are represented. If it's a custom variable that has a default value, the default value is shown.</li>
</ul>

<h3 id="example">Example</h3>

<p><code class="language-html highlighter-rouge">You are a customer service agent for {brand_name}, which operates in the {brand_industry} industry. You help users understand issues with using promotional codes. For every customer message, respond with information from the Knowledge Articles, and if you cannot find the information in the Knowledge Articles, say exactly "I'm sorry, I couldn't find any information about that. Is there anything else I can help you with today?"</code></p>

<p><code class="language-html highlighter-rouge">\#\#\# INSTRUCTIONS</code></p>

<p><code class="language-html highlighter-rouge">1. Always follow your instructions.</code>
<code class="language-html highlighter-rouge">2. Your response should be at least 10 words and no more than 300 words.</code>
<code class="language-html highlighter-rouge">3. When the question is related to the calculation for fees or prices: Your job is to create a mathematical assessment based on the facts provided to evaluate the final conclusion. Simplify the problem when possible.</code>
<code class="language-html highlighter-rouge">4. Respond to the question or request by summarizing your findings from Knowledge Articles.</code>
<code class="language-html highlighter-rouge">5. If the question is related to a specific product, service, program, or membership, first make sure that the exact name exists in the Knowledge Articles. Otherwise, say, "I can't find that information."</code></p>

<p><code class="language-html highlighter-rouge">\#\#\# CUSTOMER INFORMATION</code></p>

<p><code class="language-html highlighter-rouge">1. The customer attempted to use {botContext_promoCode} to purchase {botContext_itemsInCart} but received the following error message: {botContext_errorCode}. Please use information about the promotion from the Knowledge Articles to help the customer.</code></p>

<p><code class="language-html highlighter-rouge">\#\#\# KNOWLEDGE ARTICLES</code></p>

<p><code class="language-html highlighter-rouge">{knowledge_articles_matched}</code></p>
]]></description>
      <!-- <pubDate>Thu, 12 Feb 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Variables for Solutions</title>
      <link>https://developers.liveperson.com/trustworthy-generative-ai-prompt-library-variables-for-solutions.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/trustworthy-generative-ai-prompt-library-variables-for-solutions.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>This article provides reference info on the variables that play a role in different Generative AI solutions within Conversational Cloud.</p>

<p>If you're looking for an introduction to variables and general info on working with variables in the Prompt Library, see <a href="trustworthy-generative-ai-prompt-library-work-with-variables.html">this article</a>.</p>

<h3 id="variables-for-automated-conversation-summaries">Variables for automated conversation summaries</h3>

<p>If you’re working on a prompt to generate <a href="https://community.liveperson.com/kb/articles/1571-conversation-copilot">conversation summaries</a> via an LLM, the following <strong>client type-specific</strong> variables are available:</p>

<ul>
  <li><code class="language-html highlighter-rouge">{language}</code>: Optional. Include this variable to generate summaries in a specific language. If you omit this variable, the summaries are generated in English.</li>
  <li><code class="language-html highlighter-rouge">{text}</code>: Required. At runtime, this is resolved to include the conversation's transcript.</li>
</ul>

<p class="attn-alert">Don’t ever remove the <code class="language-html highlighter-rouge">{text}</code> variable. If you do, conversation transcripts won't reach the LLM, leading to inaccurate summaries. We expose the variable in the UI, so you can 1) locate it in the prompt wherever you require, and 2) easily add it back if you inadvertently delete it.</p>

<p><a href="https://community.liveperson.com/kb/articles/1429-self-service-configuration-for-conversation-summaries">Learn more about {language} and {text}.</a></p>

<h3 id="variables-for-copilot-rewrite">Variables for Copilot Rewrite</h3>

<p>If you're working on a prompt to generate a rewritten version of the agent's message, the following <strong>client type-specific variables</strong> are available:</p>

<ul>
  <li>
    <p><code class="language-html highlighter-rouge">{text}</code>: Required. At runtime, this is resolved to include the agent's message that needs to be rewritten.</p>

    <p class="attn-alert">Don’t ever remove the <code class="language-html highlighter-rouge">{text}</code> variable. If you do, the agent's message won't reach the LLM, leading to inaccurate responses. We expose the variable in the UI, so you can 1) locate it in the prompt wherever you require, and 2) easily add it back if you inadvertently delete it.</p>
  </li>
  <li>
    <p><code class="language-html highlighter-rouge">{semantic_instructions}</code>: Optional, but included by default in the prompt. This variable resolves to the <a href="https://community.liveperson.com/kb/articles/2038-manage-semantic-dictionaries">semantic dictionaries</a> that you've defined. <a href="https://community.liveperson.com/kb/articles/2038-manage-semantic-dictionaries#prompt-configuration">Learn more about this variable.</a></p>
  </li>
</ul>

<p><a href="https://community.liveperson.com/kb/articles/1430-copilot-rewrite-configuration">Learn more about Copilot Rewrite configuration.</a></p>

<h3 id="variables-for-copilot-translate">Variables for Copilot Translate</h3>

<p>If you’re working on a prompt to translate messages (<a href="https://community.liveperson.com/kb/articles/2228-overview-of-copilot-translate">Copilot Translate</a>), typically you make use of the following client type-specific variables that are available:</p>

<ul>
  <li><code class="language-html highlighter-rouge">{input}</code></li>
  <li><code class="language-html highlighter-rouge">{language_code}</code></li>
</ul>

<p><a href="https://community.liveperson.com/kb/articles/2229-configure-copilot-translate#understand-the-translation-prompt">Learn about these variables.</a></p>

<h3 id="variables-for-routing-ai-agents">Variables for Routing AI agents</h3>

<p>If you’re working on a prompt for a <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html">Routing AI agent</a>, there's just one <strong>client type-specific</strong> variable available:</p>

<ul>
  <li><code class="language-html highlighter-rouge">{intent_list}</code></li>
</ul>

<h4 id="intent_list">{intent_list}</h4>

<p>At runtime, this variable is resolved to include the list of routes (their names and descriptions) that are defined in the Guided Routing interaction.</p>

<p class="attn-alert">Don’t remove the <code class="language-html highlighter-rouge">{intent_list}</code> variable. If you do, the Guided Routing interaction won't work. We expose the variable in the UI, so you can 1) locate the variable in the prompt wherever you require, and 2) easily add it back if you inadvertently delete it.</p>

<h3 id="variables-for-solutions-that-custom-process-user-queries">Variables for solutions that custom process user queries</h3>

<p>If you’re working on a prompt to perform custom processing of the user’s query before using the query to search the knowledge base (currently, <a href="conversation-assist-key-terms-concepts-answer-recommendations.html#user-queries-custom-process-via-generative-ai">such processing is possible in Conversation Assist</a>), typically you make use of the following <strong>client-type specific</strong> variables that are available:</p>

<ul>
  <li><code class="language-html highlighter-rouge">{conversation_history}</code></li>
  <li><code class="language-html highlighter-rouge">{kb_language}</code></li>
  <li><code class="language-html highlighter-rouge">{user_query}</code></li>
</ul>

<h4 id="conversation_history">{conversation_history}</h4>

<p>At runtime, this variable is resolved to the last 10 turns in the conversation. Note that a turn represents one complete exchange between the participants in the conversation.</p>

<p>You might need to use this variable if you want to perform query contextualization using your own LLM. However, <a href="knowledgeai-key-terms-concepts-user-queries-contextualize.html">LivePerson also offers query contextualization</a> via an internal,  state-of-the-art SLM (small language model).</p>

<h4 id="kb_language">{kb_language}</h4>

<p>At runtime, this variable is resolved to the language of the knowledge base. (In KnowledgeAI, you can find the language of the knowledge base in <strong>Settings</strong>.)</p>

<p>You might need to use this variable if you want to translate the user’s query into the knowledge base’s language before using the query to search the knowledge base. Doing so can greatly improve the results.</p>

<h4 id="user_query">{user_query}</h4>

<p>At runtime, this variable is resolved to the user’s query.</p>

<p>To perform any kind of custom processing of the query, you need to use this variable.</p>

<h3 id="variables-for-solutions-enriching-knowledgeai-answers">Variables for solutions enriching KnowledgeAI answers</h3>

<p class="attn-note">The variables discussed in this section apply to <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">Conversation Assist</a> and Conversation Builder <a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html">KnowledgeAI agents</a>. Both make use of prompts that instruct the LLM to enrich the answers returned by KnowledgeAI.</p>

<p>If you’re working on a prompt for a <a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">Conversation Assist rule</a> or a <a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html">KnowledgeAI agent</a>, the following <strong>client type-specific</strong> variables are available:</p>

<ul>
  <li><code class="language-html highlighter-rouge">{brand_name}</code></li>
  <li><code class="language-html highlighter-rouge">{brand_industry}</code></li>
  <li><code class="language-html highlighter-rouge">{brand_info}</code></li>
  <li><code class="language-html highlighter-rouge">{knowledge_articles_matched}</code></li>
</ul>

<h4 id="brand_name-and-brand_industry">{brand_name} and {brand_industry}</h4>

<p>We recommend that you follow the example in our prompt templates and use <code class="language-html highlighter-rouge">{brand_name}</code> and <code class="language-html highlighter-rouge">{brand_industry}</code> in your prompts. Research by our data scientists has revealed that this helps the response to stay in bounds, i.e., specific to your brand, with fewer hallucinations.</p>

<p>When you <a href="https://community.liveperson.com/kb/articles/1502-get-started-with-our-solution">activate our Generative AI features</a> in the Management Console, we ask you to specify your brand name and industry for this reason. At runtime, the values that you specified are used as the values of these variables. Return to the Management Console to change the values at any time.</p>

<h4 id="brand_info">{brand_info}</h4>

<p><code class="language-html highlighter-rouge">{brand_info}</code> is a deprecated variable that resolves to <code class="language-html highlighter-rouge">{brand_name}</code> and <code class="language-html highlighter-rouge">{brand_industry}</code>, described above. <code class="language-html highlighter-rouge">{brand_info}</code> will be removed in the near future.</p>

<h4 id="knowledge_articles_matched">{knowledge_articles_matched}</h4>

<p>At runtime, this variable is resolved to include the list of articles that matched the consumer's query. <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#answer-enrichment-flow">Learn about the matched articles.</a></p>

<p>Our research indicates that the positioning of this variable can strongly influence the generated response. For best results, place the variable at the end of the prompt.</p>

<p class="attn-alert">Don’t remove the <code class="language-html highlighter-rouge">{knowledge_articles_matched}</code> variable. If you do, KnowledgeAI's answer enrichment service won't work. We expose the variable in the UI, so you can 1) locate the variable in the prompt wherever you require, and 2) easily add it back if you inadvertently delete it.</p>

<h3 id="variables-for-solutions-that-custom-process-answers">Variables for solutions that custom process answers</h3>

<p>If you’re working on a prompt to perform custom processing of the answers returned by KnowledgeAI before returning them back to the client application (currently, <a href="conversation-assist-key-terms-concepts-answer-recommendations.html#answers-custom-process-via-generative-ai">such processing is possible in Conversation Assist</a>), typically you make use of the following <strong>client type-specific</strong> variables that are available:</p>

<ul>
  <li><code class="language-html highlighter-rouge">{knowledge_articles_matched}</code></li>
  <li><code class="language-html highlighter-rouge">{user_query}</code></li>
</ul>

<h4 id="knowledge_articles_matched-1">{knowledge_articles_matched}</h4>

<p>At runtime, this variable is resolved to include the list of answers (articles) that matched the consumer's query. Learn about the matched articles.</p>

<p>To perform any kind of custom processing of the answers, you need to use this variable.</p>

<p>Our research indicates that the positioning of this variable can strongly influence the generated response. For best results, place the variable at the end of the prompt.</p>

<p class="attn-alert">Don’t remove the <code class="language-html highlighter-rouge">{knowledge_articles_matched}</code> variable. If you do, the answers aren’t sent to the LLM for processing.</p>

<h4 id="user_query-1">{user_query}</h4>

<p>At runtime, this variable is resolved to the user’s query.</p>

<p>You might need to use this variable to provide the user query to the LLM, so it can detect the query’s language and translate the answers into the language used by the consumer.</p>
]]></description>
      <!-- <pubDate>Mon, 09 Feb 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Functions List</title>
      <link>https://developers.liveperson.com/conversation-builder-scripting-functions-functions-list.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-scripting-functions-functions-list.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="core-functions">Core functions</h3>

<p>For quick reference, here's an alphabetically-ordered list:</p>

<ul>
  <li><a href="conversation-builder-scripting-functions-manage-conversation-flow.html#add-quick-replies">addQuickReplies</a></li>
  <li><a href="conversation-builder-scripting-functions-askmaven.html">askMaven</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#delete-data-by-conversation">deleteContextDataForConversation</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#delete-data-by-entity">deleteContextDataForEntity</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#delete-data-by-user">deleteContextDataForUser</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#delete-a-namespace">deleteContextNamespace</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#delete-global-data">deleteGlobalContextData</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-conversation-flow.html#evaluate-options">evaluateOptions</a></li>
  <li><a href="conversation-builder-scripting-functions-get-integration-data.html#get-api-integration-status-code">getApiStatusCode</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-and-set-bot-variable">getBotVariable</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-conversation-flow.html#get-button-payload">getButtonPayload</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-bot-id">getChatBotId</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#get-data-by-conversation">getContextDataForConversation</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#get-data-by-entity">getContextDataForEntity</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#get-data-by-user">getContextDataForUser</a></li>
  <li><a href="conversation-builder-scripting-functions-get-conversation-data.html#get-conversation-history">getConversationHistory</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-conversation-id">getConversationId</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-current-user-message">getCurrentUserMessage</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-matched-intent">getDialogStarterIntent</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-disambiguated-intent">getDisambiguatedIntentId</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-disambiguated-intent">getDisambiguatedIntentName</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-environment-variable">getEnvVariable</a></li>
  <li><a href="conversation-builder-scripting-functions-get-integration-data.html#get-file-caption">getFileCaption</a></li>
  <li><a href="conversation-builder-scripting-functions-get-integration-data.html#get-file-type">getFileType</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#get-global-data">getGlobalContextData</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-type-of-hours">getHoursType</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-lp-account-id">getLPAccountId</a></li>
  <li><a href="conversation-builder-scripting-functions-get-user-data.html#get-authenticated-customer-info">getLPCustomerInfo</a></li>
  <li><a href="conversation-builder-scripting-functions-get-service-domains.html#get-liveperson-service-domain">getLPDomain</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-lp-engagement-attribute">getLPEngagementAttribute</a></li>
  <li><a href="conversation-builder-scripting-functions-get-user-data.html#get-authenticated-customer-info">getLPUserPersonalInfo</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-conversation-metadata">getMetadata</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-named-entities">getNamedEntities</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-nlp-responses">getNlpResponse</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-quick-reply-payload">getQuickReplyPayload</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-sentiment">getSentiment</a></li>
  <li><a href="conversation-builder-scripting-functions-get-user-data.html#get-user-channel">getUserChannel</a></li>
  <li><a href="conversation-builder-scripting-functions-get-user-data.html#get-user-platform-id">getUserPlatformId</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-web-view-variables">getWebViewVariable</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-web-view-variables">getWebViewVariables</a></li>
  <li><a href="conversation-builder-scripting-functions-get-integration-data.html#is-api-integration-execution-successful">isApiExecutionSuccessful</a></li>
  <li><a href="conversation-builder-scripting-functions-log-debug.html#log-custom-event">logCustomEvent</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-matched-dialog">matchDialog</a></li>
  <li><a href="conversation-builder-scripting-functions-log-debug.html#print-debug-message">printDebugMessage</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#register-a-namespace">registerContextNamespace</a></li>
  <li><a href="conversation-builder-scripting-functions-send-messages.html#send-immediate-reply">sendImmediateReply</a></li>
  <li><a href="conversation-builder-scripting-functions-send-messages.html#send-message">sendMessage</a></li>
  <li><a href="conversation-builder-scripting-functions-send-messages.html#send-messages">sendMessages</a></li>
  <li><a href="conversation-builder-scripting-functions-send-messages.html#send-message-with-quick-reply">sendMessageWithQuickReplies</a></li>
  <li><a href="conversation-builder-scripting-functions-send-messages.html#send-private-message-to-agent">sendPrivateMessage</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-conversation-flow.html#set-allow-max-text-response">setAllowMaxTextResponse</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#set-bot-transfer-intent-by-domain">setBotTransferIntentbyDomain</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#set-bot-transfer-intent-id">setBotTransferIntentId</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#set-bot-transfer-user-message">setBotTransferUserMessage</a></li>
  <li><a href="conversation-builder-scripting-functions-get-set-session-data.html#get-and-set-bot-variable">setBotVariable</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#set-data-by-conversation">setContextDataForConversation</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#set-data-by-entity">setContextDataForEntity</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#set-data-by-user">setContextDataForUser</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#set-global-data">setGlobalContextData</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-conversation-flow.html#set-message-delay-value">setMessageDelay</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-conversation-flow.html#set-trigger-next-message">setTriggerNextMessage</a></li>
  <li><a href="conversation-builder-scripting-functions-manage-conversation-flow.html#transfer-to-bots-dialog">transferToBotDialog</a></li>
</ul>

<h3 id="functions-for-managing-ccs">Functions for managing CCS</h3>

<p><a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html">Learn about the built-in functions for managing LivePerson's Conversation Context Service</a> (CCS). CCS is a centralized, cloud-based repository for storing and retrieving data.</p>
]]></description>
      <!-- <pubDate>Tue, 20 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Tune a Knowledge Base</title>
      <link>https://developers.liveperson.com/knowledgeai-optimizing-your-content-tune-a-knowledge-base.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-optimizing-your-content-tune-a-knowledge-base.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>After you've added your content, tune the knowledge base for optimal performance:</p>

<ol>
  <li>Perform a search using an authentic consumer query.</li>
  <li>Review the results: Check the titles and contents of the matched articles, as well as their scores, to make sure everything looks reasonable.</li>
  <li>Take steps to improve the performance:
    <ul>
      <li><strong>Article content</strong>: Refine the article content to improve the article matching via AI Search. If you have a consumer query for which there isn’t a relevant article to serve as the answer, just add that article. While it’s unlikely that an existing, relevant article won’t yield results, it might happen. In this case, improve the article’s title and/or add tags to the article.</li>
      <li><strong>Associated intents</strong>: If you've tied the articles to intents, refine the intents to improve the article matching via intent matching. You do this by adjusting the training phrases for the intent.</li>
      <li><strong>Configuration</strong>: Adjust the answer threshold or number of results.</li>
      <li><strong>Prompt</strong>: If you're using Generative AI, refine the prompt that's provided to the LLM service in order to improve the response.</li>
    </ul>
  </li>
</ol>

<h4 id="related-info">Related info</h4>

<ul>
  <li><a href="knowledgeai-key-terms-concepts-search-methods.html">Learn about search methods (AI Search, Intent Match).</a></li>
  <li><a href="knowledgeai-best-practices.html">Learn about KnowledgeAI best practices.</a></li>
  <li><a href="trustworthy-generative-ai-prompt-library-best-practices.html">Learn about prompt writing best practices.</a></li>
</ul>

<h3 id="answer-tester-versus-test--tune">Answer Tester versus Test &amp; Tune</h3>

<p>There are 2 tools within KnowledgeAI that you can use to test the performance of a knowledge base:</p>

<ul>
  <li><strong>Answer Tester</strong>: Use this when you want to search within a <em>single</em> knowledge base.</li>
  <li><strong>Test &amp; Tune</strong>: Use this when you want to search across <em>multiple</em> knowledge bases.</li>
</ul>

<p><img class="fancyimage" style="width:500px" src="img/ConvoBuilder/kai_answer_tester.png" alt="The Answer Tester tool" /></p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/kai_test_and_tune.png" alt="The Test and Tune tool" /></p>

<p>Answer Tester and Test &amp; Tune work the same, with two exceptions:</p>

<ul>
  <li>In Test &amp; Tune, there’s a <strong>Knowledge Base</strong> field as an input criterion. You must use this to specify the knowledge bases to search. You can select up to five.</li>
  <li>In Test &amp; Tune, there’s a <strong>Language</strong> field as an input criterion. You can use this to filter the list of knowledge bases that are available for selection. For example, if you want to select one or more Spanish-language knowledge bases in the <strong>Knowledge Base</strong> field, select "Spanish" here.</li>
</ul>

<h3 id="access-answer-tester">Access Answer Tester</h3>

<ol>
  <li><a href="knowledgeai-overview.html#access-knowledgeai">Access KnowledgeAI.</a></li>
  <li>Click <strong>Knowledge Bases</strong> in the upper-left corner, and select the knowledge base.</li>
  <li>Click <strong>Articles</strong> in the upper-left corner.</li>
  <li>Scroll down to the <strong>Answer Tester</strong> on the right side.</li>
</ol>

<h3 id="access-test--tune">Access Test &amp; Tune</h3>

<ol>
  <li><a href="knowledgeai-overview.html#access-knowledgeai">Access KnowledgeAI.</a></li>
  <li>Click <strong>Test &amp; Tune</strong> in the upper-left corner.</li>
  <li>Click the <strong>Test</strong> tab.</li>
</ol>

<h3 id="testing-generative-ai-features">Testing Generative AI features</h3>

<p>In the testing tools, there are several features that use Generative AI. To enable these options, <a href="https://community.liveperson.com/kb/articles/1502-get-started-with-our-solution">activate our Generative AI features</a> in the <strong>Management Console</strong>.</p>

<h3 id="enter-a-single-utterance-or-set-of-messages">Enter a single utterance or set of messages</h3>

<p>In the testing tool, you have the option of performing a knowledge base search using a single utterance (user query) or a set of messages from a conversation. Either way, enter something that’s authentic.</p>

<p>Use the <strong>Single Utterance</strong> tab if you want to search using a single query:</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/kai_test_single_utterance.png" alt="The Single Utterance tab in the testing tool, where you can search knowledge bases using a single utterance" /></p>

<p>The <strong>Conversation</strong> tab is useful in a few cases:</p>

<ul>
  <li>You want to test the knowledge base search using a set of messages from a conversation. In this case, only the <strong>customer’s last message</strong> is used to search the knowledge base, but you might be testing the <a href="knowledgeai-key-terms-concepts-user-queries-contextualize.html">rephrasing of that query using the conversation context</a>. More on this below.</li>
  <li>You want to test processing of the answers by an LLM, which often involves use of the conversation context. Such processing might be answer enrichment or custom processing. More on this below too.</li>
</ul>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/kai_test_conversation.png" alt="The Conversation tab in the testing tool, where you can search knowledge bases using a series of messages in a conversation" /></p>

<p>Use the format shown in the image above. There are only two allowed actors: CUSTOMER and ASSIGNED_AGENT. Ensure the last message is from the CUSTOMER. Also ensure each message from an actor is on a new line.</p>

<p>If you import the messages from a conversation, the <strong>earliest</strong> N messages are imported. You can get a conversation’s ID from the <strong>Consumer Info</strong> widget in the Agent Workspace.</p>

<p>As mentioned farther above, <strong>the search is always performed using the last consumer message</strong>.</p>

<h3 id="specify-search-criteria">Specify search criteria</h3>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/kai_test_specify_criteria.png" alt="The Criteria section of the testing tool, which you can use to specify the search criteria" /></p>

<p>In the testing tool, specify how to perform the search:</p>

<ul>
  <li><strong>Retrieve answers by</strong>: Select the <a href="knowledgeai-key-terms-concepts-search-methods.html">type of search</a> to perform.</li>
  <li><strong>Threshold</strong>: Select the <a href="knowledgeai-key-terms-concepts-search-methods.html#match-scores-and-thresholds">confidence threshold</a> that an article must meet for it to be returned as a result.</li>
  <li><strong># of results (Answer Tester) or # of results per knowledge base (Test &amp; Tune)</strong>: Select how many results to return.</li>
  <li><strong>Article status</strong>: Select the status of the article, either Active, Inactive, or All. This option is only available for internal knowledge bases.</li>
  <li><strong>Language (Test &amp; Tune only)</strong>: Use this to filter the list of knowledge bases that are available for selection. For example, if you want to select one or more Spanish-language knowledge bases in the <strong>Knowledge base</strong> field, select "Spanish" here.</li>
  <li><strong>Knowledge base (Test &amp; Tune only)</strong>: Select the knowledge bases to search. You can select up to five.</li>
</ul>

<h3 id="process-users-query">Process user’s query</h3>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/kai_test_process_user_query.png" alt="The section of the testing tool that makes available options for processing the user's query for better search results" /></p>

<ul>
  <li><strong>Enhance (rephrase) using conversation context (LivePerson SLM)</strong>: Often the user’s query doesn’t include enough context to retrieve a high-quality answer from a knowledge base. To solve this, you can turn on this setting so that the system gathers additional conversation context (conversation turns) and uses it to rephrase the user’s query before searching the knowledge base. Rephrasing is done using <a href="knowledgeai-key-terms-concepts-user-queries-contextualize.html">KnowledgeAI’s Query Contextualization feature</a>.</li>
</ul>

<p class="attn-note"><strong>Custom processing via Generative AI</strong> (described next) is only supported by Conversation Assist. It's made available in the KnowledgeAI testing tool, so brands with Conversation Assist solutions can perform testing.</p>

<ul>
  <li><strong>Custom processing via Generative AI</strong>: Turn on this setting (and select a prompt) to perform any <a href="knowledgeai-key-terms-concepts-user-queries-custom-process-via-generative-ai.html">custom processing of the user query</a> that you require. For example, if you’re supporting cross-lingual queries (say the query is in Spanish, but your knowledge base is in English), you might want to translate the query into the language of the knowledge base that will be searched for answers. Doing so can improve the search results significantly.</li>
</ul>

<h3 id="process-answers">Process answers</h3>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/kai_test_process_answers.png" alt="The section of the testing tool that makes available options for processing the answers for better quality" /></p>

<ul>
  <li><strong>Generate one enriched answer via Generative AI</strong>: Turn on this setting if you want to send the articles to the LLM, so it can use them to <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">generate a single enriched answer via Generative AI</a>. You must select an <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#enrichment-prompts">enrichment prompt</a> to use; optionally, you can also select a <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#no-article-match-prompts">No Article Match prompt</a>.</li>
</ul>

<p class="attn-note"><strong>Custom processing via Generative AI</strong> (described next) is only supported by Conversation Assist. It's made available in the KnowledgeAI testing tool, so brands with Conversation Assist solutions can perform testing.</p>

<ul>
  <li><strong>Custom processing via Generative AI</strong>: Perform any <a href="knowledgeai-key-terms-concepts-answers-custom-process-via-generative-ai.html">custom processing of the articles (answers)</a> that you require: align to your brand’s voice, append static text (website URL, a tagline, promotion info, etc.), translate into the consumer’s language, and so on.</li>
</ul>

<h3 id="testing-and-debugging">Testing and debugging</h3>

<ol>
  <li>Enter the search criteria, and click <strong>Get Answers</strong>.</li>
  <li>
    <p>Review the results under <strong>Matched answers</strong>.</p>

    <p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/kai_test_matched_answers.png" alt="The answers matched to the search" /></p>
  </li>
  <li>
    <p>Click the article to view its details:</p>

    <p><img class="fancyimage" style="width:500px" src="img/ConvoBuilder/kai_test_matched_answers_detail.png" alt="Detailed article info on an answer matched to the search" /></p>
  </li>
  <li>
    <p>Click <strong>JSON</strong> to view the JSON:</p>

    <p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/kai_test_matched_answers_json.png" alt="The section of the testing tool that displays the JSON for a matched article" /></p>

    <p>If you need to troubleshoot an error, return to the results, and click the <strong>Debug</strong> tab:</p>

    <p><img class="fancyimage" style="width:500px" src="img/ConvoBuilder/kai_test_matched_answers_debug.png" alt="The section of the testing tool that makes available the debug logs for the seach process" /></p>
  </li>
</ol>

<h3 id="related-articles">Related articles</h3>

<ul>
  <li><a href="knowledgeai-key-terms-concepts-search-methods.html">Search Methods</a></li>
  <li><a href="knowledgeai-best-practices.html">Best Practices</a></li>
  <li>Deep dive into the <a href="knowledgeai-faqs.html#can-you-describe-the-enrichment-flow-and-custom-processing-flow-in-their-various-combinations">enrichment and custom processing flows</a></li>
</ul>
]]></description>
      <!-- <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Routing AI Agents - Route Consumers Conversationally</title>
      <link>https://developers.liveperson.com/conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="whats-a-routing-ai-agent">What's a Routing AI agent?</h3>

<p>A Routing AI agent is an LLM-powered bot that’s focused on routing the consumer to the appropriate bot or agent who can help them with their query.</p>

<p>Historically, rule-based bots that use Natural Language Understanding (NLU) have been the industry standard for handling routing. They require that you invest heavily in setting up and refining an NLU intent model. Then, in the bot, you must specify the intents that trigger the various bot flows. For the consumer, the routing experience is often menu-driven and looks like this:</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/gr1.png" alt="An example of a traditional concierge bot where routing is menu-driven" /></p>

<p>The traditional approach can work, but it’s highly deterministic, often brittle, and, therefore, problematic. It also fails to account for the complexity and variability of natural human conversation. Consumers can express things in ways not accounted for by the intent model or the bot, for example:</p>

<p><img class="fancyimage" style="width:450px" src="img/ConvoBuilder/gr2.png" alt="An example of a traditional concierge bot that can't handle unexpected language well" /></p>

<p>Sometimes, consumers don’t even know what they want. And when they do, some of their intentful queries fall outside of what the bot can handle, like this:</p>

<p><img class="fancyimage" style="width:450px" src="img/ConvoBuilder/gr3.png" alt="An example of a traditional concierge bot that can't handle an unsupported intent gracefully" /></p>

<p>Overall, the traditional NLU-based, rule-based approach is rigid and unsatisfactory, especially with consumer expectations now set much higher for AI engagement due to the arrival of Generative AI.</p>

<p>A Routing AI agent represents <strong>a paradigm shift in routing</strong> for both the bot builder and the consumer:</p>

<ul>
  <li><strong>For the bot builder</strong>, gone are the days of building out a vast intent model. Instead, the bot leverages an LLM to discern the consumer’s intent and to route the consumer to the right flow for resolution. What’s more, unlike a traditional bot, the Routing AI agent doesn’t respond with predefined responses. It dynamically generates its responses as it adapts to the complex conversation thread. Thus, it can handle a wide range of queries with unprecedented flexibility. As the bot builder, your tasks shift to route definition and prompt engineering.</li>
  <li><strong>For the consumer</strong>, the experience is <em>much more conversational</em>. The bot engages the consumer with language that’s natural and human-like. No more routing menus. No more canned, unsatisfactory responses like, “Sorry, I didn’t quite understand that. Could you try again?”</li>
</ul>

<p>Let’s revisit the messaging conversations illustrated above, add a bit more complexity to them, and see what’s possible with a Routing AI agent.</p>

<p>With its LLM-powered language capabilities, here’s how the bot handles the request for telly service:</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/gr4.png" alt="An example of a Routing AI agent that handles complex language well" /></p>

<p>Consumer intent understood. Warm response. No NLU intent model to set up and train.</p>

<p>And here’s how the bot gracefully deals with an intent that it isn’t designed to handle, in this case, a request for a landline phone:</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/gr5.png" alt="An example of a Routing AI agent that handles unsupported intents well" /></p>

<h4 id="key-capabilities">Key capabilities</h4>

<h5 id="advanced-disambiguation-capabilities">Advanced disambiguation capabilities</h5>

<p>The Routing AI agent can ask clarifying questions to determine the most relevant routing destination, enhancing accuracy in fulfilling specific intents.</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/gr6.png" alt="An example of a Routing AI agent that works to disambiguate the consumer's intent by asking clarifying questions" /></p>

<h5 id="customizable-routing-descriptions">Customizable routing descriptions</h5>

<p>In a Routing AI agent, you focus on tailoring the name and description of each routing option that you want to make available. The Routing AI agent takes care of the rest: discerning the consumer’s intent and routing them accordingly. There’s no need to anticipate and accommodate every conceivable scenario, as you must when building an intent-based, rule-based system. In short, the development is faster and cheaper, and the routing is more accurate.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr7.png" alt="An example of a route that has a name and description that can be customized" /></p>

<h5 id="conversational-context-for-warm-start">Conversational context for warm start</h5>

<p>The Routing AI agent retains and uses previous turns from the current conversation to interpret the most recent consumer message. Thus, it can engage the consumer with relevant and personalized dialogue.</p>

<h5 id="multi-intent-handling">Multi-intent handling</h5>

<p>Routing AI agents can handle multiple intents, moving across dialogs or bots while maintaining continuity with respect to the routing experience:</p>

<p><img class="fancyimage" style="width:500px" src="img/ConvoBuilder/gr8.png" alt="An example of a Routing AI agent that can handle multiple consumer intents" /></p>

<p>When routing the consumer, the Routing AI agent maintains continuity by transferring relevant context. This ensures the hand-off is “warm.” Warm transfers offer several advantages:</p>

<ul>
  <li>Smooth transitions</li>
  <li>Personalized assistance</li>
  <li>Improved customer experience</li>
  <li>Efficiency</li>
  <li>Increased trust</li>
</ul>

<h4 id="key-benefits">Key benefits</h4>

<ul>
  <li><strong>Accelerate deployment</strong> to just a few weeks: Bypass the lengthy process of building and training a vast intent model, which typically takes months.</li>
  <li><strong>Increase operational efficiency and service delivery, and reduce costs</strong>: Routing AI agents effectively decipher and address multiple, even ambiguous, consumer intents, and they transfer important context. These capabilities solve issues of wasted time, longer handling times, and increased consumer frustration.</li>
  <li>Enjoy <strong>higher FCR and CSAT</strong> scores.</li>
</ul>

<h3 id="language-support">Language support</h3>

<p>Routing AI agents that use American English or British English are supported.</p>

<p>If your bot uses another language, support is <strong>experimental</strong>. Don’t hesitate to get started with exploring the capabilities of Generative AI, and stay tuned for support of additional languages. As always, proceed with care: Test thoroughly before rolling out to Production.</p>

<h3 id="unsupported-features">Unsupported features</h3>

<ul>
  <li><strong>Export and import</strong>: Currently, export and import of bots, dialogs, and bot/dialog templates isn’t supported.</li>
  <li><strong>Bot releases</strong>: While you can create <a href="conversation-builder-versions-releases.html">versions</a> of your Routing AI agent at crucial moments during bot development, you can’t use the <a href="conversation-builder-versions-releases.html">Release feature</a> to create a snapshot for the purpose of pushing that snapshot to a different bot (e.g., to your Production bot). Bot releases aren’t supported yet.</li>
</ul>

<p class="attn-note">Stay tuned for upcoming changes on these fronts!</p>

<h3 id="prerequisites-to-building-the-bot">Prerequisites to building the bot</h3>

<h4 id="activate-our-generative-ai-features">Activate our Generative AI features</h4>

<p>The key component in a Routing AI agent is a Guided Routing interaction:</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/gr9.png" alt="An example of a Guided Routing interaction" /></p>

<p>In order to see this interaction in the tool palette in Conversation Builder, you must <a href="https://community.liveperson.com/kb/articles/1502-get-started-with-our-solution">activate LivePerson’s Generative AI features</a>.</p>

<p>Additionally, you must access Conversation Builder by logging into Conversational Cloud (our single-sign approach). Brands that log into Conversation Builder directly don’t have access to the Guided Routing interaction.</p>

<h4 id="accept-terms-regarding-routing-ai-agents">Accept terms regarding Routing AI agents</h4>

<p>If your organization hasn’t already accepted applicable terms for using Routing AI agents via a direct, offline process with LivePerson, you can’t add the Guided Routing interaction to a bot. Instead, you’ll see this in Conversation Builder when you try:</p>

<p><img class="fancyimage" style="width:500px" src="img/ConvoBuilder/gr10.png" alt="An example of a Guided Routing interaction" /></p>

<p>You can get rolling by accepting and activating online: Clicking <strong>Let’s go</strong> takes you to the Management Console, where you can review the terms:</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr11.png" alt="An example of a Guided Routing interaction" /></p>

<p>If you accept the terms on behalf of your brand:</p>

<ol>
  <li>Click <strong>Click to activate</strong>.</li>
  <li>Give the system 5-10 minutes to update itself.</li>
  <li>Manually refresh the page.</li>
  <li>Return to Conversation Builder and retry the task of adding the interaction.</li>
</ol>

<p class="attn-note">Acceptance of the terms and activation are one-time-only tasks for your account.</p>

<h3 id="prerequisites-to-a-production-rollout">Prerequisites to a Production rollout</h3>

<p>Feel free to experiment, build, and test your Routing AI agent as much as needed. However, <strong>before you roll it out for use with live  traffic in Production</strong>, it’s vital that you contact your LivePerson representative! Please <a href="https://forms.gle/yxcrZgdCc7ANCMho9">fill out this form</a> to schedule a meeting with us.</p>

<p>We want to ensure that your Routing AI Agent won’t be adversely impacted by the capacity constraints of the third-party LLM that’s used. Please collaborate with us regarding your plans and the expected traffic, so we can work together to ensure a successful release.</p>

<h3 id="flow-diagram">Flow diagram</h3>

<p>The following diagram visualizes the Guided Routing flow, including the logical fallback flow. Sections that follow dive into greater detail.</p>

<p><img class="fancyimage" style="width:650px" src="img/ConvoBuilder/gr12.png" alt="The Guided Routing flow diagram, including the fallback flow" /></p>

<h3 id="intent-detection-and-routing">Intent detection and routing</h3>

<h4 id="routing-basics">Routing basics</h4>

<p>The routes defined in the Guided Routing interaction power the intent detection and routing experience.</p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/gr13.png" alt="The Guided Routing interaction, with a callout to the button for accessing the UI for route creation and management" /></p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/gr14.png" alt="The Routes dialog, with a list of example routes defined" /></p>

<p>Every route has 3 components:</p>

<ul>
  <li>A name</li>
  <li>A description</li>
  <li>A destination</li>
</ul>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr15.png" alt="The component parts of a route, which are route name, description, and destination" /></p>

<p>The LLM determines where to route the consumer by matching the consumer’s query to one or more routes. This is done by evaluating the query against the names and descriptions of each defined route.</p>

<p>If a matched route is found, the consumer is routed to the destination.</p>

<h4 id="conversational-versus-silent-mode">Conversational versus Silent mode</h4>

<p>The Guided Routing interaction can work in Conversational mode or Silent mode.</p>

<h5 id="conversational-mode">Conversational mode</h5>

<ol>
  <li>The bot uses the <strong>last 10 messages</strong> between the bot and the consumer to query the LLM to determine the best route for the consumer’s intent.</li>
  <li>The bot sends a message to the consumer to acknowledge the intent and routes the consumer to the matched route.</li>
</ol>

<p><img class="fancyimage" style="width:500px" src="img/ConvoBuilder/gr16.png" alt="An example conversation in Conversational mode, where the bot sends a messaging acknowledging the consumer's intent and routes the consumer" /></p>

<h5 id="silent-mode">Silent mode</h5>

<ol>
  <li>The bot uses the <strong>last 10 messages</strong> between the bot and the consumer to query the LLM to determine the best route for the consumer’s intent.</li>
  <li>The bot routes the consumer silently. It doesn’t engage in any dialogue with the consumer.</li>
</ol>

<p><img class="fancyimage" style="width:500px" src="img/ConvoBuilder/gr17.png" alt="An example conversation in Silent mode, where the bot routes the consumer without engaging in dialog" /></p>

<p>Silent mode works a lot like the NLU-based intent detection in a traditional bot in that the consumer’s message is matched to an intent, and the consumer is routed accordingly. There’s no natural language response that is generated and sent to the consumer. That said, Silent mode in a Routing AI agent performs better.</p>

<p class="attn-tip">Using the Routing AI Agent in Silent mode can be a great starting point for adopting Generative AI automations, especially if your business is very sensitive to the potential for hallucinations.</p>

<h4 id="the-importance-of-the-consumers-most-recent-message">The importance of the consumer’s most recent message</h4>

<p>The Routing AI agent works to discern the consumer’s intent in their most recent message to determine how to route them. So ensure you use the Guided Routing interaction in an appropriate location in the bot, and in an appropriate mode (Conversational or Silent) for that location.</p>

<p>For example, you might have a concierge bot that greets the consumer. It has a Welcome dialog that’s triggered via a pattern match to various forms of “hello.” Following the dialog, there’s a question that asks, “How can I help you today?” In this case, it makes sense to insert the Guided Routing interaction immediately after the question because the answer to the question is appropriate to pass to the Guided Routing flow.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/gr18.png" alt="A dialog flow with a Welcome dialog that's triggered by a pattern match to forms of hello, following by a question eliciting the consumer's intent, followed by a Guided Routing interaction" /></p>

<p>On the other hand, you might have a concierge bot that likewise greets the consumer. It has a Welcome dialog that’s triggered via the “ * “ (wildcard) pattern, which means the dialog is always triggered no matter what the consumer says. In this case, you could insert the Guided Routing interaction immediately after the dialog starter. No question is needed.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/gr19.png" alt="A dialog flow with a Welcome dialog that's triggered by a wildcard pattern match, followed by a Guided Routing interaction" /></p>

<p>In this second case, the consumer might begin with an intentful message, such as, “Hi! Can I sign up for TV service?” But they might also start off with just, “Hi!” Why does the latter work? It’s perfectly fine as long as the Guided Routing interaction is in Conversational mode, and it showcases well the power of the Routing AI agent. If the bot can’t determine how to route the consumer based on just “Hi!”—and, of course, it can’t—then the bot will attempt to clarify the intent with the consumer by asking them a question. This is known as intent disambiguation.</p>

<h4 id="the-importance-of-the-conversation-context">The importance of the conversation context</h4>

<p>The Routing AI agent relies on previous turns from the current conversation to interpret the consumer’s last message. It also uses this conversational context to generate a response to send to the consumer. For these reasons, the <strong>last 10 messages</strong> between the bot and the consumer are always sent in the prompt to the LLM.</p>

<p class="attn-note">Currently, it’s not possible to customize this number of messages.</p>

<h3 id="fallback-flows-for-failures">Fallback flows for failures</h3>

<p>There are 2 kinds of failures:</p>

<ul>
  <li><strong>Logical failures</strong>: These are situations where the bot can’t match the consumer’s query to one of the defined routes.</li>
  <li><strong>System failures</strong>: These are related to runtime processes. The errors can be external (e.g., the LLM is not responding) or internal (e.g., a Conversation Builder error occurred when processing the interaction).</li>
</ul>

<h4 id="logical-failure-flow">Logical failure flow</h4>

<p>In <strong>Conversational mode</strong>, if the bot can’t match the consumer’s query to one of the defined routes, the bot is likely to attempt to disambiguate the consumer’s intent by asking clarifying questions. If those attempts fail, the conversation is redirected to the default route. If a default route doesn’t exist, the conversation is redirected to the interaction set in the Guided Routing interaction’s <strong>Next Action on Failure</strong> setting.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/gr20.png" alt="An example of the logical failure flow in action in a conversation, where the bot is working in Conversation mode" /></p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/gr21.png" alt="A callout to the Next Action on Failure setting in the Guided Routing interaction" /></p>

<p><strong>Silent mode</strong> doesn’t involve any dialogue between the bot and the consumer. So in this case, no intent disambiguation occurs. The conversation is immediately redirected to the default route. Here again, if a default route doesn’t exist, the conversation is redirected to the interaction set in the Guided Routing interaction’s <strong>Next Action on Failure</strong> setting.</p>

<p><a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#flow-diagram">See the fallback subflow in the Guided Routing flow diagram.</a></p>

<h4 id="system-failure-flow">System failure flow</h4>

<p>If a system failure occurs (e.g., the LLM is not responding), the conversational flow is directed to the interaction set in the Guided Routing interaction’s <strong>Next Action on Failure</strong> setting.</p>

<h4 id="handling-failures">Handling failures</h4>

<p>As a best practice, always define a default route.</p>

<p>Additionally, set <strong>Next Action on Failure</strong> in the Guided Routing interaction as you require. By default, it points to the Fallback dialog if one exists; otherwise, it points to the next interaction in the dialog. But, to ensure the consumer’s intent is resolved, you might want to redirect the flow to a dialog that transfers the conversation to an agent.</p>

<p class="attn-note"><strong>Next Action on Failure</strong> doesn’t work like <strong>Next Action</strong> in question interactions. That is, you can’t use <strong>Next Action on Failure</strong> to define custom rules that direct the conversational flow.</p>

<h3 id="route-definition">Route definition</h3>

<p>Route definition within the Guided Routing interaction is the <strong>most critical step</strong> in setup. You must specify a route name, description, and destination.</p>

<h4 id="route-name-and-description">Route name and description</h4>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr22.png" alt="The Create Route dialog, with a callout to the fields for specifying the route's name and description" /></p>

<p class="attn-note">The better the name and description, the better the consumer’s routing experience.</p>

<p>Invest time in creating strong route names and descriptions:</p>

<ul>
  <li><strong>Route name</strong>: Enter a brief but clear and meaningful name, for example, “Sign up for Internet service.” Special characters, such as underscores, are not permitted.</li>
  <li><strong>Description</strong>: Enter a clear and meaningful description, for example, “When the user wants to subscribe to an Internet service plan.”</li>
</ul>

<p class="attn-tip">If you’re struggling with the description, use Generative AI to get things rolling: Click the <strong>Generate</strong> button, and the system will use an LLM to generate a description based on the route name. You can keep the generated description as is, customize it, or write your own.</p>

<h4 id="route-destination">Route destination</h4>

<p>In a route, you must specify where to direct the conversational flow when the consumer’s query is matched to the route by the LLM:</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr23.png" alt="The Edit Route dialog, with a callout to the fields for specifying the route's destination" /></p>

<p>You can choose from:</p>

<table>
  <thead>
    <tr>
      <th>Routing destination</th>
      <th>Available in</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>LivePerson bot (specific dialog)</td>
      <td>messaging bot, voice bot</td>
    </tr>
    <tr>
      <td>Third-party bot</td>
      <td>messaging bot</td>
    </tr>
    <tr>
      <td>Skill</td>
      <td>messaging bot</td>
    </tr>
  </tbody>
</table>

<p>Each of these 3 routing destinations is discussed below.</p>

<p>During the conversational journey, the bot might be collecting data about the consumer and conversation (consumer’s first name, etc.). If you need to ensure this data is transferred to the destination bot, <strong>explicitly save it</strong> in LivePerson’s <a href="conversation-orchestrator-conversation-context-service-overview.html">Conversation Context Service</a> (CCS). The CCS is a cloud-based repository for storing and retrieving such data.</p>

<h5 id="transfer-to-liveperson-bot-specific-dialog">Transfer to LivePerson bot (specific dialog)</h5>

<p>You can select to transfer the conversation to any dialog in the current bot except the dialog that contains the Guided Routing interaction (to prevent circular references). You can also select to transfer the conversation to any dialog in any other LivePerson Conversation Builder bot in your account.</p>

<p class="attn-note">When the conversation is routed to the dialog, the dialog’s <a href="conversation-builder-interactions-dialog-starter.html">dialog starter</a> is skipped; the flow moves directly to the next interaction.</p>

<p class="attn-tip">Looking for the current bot but don’t see it in the list? Look for it <strong>by name</strong>.</p>

<h5 id="transfer-to-third-party-bot">Transfer to third-party bot</h5>

<p>You can select to transfer the conversation to any third-party bot in your account.</p>

<p>When the conversation is routed to the bot, the consumer’s most recent message is passed to the bot, and the bot simply handles the query per its design.</p>

<h5 id="transfer-to-skill">Transfer to skill</h5>

<p>You can select to transfer the conversation to any skill defined in your account. This can be a skill assigned to agents or bots. When the conversation is routed to the skill, the Agent Workspace’s agent matching rules are used to assign the conversation based on capacity.</p>

<h4 id="using-a-default-route">Using a default route</h4>

<p>You can optionally specify one route in the Guided Routing interaction as the default route. The default route plays an important role in the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#fallback-flows-for-failures">fallback flow for failures</a>, i.e., times when the Routing AI agent can’t identify a suitable route for the consumer’s intent.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr24.png" alt="The Edit Route dialog, with a callout to the checkbox for classifying the route as the default route" /></p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr25.png" alt="The Routes dialog that lists all defined routes, with a callout to the default route that is marked with a star icon" /></p>

<p>Since there can be only one default route per Guided Routing interaction, selecting the <strong>Default route</strong> checkbox for one route clears it for another route.</p>

<p>Define the default route as you require. For example, to ensure the consumer’s intent is resolved, you might use it to transfer the conversation to an agent.</p>

<h3 id="intent-disambiguation">Intent disambiguation</h3>

<p>Consumers don’t always express their intents clearly, so it might happen that the Routing AI agent isn’t able to discern the consumer’s intent. When this happens, the bot attempts to clear things up with the consumer. This is known as intent disambiguation.</p>

<p>Typically, intent disambiguation happens when the bot can’t identify a matched route:</p>

<p><img class="fancyimage" style="width:350px" src="img/ConvoBuilder/gr26.png" alt="An example conversation where the bot is trying to disambiguate the consumer's intent" /></p>

<p>But intent disambiguation also might happen when the bot identifies multiple matched routes:</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/gr27.png" alt="An example conversation where the bot asks the consumer which of multiple intents to handle first" /></p>

<p>Keep in mind that intent disambiguation only happens if the Guided Routing interaction is configured for <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#conversational-versus-silent-mode">Conversational mode</a>. It doesn’t happen in <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#conversational-versus-silent-mode">Silent mode</a> because there’s no opportunity for the consumer to engage in dialogue with the bot and thereby clarify their intentions.</p>

<p>You can customize the number of attempts made at intent disambiguation via the <strong>Turns to disambiguate</strong> setting in the Guided Routing interaction. The setting is on the <strong>Advanced</strong> tab.</p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/gr44.png" alt="The Advanced tab of the interaction, which displays the Turns to disambiguate setting" /></p>

<p>If intent disambiguation fails to result in a matched route, the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#fallback-flows-for-failures">logical fallback flow</a> begins.</p>

<h4 id="the-impact-of-the-prompt-on-disambiguation">The impact of the prompt on disambiguation</h4>

<p>The LLM tries to follow the behavior demonstrated in the examples in the prompt. If the consumer’s query is very dissimilar to the scenarios in the Guided Routing prompt, disambiguation might fail. For this reason, we highly recommend that you customize the examples in the prompt. See "Prompt customization" in this article.</p>

<h4 id="disabling-disambiguation">Disabling disambiguation</h4>

<p>We don’t recommend that you remove support for disambiguation because it’s a powerful and useful part of the consumer’s experience. However, you can do so via prompt customization. (See "Prompt customization" in this article.) Use caution when editing this part of the prompt.</p>

<h4 id="what-about-my-disambiguation-dialog">What about my Disambiguation dialog?</h4>

<p>If you have a bot that uses a <a href="conversation-builder-dialogs-disambiguation-dialogs.html">Disambigation dialog</a>, be aware that it remains unaffected. The Disambiguation dialog only comes into play during intent matching in <a href="conversation-builder-interactions-dialog-starter.html">dialog starters</a>, which always happens <em>before</em> the Guided Routing interaction (or any interaction) is processed as the current interaction in the flow.</p>

<h3 id="programmatically-retrieving-the-matched-route">Programmatically retrieving the matched route</h3>

<p>Conversation Builder automatically stores the matched route in the following <code class="language-html highlighter-rouge">botContext</code> variable:</p>

<p><code class="language-html highlighter-rouge">{$botContext.routeName}</code></p>

<p>Use this variable within your custom code to implement specialized route handling. This provides a level of precision and flexibility that goes beyond the standard Guided Routing interaction.</p>

<h3 id="handling-multiple-intents">Handling multiple intents</h3>

<p>Sometimes a consumer has multiple queries in a single message, such as, “I need to update my email address, and I want to add TV service.” The Routing AI agent can handle this.</p>

<p>However, the Routing AI agent only ever finds a single matched route. So, successful handling of multiple intents relies on use of the conversation history to determine the next intent. Use the following discussion to guide your implementation.</p>

<h4 id="handling-the-1st-intent-returning-and-prioritizing-routes">Handling the 1st intent: Returning and prioritizing routes</h4>

<p>When the Routing AI agent detects multiple intents in the consumer’s query and finds multiple matched routes suitable for those intents, the order in which the routes are returned to the bot is left up to the LLM.</p>

<p>In many cases, the generated response returned by the LLM is a question for the consumer as to which intent to handle first.</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/gr34.png" alt="An example conversation where the bot asks the consumer which of multiple intents to handle first" /></p>

<p>But this doesn’t always happen, as the LLM’s behavior is non-deterministic:</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/gr35.png" alt="An example conversation where the consumer has multiple intents but the bot doesn't ask the consumer which to handle first; it routes the consumer to one" /></p>

<p class="attn-tip">If you want to prioritize specific routes, try adding instructions on this to the “Closing instructions” in the prompt. See "Prompt customization" later in this article.</p>

<h4 id="handing-the-2nd-3rd-etc-intent">Handing the 2nd (3rd, etc.) intent</h4>

<p>Every time the conversation moves back to the Guided Routing interaction, the Conversational Cloud conversation ID is used to fetch the 10 most recent messages in the conversation. These messages are provided as an additional input to the LLM as it determines the next route and generates a response.</p>

<p>The contextual memory and route info are collectively used to offer a warm transfer, like this one:</p>

<p><img class="fancyimage" style="width:350px" src="img/ConvoBuilder/gr36.png" alt="An example conversation where the bot remembers the consumer's next intent" /></p>

<h5 id="bot-to-bot-routing-example">Bot-to-bot routing example</h5>

<p>The details on how the contextual memory is accumulated and used is best understood by way of an example:</p>

<ol>
  <li>Acme Telco’s Concierge bot, a LivePerson bot, greets the consumer and asks for their query.</li>
  <li>
    <p>The consumer responds with, “I want to update my email address and also sign up for TV service.”</p>

    <p>Assume steps 1 and 2 take 4 messages between bot and consumer.</p>
  </li>
  <li>Within the Concierge bot, the conversation flow moves to the Guided Routing interaction, and the LLM is supplied with the first <strong>4 messages</strong> in the conversation (a maximum of 10 is sent).</li>
  <li>
    <p>The LLM discerns the consumer’s 2 intents and returns 2 matched routes:</p>

    <ul>
      <li>LivePerson Sales bot &gt; “TV sign-up” dialog</li>
      <li>LivePerson Support bot &gt; “Update email address” dialog</li>
    </ul>
  </li>
  <li>The Concierge bot routes the conversation to the Sales bot’s “TV sign-up” dialog.</li>
  <li>The Sales bot assists the consumer with the task. Assume this takes <strong>15 messages</strong> between bot and consumer.</li>
  <li>The Sales bot asks the consumer if they have any other queries to handle.</li>
  <li>The consumer answers affirmatively, so the Sales bot transfers the conversation directly back to the Guided Routing interaction in the Concierge bot.</li>
  <li>The Guided Routing interaction goes to work again: The last <strong>10 messages</strong> in the conversation (from the Sales bot) are supplied as an additional input to the LLM. To discern the next route and generate a response, the LLM uses <strong>the stored route info, the original 4 messages, and the additional 10 messages</strong>. The next route is determined to be the “Update email address” dialog in the Support bot.</li>
  <li>The Concierge bot generates and sends a relevant message to the consumer, and it routes the conversation to the Support bot’s “Update email address” dialog.</li>
</ol>

<h4 id="returning-to-guided-routing-from-within-conversational-cloud">Returning to Guided Routing from within Conversational Cloud</h4>

<p>In a multi-intent scenario—after the first intent is resolved—the conversational flow isn’t returned automatically to the Guided Routing interaction so that the next intent can be handled. You must build the return. There are two components that make the return effective:</p>

<ol>
  <li>A clear bot message that the first intent has been resolved.</li>
  <li>A clear consumer message that they want to continue with the next intent. This should be the consumer’s last message before returning to the Guided Routing interaction.</li>
</ol>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/gr37.png" alt="An example conversation that includes both required components" /></p>

<p>Implement the first component in the business dialog:</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/gr38.png" alt="A statement interaction at the end of a business dialog that sends a message to the consumer acknowledging resolution of the consumer's intent" /></p>

<p>You can implement the second component in different ways. In our example bot, we’re relying on a reusable “Ask if anything else” dialog that’s used by all of the business dialogs in the bot. And, to help to promote a consistent, expected reply from the consumer, we’ve chosen to use a <a href="conversation-builder-interactions-questions.html#button">Button question</a> with suitable responses, like so:</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/gr39.png" alt="A Button question that asks the consumer if they have more intents to resolve, which provides predefined affirmative and negative responses" /></p>

<p>In our example, everything is happening within the same bot, so we’ve just set the “Yes rule” to return directly to the Guided Routing interaction. So the setup for this intra-bot transfer is simple.</p>

<p>However, if multiple bots are in play, things are more complex. A lot depends on the design of the <em>source bot</em> (the business bot that handles the consumer’s query) and the <em>destination bot</em> (the Routing AI agent that you want to go back to). Here are some approaches to consider to build the return back to the Guided Routing interaction:</p>

<ul>
  <li>In the source bot, include another Guided Routing interaction. Define a route within it that transfers the conversation to the Routing AI agent’s dialog that has the main Guided Routing interaction.</li>
  <li>
    <p>Perform an <a href="conversation-builder-interactions-integrations.html#agent-transfer">Agent Transfer</a> to the Routing AI agent’s assigned skill. Make sure to transfer the bot’s context, passing in a specific consumer message that triggers the dialog containing the Guiding Routing interaction.</p>

    <p>In the Routing AI Agent, if the Guided Routing interaction immediately follows a dialog starter with a “ * ” pattern, then any consumer message will trigger the right dialog containing the Guided Routing interaction.</p>
  </li>
  <li>Rely on intent/pattern matching and automatic <a href="conversation-builder-bots-bot-to-bot-transfers.html">bot-to-bot transfers</a> to transfer the conversation to the Routing AI agent’s dialog that has the Guided Routing interaction.</li>
</ul>

<h4 id="returning-to-guided-routing-from-a-third-party-bot">Returning to Guided Routing from a third-party bot</h4>

<p>Once a conversation is transferred to a third-party bot to handle an intent, the conversation is outside of Conversational Cloud. There’s no out-of-the-box mechanism that you can use to return the conversation to the Routing AI agent, so it can pick things up again to handle the consumer’s next intent.</p>

<p>You must manually build into the third-party bot support for transferring the conversation back to the Routing AI agent. You might accomplish this by performing a transfer back to the bot’s <strong>assigned skill</strong> in Conversation Cloud using the <a href="messaging-platform-sdk-overview.html">Messaging Platform SDK</a> (<a href="messaging-platform-sdk-examples.html#transfer-to-skill">example</a>). The specific implementation depends on the design of the involved bots.</p>

<p>The basic principle described above for LivePerson bots applies here too: Configure the bots so that you pass to the LLM conversational context that indicates 1) a specific intent has been resolved, and 2) the consumer desires to continue on with the next route.</p>

<h3 id="context-transfer">Context transfer</h3>

<p>As described in our discussion on <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#handling-multiple-intents">handling multiple intents</a>, there exists a contextual memory that is used by the LLM to help it to determine the consumer’s next route and generate a response.</p>

<p>However, in the case of <strong>bot-to-bot transfers</strong> facilitated by the Routing AI agent, keep in mind that this same contextual memory isn’t transferred to the destination bot. It’s provided only to the LLM to support routing decisions.</p>

<h3 id="prompt-customization">Prompt customization</h3>

<h4 id="the-complete-default-prompt">The complete default prompt</h4>

<p>Here’s the complete default prompt for the Guided Routing interaction:</p>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>You are a digital assistant for guiding users to the appropriate route.
You are friendly, but professional.
------
Your goal is to disambiguate the users intent and route them to the appropriate agent or bot given their intent.
------
Here is a list of intents, their appropriate routes, and their descriptions. When routing, append the raw string associated with the appropriate route to the end of the message.
------
LIST_OF_INTENTS:
------
{intent_list}
------
- If you're unsure of the user's intent or their intent does not match any of the previous intents, list out and describe _some_ of the routes you're able to send them to. Don't list out everything! Keep your answers concise!
- Choose wisely from only the routing strings provided to you within the LIST_OF_INTENTS.
- Instead of creating your own routing string, try asking the user disambiguating questions if you're unsure.
-------
- If they have multiple intents, ask them leading questions to understand their situation better.
- If you have determined the singular intent to route, respond with the raw string associated with their agent route at the end of your response.
------
GENERAL EXAMPLES:
------
ex1:
  User:
  	yeah im really stressed, now i need to cancel and get a refund
  Assistant:
  	I understand you're feeling stressed. Let's figure out how to alleviate that. It sounds like you have two requests to process, a flight cancelation and a refund. Have you started the refund process yet?
  User:
  	Yes I have.
  Assistant:
  	Great! Then let me route you to the flight cancelation agent. [ROUTE::CANCEL_FLIGHT]
ex2:
  User:
  	you lost my bags and now I need a refund
  Assistant:
  	It sounds like you have two requests to process, one regarding your lost baggage and another related to your refund. Is your refund related to your lost baggage?
  User:
  	of course it is
  Assistant:
  	Okay. Have you filed an existing claim for your lost baggage?
  User:
  	no not yet..
  Assistant:
  	Understood. Let's handle these issues one at a time. I'll start by routing you to an agent that can take care of the baggage claim, then we can tackle your refund. [ROUTE::LOST_BAGGAGE]
------
As you have access to the chat history, you can remember previous messages. Try your best to help users when they return from being routed.
So, when a user returns from being routed, and says something like "hi" or "let's keep going", ask them how their experience with the other agent went, and if you can help with any of the pre-existing issues.
Its very important that when you decide on a route, that you also include a short message along with it:
"Great! I can help you with ____ [ROUTE::ROUTE]" or "I understand you want to ____, let me send you to the right place for that [ROUTE::ROUTE]"
</code></pre></div></div>

<p class="attn-tip">We recommend that you start prompt engineering by modifying only the Role/Persona and General Examples sections. If you’re not getting the behavior that you desire after modifying these sections, read through the rest of the guidance in this section. Then take your prompt engineering further to resolve the particular issue.</p>

<h4 id="role-and-persona">Role and persona</h4>

<p>This section educates the LLM on its role and responsibilities. By default, we’ve kept the language very general to the task.</p>

<p><code class="language-html highlighter-rouge">You are a digital assistant for guiding users to the appropriate route.</code></p>

<p><code class="language-html highlighter-rouge">You are friendly, but professional.</code></p>

<p>We strongly recommend that you modify this section to fit the needs of your brand. Include a description of the voice that you want the bot to adopt. Consider including a name for the bot.</p>

<h5 id="more-about-persona">More about persona</h5>

<p>The persona can significantly influence the response from the LLM in several ways:</p>

<ul>
  <li>Tone</li>
  <li>Style</li>
  <li>Vocabulary and language choice</li>
  <li>Emotional expression</li>
  <li>Behavior and decision-making processes</li>
</ul>

<p>Below are some options and language to get you started with defining a customized persona for your brand:</p>

<ul>
  <li><strong>Friendly and approachable</strong>: This persona is characterized by warm, welcoming, and polite language. The AI bot interacts in a manner that makes users feel at ease and encourages open communication.</li>
  <li><strong>Task-oriented and efficient</strong>: This persona is focused on helping users achieve specific goals or complete tasks quickly. The AI bot provides clear instructions and relevant information in a straightforward and concise manner.</li>
  <li><strong>Youthful and trendy</strong>: This persona incorporates slang, popular culture references, and a more energetic and casual style of communication. The AI bot appeals to a younger audience by engaging with the latest trends and staying up-to-date with current events.</li>
  <li><strong>Creative and imaginative</strong>: This persona uses vivid descriptive language, metaphors, and storytelling to engage users and spark their imagination. The AI bot provides information in a more unique and artistic manner, leaving room for interpretation and deeper thought.</li>
</ul>

<h4 id="initial-instructions">Initial instructions</h4>

<p>This section is an overall statement of the function of guided routing. It can be modified, but this might drastically influence the behavior if changed completely. Modify it with caution.</p>

<p><code class="language-html highlighter-rouge">Your goal is to disambiguate the users intent and route them to the appropriate agent or bot given their intent.</code></p>

<h4 id="list-of-intents">List of intents</h4>

<p>This section is where the names and descriptions of each defined route are included:</p>

<p><code class="language-html highlighter-rouge">Here is a list of intents, their appropriate routes, and their descriptions. When routing, append the raw string associated with the appropriate route to the end of the message.</code></p>

<p><code class="language-html highlighter-rouge">------</code></p>

<p><code class="language-html highlighter-rouge">LIST_OF_INTENTS:</code></p>

<p><code class="language-html highlighter-rouge">------</code></p>

<p><code class="language-html highlighter-rouge">{intent_list}</code></p>

<p>In most cases, this section <strong>should not be modified</strong>, as removing the <code class="language-html highlighter-rouge">{intent_list}</code> variable breaks the guided routing functionality completely.</p>

<p>If it's absolutely necessary to modify this section, “mostly safe” modifications include:</p>

<ul>
  <li>Changing the wording of the preamble (<code class="language-html highlighter-rouge">Here is a list of…</code>)</li>
  <li>Changing the name of the delimited header (<code class="language-html highlighter-rouge">LIST_OF_INTENTS</code>). It would then be best practice to update this reference elsewhere in the prompt as well.</li>
  <li>Moving the entire section to a different location in the prompt.</li>
</ul>

<p class="attn-alert">Don’t remove the part of the prompt about “append[ing] the raw string.” This is critical for proper functioning of Guided Routing. The raw string isn’t sent to the consumer in Conversation Builder’s <a href="conversation-builder-testing-deployment-preview-the-bot.html">Preview tool</a> or in an actual channel.</p>

<h4 id="middle-instructions">Middle instructions</h4>

<p>The purpose of this section is to provide more specific detail on the Guided Routing task beyond the initial framing of the task.</p>

<p><code class="language-html highlighter-rouge">------</code></p>

<p><code class="language-html highlighter-rouge">- If you're unsure of the user's intent or their intent does not match any of the previous intents, list out and describe _some_ of the routes you're able to send them to. Don't list out everything! Keep your answers concise!</code></p>

<p><code class="language-html highlighter-rouge">- Choose wisely from only the routing strings provided to you within the LIST_OF_INTENTS.</code></p>

<p><code class="language-html highlighter-rouge">- Instead of creating your own routing string, try asking the user disambiguating questions if you're unsure.</code></p>

<p><code class="language-html highlighter-rouge">-------</code></p>

<p><code class="language-html highlighter-rouge">- If they have multiple intents, ask them leading questions to understand their situation better.</code></p>

<p><code class="language-html highlighter-rouge">- If you have determined the singular intent to route, respond with the raw string associated with their agent route at the end of your response.</code></p>

<p><code class="language-html highlighter-rouge">------</code></p>

<p>Modify this section with caution. The safest edits include additions or tweaks to the wording that don’t change the overall meaning of the instructions.</p>

<p>Edit this section only if you need to change the behavior of Guided Routing, i.e., tweaking intent disambiguation or multi-intent handling.</p>

<p class="attn-alert">Don’t remove the part about “respond[ing] with the raw string.” This is critical for proper functioning. The raw string isn’t sent to the consumer in Conversation Builder’s <a href="conversation-builder-testing-deployment-preview-the-bot.html">Preview tool</a> or in an actual channel.</p>

<h4 id="general-examples">General examples</h4>

<p>This section includes general conversational examples that demonstrate the functionality of Guided Routing.</p>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>GENERAL EXAMPLES:
------
ex1:
  User:
      yeah im really stressed, now i need to cancel and get a refund
  Assistant:
      I understand you're feeling stressed. Let's figure out how to alleviate that. It sounds like you have two requests to process, a flight cancelation and a refund. Have you started the refund process yet?
  User:
      Yes I have.
  Assistant:
      Great! Then let me route you to the flight cancelation agent. [ROUTE::CANCEL_FLIGHT]
ex2:
  User:
      you lost my bags and now I need a refund
  Assistant:
      It sounds like you have two requests to process, one regarding your lost baggage and another related to your refund. Is your refund related to your lost baggage?
  User:
      of course it is
  Assistant:
      Okay. Have you filed an existing claim for your lost baggage?
  User:
      no not yet..
  Assistant:
      Understood. Let's handle these issues one at a time. I'll start by routing you to an agent that can take care of the baggage claim, then we can tackle your refund. [ROUTE::LOST_BAGGAGE]
------
</code></pre></div></div>

<p class="attn-note">We <strong>highly recommend</strong> that you modify the content underneath this section’s header. While the default examples contribute to the LLM following the intended behavior of Guided Routing, they <strong>could potentially lead to hallucinated routes</strong> because they apply to a specific domain. Adjusting them to be brand-specific most likely will increase performance and reduce hallucinations.</p>

<h4 id="closing-instructions">Closing instructions</h4>

<p>This section includes the instructions that are the most specific:</p>

<p><code class="language-html highlighter-rouge">As you have access to the chat history, you can remember previous messages. Try your best to help users when they return from being routed.</code></p>

<p><code class="language-html highlighter-rouge">So, when a user returns from being routed, and says something like "hi" or "let's keep going", ask them how their experience with the other agent went, and if you can help with any of the pre-existing issues.</code></p>

<p><code class="language-html highlighter-rouge">It’s very important that when you decide on a route, that you also include a short message along with it:</code></p>

<p><code class="language-html highlighter-rouge">"Great! I can help you with ____ [ROUTE::ROUTE]" or "I understand you want to ____, let me send you to the right place for that [ROUTE::ROUTE]"</code></p>

<p>Since this section includes instructions that are highly specific, it might need to change depending on the current functionality of your Routing AI agent, especially with regard to <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#handling-multiple-intents">multi-intent handling</a>.</p>

<p>In general, this section is the safest to modify. Include within it any reminders for adjusting the behavior and any guidance that addresses various concerns. For example, here is where you might want to insert some guidance on which routes should take priority when multiple routes are identified.</p>

<h4 id="working-in-a-prompt-in-the-prompt-library">Working in a prompt in the Prompt Library</h4>

<p>If you’re using an LLM to power other parts of your Conversational Cloud solution, you’re creating and managing prompts in the Prompt Library for multiple use cases. So, you might notice that things are a little different when the prompt’s client type is a “Routing AI agent.” Specifically:</p>

<ul>
  <li>On the <strong>Advanced</strong> tab, you can’t change the LLM that’s used. Also, there are no settings for specifying if conversation context should be included in the prompt to the LLM, and how much. This is because some conversation context is always sent to the LLM in the case of Guided Routing.</li>
  <li>The <strong>User content suffix</strong> tab is disabled, as there’s no support for this feature in the case of Guided Routing.</li>
  <li>You can create a Guided Routing prompt from scratch, but take care when doing so. Ensure you select the proper client type, which is “Routing AI agent.” In turn, this selection determines other settings that you see, their options, whether they’re customizable, and so on.</li>
</ul>

<h3 id="interaction-configuration">Interaction configuration</h3>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/gr28.png" alt="An example of a Guided Routing interaction" /></p>

<h4 id="task-prompt-for-llm">Task (prompt) for LLM</h4>

<p><a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#prompt-customization">Learn about what’s supported in the default LivePerson prompt and customization opportunities.</a></p>

<h4 id="silent-mode-or-conversational-mode">Silent mode or Conversational mode</h4>

<p>Select the mode of interaction with the consumer: Conversational or Silent. <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#conversational-versus-silent-mode">Learn about Conversation mode and Silent mode.</a></p>

<h4 id="routes">Routes</h4>

<p>For proper functioning, you must <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#route-definition">create at least one route</a>.</p>

<h4 id="next-action-on-failure">Next action on failure</h4>

<p>This setting supports the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#fallback-flows-for-failures">fallback flows for failures</a>.</p>

<h4 id="basic-settings">Basic settings</h4>

<p>Learn about <a href="conversation-builder-interactions-configuration-settings.html#basic-settings">Basic interaction settings</a>.</p>

<p class="attn-note">A Guided Routing interaction doesn’t have an <strong>Interaction Delay</strong> setting since it isn’t needed. There’s typically a small delay with every LLM call.</p>

<h4 id="advanced-settings">Advanced settings</h4>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/gr45.png" alt="The Advanced tab in the interaction's settings" /></p>

<h5 id="llm-response-timeout">LLM response timeout</h5>

<p>Calling the LLM for a response to send to the consumer can take some time. But you don’t want to leave the consumer hanging for too long in cases where the LLM isn’t performant. Enter the number of seconds to wait for a response from the LLM. If there’s no response within this timeframe, the interaction set in <strong>Next Action on Failure</strong> is triggered.</p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/gr30.png" alt="The Next Action on Failure setting that's on the face of the Guided Routing interaction" /></p>

<h5 id="turns-to-disambiguate">Turns to disambiguate</h5>

<p>Customize the number of attempts made by the AI agent to clarify the consumer's intent.</p>

<p><a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#intent-disambiguation">Learn more about intent disambiguation.</a></p>

<h4 id="order-of-operations">Order of operations</h4>

<p><a href="conversation-builder-interactions-interaction-basics.html#guided-routing-interaction">Learn about the Guided Routing interaction's order of operations.</a></p>

<h3 id="best-practices">Best practices</h3>

<h4 id="bot-architecture">Bot architecture</h4>

<ul>
  <li>To support multi-intent scenarios, ensure you feed the LLM a clear bot message that the first intent has been resolved and a clear consumer message that the consumer wants to continue on with their next intent. See the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#returning-to-guided-routing-from-within-conversational-cloud">discussion on returning to Guided Routing</a>.</li>
  <li>If the routes that you’ve defined point to dialogs in the current bot or in other LivePerson bots, update all of those destination dialogs by adding a small <a href="conversation-builder-interactions-configuration-settings.html#basic-settings">interaction delay</a> (500 - 1,000 milliseconds) at the top. Typically, this small delay is needed to give the Routing AI agent sufficient time to send the LLM-generated message to the consumer before starting the dialog’s flow. Add the delay to the first interaction that isn’t a dialog starter, as the Guided Routing flow always skips over a dialog starter if one exists.</li>
</ul>

<h4 id="guided-routing-interaction">Guided Routing interaction</h4>

<ul>
  <li><strong>Routes</strong>: The better the name and description, the better the consumer’s routing experience. So invest time in creating strong route names and descriptions.</li>
  <li><strong>Routes</strong>: Strive to define 20-25 routes in the Guided Routing interaction. There is some performance degradation as you exceed this range.</li>
  <li>
    <p><strong>Routes</strong>: <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#using-a-default-route">Define a default route</a>, so the bot gracefully handles <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#fallback-flows-for-failures">logical and system failures</a> and gets the consumer to another bot or agent that can help them with their query.</p>

    <p>This is especially important if the Guided Routing interaction uses <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#conversational-versus-silent-mode">Silent mode</a>. Without the opportunity for intent disambiguation through dialogue between the bot and consumer, the rate of unmatched intents is likely to be higher. Using a default route helps to ensure that the consumer’s query is ultimately resolved.</p>

    <p>Defining a default route is also important if the Guided Routing interaction is located in the <a href="conversation-builder-dialogs-fallback-dialogs.html">Fallback dialog</a>. Without a default route, the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#fallback-flows-for-failures">fallback flow</a> can result in a loop that takes the consumer from the Guided Routing interaction (in the Fallback dialog) right back to the Fallback dialog…and back to the Guided Routing interaction (in the Fallback dialog)…on repeat. This leaves the consumer stuck, with their intent unresolved.</p>
  </li>
</ul>

<h4 id="guided-routing-prompt">Guided Routing prompt</h4>

<ul>
  <li>When customizing the Guided Routing prompt, follow the guidance in <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#prompt-customization">Prompt customization</a> in this article.</li>
  <li>Also follow the <a href="trustworthy-generative-ai-prompt-library-best-practices.html">general guidance on writing and managing prompts</a>.</li>
</ul>

<h3 id="limitations">Limitations</h3>

<h4 id="bot-releases">Bot releases</h4>

<p>A <a href="conversation-builder-versions-releases.html">bot release</a> is used to push a snapshot of one bot (e.g., a development bot) to a different bot (e.g., a production bot) in the same account, updating the target bot with the new bot code.</p>

<p>In all but one case, bot releases work fully.</p>

<p>This is the exception case: If the Routing AI agent has a route that points to a dialog in a <strong>different LivePerson bot</strong>, that dialog reference will break in the target bot as a result of upgrading it to the release. In other words, in the target bot, the field for the destination dialog will be blank. So, after the upgrade, you must check all of the routes in the target bot, and reconfigure the ones that are impacted:</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr42.png" alt="The Edit Route window, with a callout to the routing destination fields for a route, which might be blank in error cases" /></p>

<p>Keep in mind that there’s no warning displayed regarding this situation, so always perform a check of each route’s configuration after you push a bot release.</p>

<p>Also keep in mind that you should manually reconfigure the routing destination as quickly as possible, as any conversations that are started before doing so will become stuck if they try to use the impacted route.</p>

<p>We are working on an enhancement to make this situation easier to handle, so stay tuned!</p>

<h4 id="export-and-import-of-a-bot-dialog-or-dialog-template">Export and import of a bot, dialog, or dialog template</h4>

<p>Routing AI agents can be exported and imported, just like other bots. You can also import dialogs and dialog templates into Routing AI agents, just like you can in any other bot. The issue here is that a route can point to:</p>

<ul>
  <li>A dialog in a LivePerson bot (in the same bot or in a different bot)</li>
  <li>A third-party bot</li>
  <li>A skill</li>
</ul>

<p>Simple export/import scenarios <strong>within the same account</strong> don’t break routes if the routes point <strong>within the same, current bot</strong>.</p>

<p>But, there are numerous export/import scenarios that can break routes that reference external resources (other LivePerson bots, third-party bots, and skills). Does the referenced resource exist in the account and have the same underlying ID? If not, such references break.</p>

<p>The safest, recommended approach to exports and imports when it comes Routing AI agents is this:</p>

<ul>
  <li>After any import, <strong>verify</strong> that all routes are configured correctly.</li>
  <li><strong>Reconfigure</strong> any routes that are broken. A broken route will have a routing destination that is blank. There is no warning displayed regarding this situation, but we’re working on an enhancement to make it easier to handle. Stay tuned!</li>
</ul>

<h4 id="hallucinations">Hallucinations</h4>

<p>Generally speaking, <a href="trustworthy-generative-ai-prompt-library-key-terms-concepts.html#hallucinations">hallucinations</a> are situations where the LLM service generates incorrect or nonsensical responses, or responses that aren't grounded in the contextual data or brand knowledge that was provided. Typically, hallucinations happen when the LLM service relies too heavily on its language model and fails to effectively leverage the provided source content.</p>

<p>Within the context of Routing AI agent in specific, hallucinations might involve not only “made up” info, but also “made up” routes. If a route is made up (i.e., routes A, B, and C are defined in the interaction but the LLM returns route D), the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#fallback-flows-for-failures">fallback flow for failures</a> begins.</p>

<p>Any solution that uses an LLM carries some degree of risk of hallucinations. Routing AI agents are no different. If you incorporate a Routing AI agent into your solution, you accept this risk.</p>

<p>To mitigate the risk of the Routing AI agent making it up its own routes, don’t remove the following part from the prompt’s <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#middle-instructions">Middle Instructions</a>:</p>

<p><code class="language-html highlighter-rouge">- Instead of creating your own routing string, try asking the user disambiguating questions if you're unsure.</code></p>

<p>Overall, test thoroughly and strive to use prompt engineering to resolve issues related to hallucinations.</p>

<h4 id="guided-routing-prompt-1">Guided Routing prompt</h4>

<p>The abilities of the Routing AI agent are heavily dependent on the prompt that’s used. As with any LLM-powered solution, there’s some degree of variability in behavior, so the performance that you expect isn’t 100% guaranteed. This means that multi-intent handling might not always behave as desired. It also means that intent disambiguation might not always behave as desired.</p>

<h3 id="application-in-the-voice-channel">Application in the Voice channel</h3>

<p>If you’re dissatisfied with your highly deterministic IVR solution, consider replacing it with a Routing AI agent that offers a conversational routing experience. Here’s what you need to know:</p>

<ul>
  <li>
    <p>The bot can route to any dialog within itself except the dialog that contains the Guided Routing interaction (to prevent circular references). The bot can also route to any dialog in any other Conversation Builder bot in your account. <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#route-destination">Learn about route destinations.</a></p>

    <p class="attn-note">Routing to third–party bots or skills isn’t supported.</p>
  </li>
  <li>The routing experience is a conversational one where input from the consumer regarding their intent is vital. So, the Guided Routing interaction has no <a href="conversation-builder-bots-voice-bots.html#consumer-interruptions">advanced setting for preventing consumer interruptions</a>. The consumer is always free to interrupt during this interaction.</li>
  <li>The bot’s <a href="conversation-builder-bots-bot-basics.html#configure-voice-settings-voice-bots-only">bot-level voice settings</a> are used when sending responses to the consumer. You can’t specify SSML in the Guided Routing interaction.</li>
</ul>

<h3 id="testing">Testing</h3>

<p>Use Conversation Builder’s <a href="conversation-builder-testing-deployment-debug-the-bot.html">Bot Logs</a> and <a href="conversation-builder-testing-deployment-test-debug-post-deployment.html">Conversation Tester</a> debugging tools to help you test the Guided Routing experience.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr31.png" alt="An example of debugging a Routing AI agent using Bot Logs" /></p>

<h3 id="troubleshooting">Troubleshooting</h3>

<p>This section contains helpful tips related to troubleshooting Guided Routing issues in specific.</p>

<h4 id="prompt-issue---the-routes-are-incorrect">Prompt issue - The routes are incorrect</h4>

<p>Unfortunately, there are many potential reasons why the routes might not be accurate. However, a great place to start troubleshooting for a solution is the <strong>Description</strong> field for the defined routes.</p>

<p>If some of the routes look or sound too similar, you might need to explicitly articulate how they are different from each other in one or all of the route descriptions that apply.</p>

<p>Try playing with both the route names and descriptions to solve route confusion problems.</p>

<h4 id="prompt-issue---the-routes-are-made-up">Prompt issue - The routes are made up</h4>

<p>Currently, in the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#middle-instructions">Middle Instructions</a> section, there are a couple bullet points in the prompt that say this:</p>

<p><code class="language-html highlighter-rouge">- Choose wisely from only the routing strings provided to you within the LIST_OF_INTENTS.</code></p>

<p><code class="language-html highlighter-rouge">- Instead of creating your own routing string, try asking the user disambiguating questions if you're unsure.</code></p>

<p>The instructions above are not guaranteed to work (as you’re currently experiencing), and there is no prompting solution that works 100% of the time for this issue. However, you can try changing the wording of the above clause according to our best practices for prompt engineering. Here are some things to try:</p>

<ul>
  <li>
    <p><a href="trustworthy-generative-ai-prompt-library-best-practices.html#emotional-prompting-can-improve-performance">Emotional Prompting</a>:</p>

    <p><code class="language-html highlighter-rouge">Choose wisely from only the routing strings provided to you within the LIST_OF_INTENTS. I believe in your abilities!</code></p>
  </li>
  <li>
    <p><a href="trustworthy-generative-ai-prompt-library-best-practices.html#chain-of-thought-cot-prompting-can-improve-performance">Zero Shot Chain of Thought Prompting</a>:</p>

    <p><code class="language-html highlighter-rouge">Choose wisely from only the routing strings provided to you within the LIST_OF_INTENTS. Think very carefully about this.</code></p>

    <p><code class="language-html highlighter-rouge">Instead of creating your own routing string, try asking the user disambiguating questions if you're unsure. Let’s think step by step.</code></p>
  </li>
</ul>

<h4 id="prompt-issue---multi-intent-handling-isnt-working">Prompt issue - Multi-intent handling isn’t working</h4>

<p>One reason why multiple intents aren’t being handled correctly could be due to the “resuming” behavior. When you route the conversation back to the Routing AI agent—i.e., back to the Guided Routing interaction in the bot—bot should have visibility into the previous conversation and should resume trying to handle the next intent. However, the bot needs to be prompted again to respond, and the user message that is sent to “resume” the conversation can have an effect on the performance.</p>

<p>Try experimenting with what user message you send to the bot upon returning to the Guided Routing interaction.</p>

<p>Additionally, you can alter the prompt to modify this behavior. The snippet below from the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#closing-instructions">Closing Instructions</a> section contains information about this task:</p>

<p><code class="language-html highlighter-rouge">As you have access to the chat history, you can remember previous messages. Try your best to help users when they return from being routed.</code></p>

<p><code class="language-html highlighter-rouge">So, when a user returns from being routed, and says something like "hi" or "let's keep going", ask them how their experience with the other agent went, and if you can help with any of the pre-existing issues.</code></p>

<p>Try tweaking this language to affect the bot’s behavior.</p>

<h4 id="prompt-issue---i-want-a-conversational-experience-without-intent-disambiguation">Prompt issue - I want a conversational experience without intent disambiguation</h4>

<p>If you require the following behavior:</p>

<ul>
  <li>No disambiguating questions are asked</li>
  <li>Generated responses along with routes are still provided</li>
  <li>Essentially the bot routes after every user utterance</li>
</ul>

<p>Then, you’ll need to make some modifications to the entire prompt, by removing and changing some language in various sections. Here are our recommendations:</p>

<h5 id="middle-instructions-1">Middle Instructions</h5>

<p>In the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#middle-instructions">Middle Instructions</a>, remove or modify the following snippets because they contribute to the behavior of asking disambiguating and leading questions.</p>

<p><code class="language-html highlighter-rouge">- If you're unsure of the user's intent or their intent does not match any of the previous intents, list out and describe _some_ of the routes you're able to send them to. Don't list out everything! Keep your answers concise!</code></p>

<p><code class="language-html highlighter-rouge">...</code></p>

<p><code class="language-html highlighter-rouge">- Instead of creating your own routing string, try asking the user disambiguating questions if you're unsure.</code></p>

<p><code class="language-html highlighter-rouge">-------</code></p>

<p><code class="language-html highlighter-rouge">- If they have multiple intents, ask them leading questions to understand their situation better.</code></p>

<h5 id="closing-instructions-1">Closing Instructions</h5>

<p>In the <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#closing-instructions">Closing Instructions</a>, adapt the following snippet:</p>

<p><code class="language-html highlighter-rouge">So, when a user returns from being routed, and says something like "hi" or "let's keep going", ask them how their experience with the other agent went, and if you can help with any of the pre-existing issues.</code></p>

<p>To preserve the multi-intent functionality of Guided Routing while removing the capabilities of intent disambiguation (clarifying questions), consider changing the language to something specifically related to providing the route (as opposed to asking questions). For example, try something like:</p>

<p><code class="language-html highlighter-rouge">So, when a user returns from being routed, route them to the next route that corresponds with their next intent.</code></p>

<p>If this addition, or any other additions that you’re trying aren’t working, you can also try removing the clause altogether to see if that results in the desired behavior.</p>

<h5 id="general-examples-1">General Examples</h5>

<p>The <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#general-examples">General Examples</a> section is perhaps one of the most intuitive and powerful sections to edit to accomplish your goals. It must be <strong>modified completely</strong> because the existing examples demonstrate the behavior of asking questions.</p>

<p>To invoke the behavior of always generating routes and generating multiple routes upon a multi-intent utterance, you might replace the existing examples with one such as this:</p>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>GENERAL EXAMPLES:
------
ex1:
  User:
      yeah im really stressed, now i need to cancel and get a refund
  Assistant:
      I understand you're feeling stressed. Let's figure out how to alleviate that. It sounds like you have two requests to process, a flight cancelation and a refund. Let's handle those now. [ROUTE::CANCEL_FLIGHT] [ROUTE::REFUND]
------
</code></pre></div></div>

<h3 id="reporting">Reporting</h3>

<p>Being able to measure the success of the Routing AI agent is vital for understanding its performance and the return on your investment.</p>

<p>Use the <strong>Intents</strong> page in <a href="bot-analytics-overview.html">Bot Analytics</a> to gain insight on performance. You can expect to see an increase in the intent match rate.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr40.png" alt="The Intents page in Bot Analytics" /></p>

<h4 id="guided-routing-events">Guided Routing events</h4>

<p>On the <strong>Intents</strong> page, use the <strong>Source</strong> filter in the upper-left corner to narrow down the data in the graph to a specific Guided Routing match type, i.e., class of event.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/gr41.png" alt="The Intents page in Bot Analytics, with a callout to the Source filter" /></p>

<p class="attn-note">The <strong>Source</strong> filter only displays the top 10 match types for the events that have occurred most frequently in the bot.</p>

<p>The following are the Guided Routing match types and the events that are possible for each match type:</p>

<table>
  <thead>
    <tr>
      <th>Match type (class of event)</th>
      <th>Event</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Guided Routing - Route found</td>
      <td>Guided Routing - Route within same LivePerson bot</td>
    </tr>
    <tr>
      <td>Guided Routing - Route found</td>
      <td>Guided Routing - Route to different LivePerson bot</td>
    </tr>
    <tr>
      <td>Guided Routing - Route found</td>
      <td>Guided Routing - Route to third-party bot</td>
    </tr>
    <tr>
      <td>Guided Routing - Route found</td>
      <td>Guided Routing - Route to skill</td>
    </tr>
    <tr>
      <td>Guided Routing - System failure</td>
      <td>Guided Routing - Route to Next Action on Failure</td>
    </tr>
    <tr>
      <td>Guided Routing - No intent match in Silent mode</td>
      <td>Guided Routing - Route to default route</td>
    </tr>
    <tr>
      <td>Guided Routing - No intent match in Silent mode</td>
      <td>Guided Routing - Route to Next Action on Failure</td>
    </tr>
    <tr>
      <td>Guided Routing - Reached disambiguation threshold</td>
      <td>Guided Routing - Route to default route</td>
    </tr>
    <tr>
      <td>Guided Routing - Reached disambiguation threshold</td>
      <td>Guided Routing - Route to Next Action on Failure</td>
    </tr>
  </tbody>
</table>

<p>The first 4 events above are logged as "matched intents."</p>

<h4 id="optimization-opportunities">Optimization opportunities</h4>

<p>If the data indicates that the default route is often used, try to improve the routing experience by refining the route names and descriptions. Or, if necessary, add more routes to handle the unsupported intents.</p>

<p>If the data indicates that the conversation is often directed to the interaction set in the Guided Routing interaction's <strong>Next Action on Failure</strong>, determine whether this is due to a system failure or logical (intent match) failure:</p>

<ul>
  <li><strong>System failures</strong>: LivePerson actively monitors these and takes action.</li>
  <li><strong>Logical failures</strong>: Consider taking action here. Evaluate the existing routes to see if you can optimize them. Are the descriptions right? Do you need to add additional routes for unsupported intents? And if you don't have a default route defined, consider adding one.</li>
</ul>

<h4 id="transfers">Transfers</h4>

<p>Transfers to other LivePerson bots, third-party bots, and skills as a function of Guided Routing are reflected on the <strong>Transfers</strong> page.</p>

<h4 id="messages">Messages</h4>

<p>Messages sent by the Routing AI Agent (including disambiguating questions), are reflected on the <strong>Messages</strong> page.</p>

<h3 id="faqs">FAQs</h3>

<h4 id="what-llm-is-used">What LLM is used?</h4>

<p>To learn which LLM is used by default, open the prompt in the Prompt Library, and check the prompt's <strong>Advanced</strong> settings.</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/gr43.png" alt="The LLM setting on the Advanced tab in a prompt" /></p>

<h4 id="does-the-intent_list-variable-include-the-names-and-descriptions-of-all-defined-routes">Does the {intent_list} variable include the names and descriptions of all defined routes?</h4>

<p>Yes, the names and descriptions of <strong>all</strong> defined routes are sent to the LLM as input.</p>

<p>Keep in mind our <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#best-practices">best practice</a> of striving for 20-25 routes in a Guided Routing interaction, as there is some performance degradation as you exceed this range. 
What’s more, a very large number of routes might exceed the LLM’s <a href="trustworthy-generative-ai-prompt-library-key-terms-concepts.html#tokens">context window</a>. You can mitigate this by stringing multiple Guided Routing interactions together: Create one Guided Routing interaction that has routes that point to other Guided Routing interactions.</p>

<h4 id="when-a-route-is-selected-and-actioned-by-the-llm-does-the-guided-routing-interaction-in-conversation-builder-set-any-metadata-within-the-bots-botcontext">When a route is selected and actioned by the LLM, does the Guided Routing interaction in Conversation Builder set any metadata within the bot’s botContext?</h4>

<p>No, not at this time. Once the bot receives the route, it simply routes the consumer accordingly. There is no opportunity to control the flow programmatically.</p>

<h4 id="im-using-my-own-in-house-llm-can-i-use-it-for-my-routing-ai-agent">I’m using my own, in-house LLM. Can I use it for my Routing AI agent?</h4>

<p>Yes, you can <a href="trustworthy-generative-ai-bring-your-own-llm.html">use your own LLM</a>. Contact your LivePerson representative to request that we set this up.</p>

<h4 id="is-the-guided-routing-interaction-just-for-concierge-bots">Is the Guided Routing interaction just for concierge bots?</h4>

<p>No. It’s true that the Guided Routing interaction makes possible conversational, LLM-powered routing in concierge bots whose primary purpose is to greet the consumer, determine their intent, and route them appropriately.</p>

<p>However, you can also use the interaction in “deeper” spots within any bot’s flow. Wherever you present the consumer with a menu of options—where the consumer’s response directs the bot flow across dialogs or bots—consider using a Guided Routing interaction instead.</p>

<h4 id="can-i-use-multiple-guided-routing-interactions-in-a-single-bot">Can I use multiple Guided Routing interactions in a single bot?</h4>

<p>Yes, you can.</p>

<h4 id="do-i-need-an-intent-model-or-dialog-starters-anymore">Do I need an intent model or dialog starters anymore?</h4>

<p>That depends. There’s no one-size-fits-all answer to this question:</p>

<ul>
  <li>You might have a set of well-trained intents. You have these tied to the dialog starters in the bot, and you want to keep everything in place.</li>
  <li>You might want to reduce the intent model’s coverage to just a few of your most sensitive intents.</li>
  <li>You might want to abandon use of an intent model and dialog starters altogether. This too is a possibility.</li>
</ul>

<p>Explore the adaptive, conversational abilities of the LLM-powered Guided Routing interaction to handle intent identification and routing.</p>

<ul>
  <li>For existing bots, rethink your proposed or in-place architecture, and make changes progressively.</li>
  <li>For new bots, consider foregoing the intent model and NLU. Test whether Guided Routing alone can meet your requirements.</li>
</ul>

<h4 id="how-is-pattern-and-intent-matching-impacted">How is pattern and intent matching impacted?</h4>

<p>It’s not.</p>

<p>In a dialog flow, whenever the bot receives a consumer message, before it does anything else, the bot first checks the message against the patterns and intents in the dialog starters in its other dialogs. And if the current bot is a member of a collaborative bot group, the dialog starters in all participating bots are checked too. If there’s a match somewhere, this triggers the matched dialog, redirecting the conversational flow. This is all standard behavior in Conversation Builder bots, and it isn’t impacted.</p>

<p>A Guided Routing interaction only begins its work when the conversational flow moves to it as the current interaction.</p>

<h4 id="my-solution-uses-bot-groups-are-they-impacted">My solution uses bot groups. Are they impacted?</h4>

<p>No. Bot group behavior isn’t impacted by use of a Routing AI agent.</p>

<p>Additionally, the Routing AI agent can be within a bot group, if desired.</p>

<p>Keep in mind that a <a href="conversation-builder-bots-bot-to-bot-transfers.html">collaborative bot group</a> is more limited in its purpose. Yes, it serves to route the consumer based on the consumer’s query. But it doesn’t have several other major capabilities that a Routing AI agent has, namely, adaptive, conversational guidance; built-in intent disambiugation; and advanced, multi-intent handling.</p>

<h4 id="can-i-incorporate-a-knowledgeai-interaction-in-my-routing-ai-agent">Can I incorporate a KnowledgeAI interaction in my Routing AI agent?</h4>

<p>Yes, you can. Define a route to a dialog that includes a <a href="conversation-builder-interactions-integrations.html#knowledge-ai">KnowledgeAI interaction</a> (in the case of a messaging bot) or an <a href="conversation-builder-interactions-integrations.html#integration">Integration interaction</a> that uses a <a href="conversation-builder-integrations-knowledgeai-integrations.html#knowledgeai-integrations-in-voice-bots">KnowledgeAI integration</a> (in the case of a voice bot).</p>

<p>Be aware that the KnowledgeAI interaction always performs the knowledge base search using the consumer’s <strong>most recent message</strong>. In an intent disambiguation scenario (where dialogue is ongoing), that last message might not be the consumer’s question.</p>

<p>As a best practice, send a message to the consumer to let them know they’re being redirected to handle their question, and elicit the consumer’s question immediately before the KnowledgeAI interaction:</p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/gr32.png" alt="A route that uses a KnowledgeAI interaction as prescribed" /></p>

<p><img class="fancyimage" style="width:650px" src="img/ConvoBuilder/gr33.png" alt="An example conversation, which uses enriched answers, based on the prescribed design" /></p>

<h4 id="whats-the-recommended-way-to-incorporate-the-guided-routing-interaction-into-an-existing-bot">What’s the recommended way to incorporate the Guided Routing interaction into an existing bot?</h4>

<p>Any existing bot likely has a set of well-defined patterns or intents. That’s no problem. You can keep them in place, and use the Guided Routing interaction as a logical fallback to the pattern and intent matching in the bot. With Guided Routing in a supportive role, the intent match rate of the bot is likely to go up!</p>

<p>Explore use of the Guided Routing interaction in one of the bot’s main dialogs as “backup support” for the pattern and intent matching behavior.</p>

<p>Another option is to put the Guided Routing interaction in the Fallback dialog. Perhaps you have a <a href="conversation-builder-interactions-integrations.html#knowledge-ai">KnowledgeAI interaction</a> there that automates answers to FAQs; consider including the Guided Routing interaction after it.</p>

<p>Use in the Fallback dialog is an “if all else fails, use Guided Routing” type of approach. This approach works best if the Guided Routing interaction uses <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#conversational-versus-silent-mode">Conversational mode</a>, but <a href="conversation-builder-generative-ai-routing-ai-agents-route-consumers-conversationally.html#conversational-versus-silent-mode">Silent mode</a> can help too.</p>

<p>Overall, keep in mind that the bot can include a mix of traditional and emerging approaches.</p>

<h4 id="whats-the-difference-between-a-guided-routing-interaction-and-a-dynamic-routing-interaction">What’s the difference between a Guided Routing interaction and a Dynamic Routing interaction?</h4>

<p>These two interactions are similar in that both can offer intelligent routing of the conversation based on the consumer’s intent. However, there are some important differences.</p>

<p>A Routing AI agent that’s powered by a Guided Routing interaction is 100% intent-driven. It routes the consumer solely based on their intent. The bot offers a <em>conversational, adaptive, and guided</em> experience to the consumer, using conversation context and Generative AI to accomplish this. Setting up and training an NLU intent model isn’t required.</p>

<p>In contrast, a bot using Dynamic Routing can route the consumer based on their intent, or based on other rule-based criteria (loyalty tier, age, etc.). The intent-based routing requires an NLU intent model. The routing experience doesn’t include any intent disambiguation; the bot simply routes the consumer based on the available info and rules.</p>

<p>Here’s a detailed breakdown of the key differences:</p>

<table>
  <thead>
    <tr>
      <th>Feature</th>
      <th>Available with Guided Routing?</th>
      <th>Available with Dynamic Routing?</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Route based on consumer intent</td>
      <td>Yes</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>Requires an NLU intent model for intent-based routing</td>
      <td>No</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>Route based on specific rule-based criteria: loyalty tier, age, etc.</td>
      <td>No</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>Route to (bot or agent) skill</td>
      <td>Yes</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>Route to agent</td>
      <td>Yes</td>
      <td>Yes</td>
    </tr>
    <tr>
      <td>Route to Conversation Builder bot</td>
      <td>Yes</td>
      <td>No</td>
    </tr>
    <tr>
      <td>Route to third-party bot</td>
      <td>Yes</td>
      <td>No</td>
    </tr>
    <tr>
      <td>Supports disambiguation of consumer’s intent</td>
      <td>Yes</td>
      <td>No</td>
    </tr>
    <tr>
      <td>Handles multiple intents</td>
      <td>Yes</td>
      <td>No</td>
    </tr>
    <tr>
      <td>Supports a fallback flow</td>
      <td>Yes</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

<h3 id="advanced-development-in-aistudio">Advanced development in aiStudio</h3>

<p>For the vast majority of solutions, you should be able to build and test the Routing AI agent entirely within Conversation Builder.</p>

<p>If you find your solution requires something more advanced, don’t hesitate to contact your LivePerson representative and explain your use case. Advanced customization might be needed within aiStudio, which is our development platform for building, simulating, and evaluating Generative AI technology.</p>

<h3 id="related-articles">Related articles</h3>

<ul>
  <li><a href="trustworthy-generative-ai-prompt-library-overview.html">Prompt Library Overview</a></li>
  <li><a href="https://community.liveperson.com/kb/articles/1501-trustworthy-generative-ai-for-the-enterprise">Trustworthy Generative AI for the Enterprise</a></li>
  <li><a href="trustworthy-generative-ai-bring-your-own-llm.html">Bring Your Own LLM</a></li>
</ul>
]]></description>
      <!-- <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manage the Conversation Context Service</title>
      <link>https://developers.liveperson.com/conversation-builder-scripting-functions-manage-the-conversation-context-service.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-scripting-functions-manage-the-conversation-context-service.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction-to-the-ccs">Introduction to the CCS</h3>

<p>The <a href="conversation-orchestrator-conversation-context-service-overview.html">Conversation Context Service</a> (CCS) is a cloud-based repository for storing and retrieving session state attributes, so they can be used throughout the conversational journey. This allows for continuity in conversations as context can be transferred between agents and bots, enabling a warm hand-off. The attributes are stored as key/value pairs.</p>

<p>Within the CCS, you can have multiple namespaces for different business use cases. Typically, a namespace groups together related attributes. Namespaces are per account.</p>

<p>In Conversation Builder, there are many functions for managing data in the CCS; these are discussed in this article. The functions are synchronous, server-side, JavaScript calls that conveniently wrap the APIs in Conversation Orchestrator, LivePerson's AI engine.</p>

<p class="attn-note">All update operations return a Boolean status. It is the bot developer's responsibility to ensure the operation was executed successfully.</p>

<h3 id="data-scopes">Data scopes</h3>

<p>The Conversation Builder functions for managing data in the CCS allow you to set data in the following scopes within a namespace:</p>

<ul>
  <li><strong>Entity</strong>: Data set in this scope is available to the bot in any conversation (as long as you provide the entity ID).</li>
  <li><strong>Conversation</strong>: Data set in this scope is only available to the bot in the current conversation.</li>
  <li><strong>User</strong>: Data set in this scope is available to the bot in any conversation that includes the user.</li>
  <li><strong>Global</strong>: Data set in this scope is available to the bot in any conversation. Use the globally-scoped functions only to manage data that is truly global: the data is consistent across every user and every conversation, such as your store's operating hours. <strong>Don’t</strong> use these functions to aggregate data from many different users or conversations; the functions are not designed for that purpose.</li>
</ul>

<h3 id="important-info-for-hybrid-solutions">Important info for hybrid solutions</h3>

<p>If you're using <strong>both</strong> the Conversation Builder scripting functions discussed in this article <strong>and</strong> direct use of the CCS APIs, be aware that the Conversation Builder functions invoke the CCS v2 APIs <em>indirectly</em>. That is, they invokes the v1 APIs, which forward the requests to the v2 APIs. In such cases, when no session is provided, a session named <code class="language-html highlighter-rouge">__default__</code> is defined and forwarded to the v2 APIs.</p>

<p>If you're managing the CCS via only the Conversation Builder scripting functions, the above info isn't relevant. But in a hybrid solution, it's important to know.</p>

<p><a href="conversation-orchestrator-conversation-context-service-overview.html#api-versions">Learn about the v2 APIs.</a></p>

<h3 id="get-started---set-up-the-ccs">Get started - Set up the CCS</h3>

<p>To enable the Conversation Context Service API for your account:</p>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access the Bot Accounts application</a>, and click the organization name.</li>
  <li>Turn on the <strong>Conversation Context Service</strong> toggle.</li>
  <li>Do the following:
    <ul>
      <li><strong>Use Conversational Cloud Site ID</strong>: Always select this. Then enter your site ID (account ID).</li>
      <li><strong>Use Conversation Builder Account ID</strong>: Don't select this. This option will be removed in the future.</li>
    </ul>
  </li>
</ol>

<h3 id="check-if-the-context-api-is-enabled">Check if the Context API is enabled</h3>

<p>The <code class="language-html highlighter-rouge">isContextApiEnabled</code> method checks whether the Context API is enabled.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">isContextApiEnabled()</code></td>
      <td>none</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<h4 id="example">Example</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">isContextApiEnabled</span><span class="p">();</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">context API enabled: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="register-a-namespace">Register a namespace</h3>

<p>The <code class="language-html highlighter-rouge">registerContextNamespace</code> method creates a custom namespace.</p>

<p class="attn-note">If the namespace already exists, the method reuses it rather than creating a duplicate. While you only need to call it once per namespace, multiple calls are safe and will not result in redundant records.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">registerContextNamespace(namespace)</code></td>
      <td>namespace (string) — The name of the namespace</td>
      <td>Boolean</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">registerContextNamespace(namespace, ttl)</code></td>
      <td>namespace (string) — The name of the namespace<br /><br />ttl (long) — "Time to live," i.e., how long in seconds that the properties in the namespace are available (3 hours = 10,800 seconds, 1 day = 86,400 seconds, 1 week = 604,800 seconds, etc.). LivePerson recommends you use a <code class="language-html highlighter-rouge">ttl</code> of 13 months so that properties don’t persist forever. The namespace still exists after the <code class="language-html highlighter-rouge">ttl</code> expires. If you set the <code class="language-html highlighter-rouge">ttl</code> and subsequently change it, the new <code class="language-html highlighter-rouge">ttl</code> only applies to properties added to the namespace after the change; existing properties remain unaffected.</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<h5 id="example-1">Example</h5>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">registerContextNamespace</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">,</span> <span class="mi">10800</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">Register Namespace: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="delete-a-namespace">Delete a namespace</h3>

<p>The <code class="language-html highlighter-rouge">deleteContextNamespace</code> method deletes a custom namespace.</p>

<p class="attn-note">It is not mandatory to delete a previously registered namespace.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">deleteContextNamespace(namespace)</code></td>
      <td>namespace (string) — The name of the namespace</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<h5 id="example-2">Example</h5>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">deleteContextNamespace</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">Delete Namespace: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="managing-data-by-entity---an-overview">Managing data by entity - an overview</h3>

<p>Conversation Builder offers several scripting functions that have the flexibility to store, retrieve, and delete contextual data from the CCS using any unique identifier that’s meaningful and relevant to your brand. These functions include:</p>

<ul>
  <li><code class="language-html highlighter-rouge">setContextDataForEntity(namespace, entityId, name, value)</code></li>
  <li><code class="language-html highlighter-rouge">setContextDataForEntity(namespace, entityId, properties)</code></li>
  <li><code class="language-html highlighter-rouge">getContextDataForEntity(namespace, entityId, name)</code></li>
  <li><code class="language-html highlighter-rouge">getContextDataForEntity(namespace, entityId)</code></li>
  <li><code class="language-html highlighter-rouge">deleteContextDataForEntity(namespace, entityId, name)</code></li>
</ul>

<p>These functions aggregate and manage data at the <strong>entity</strong> level, which is highly flexible and customizable. All of the other functions discussed elsewhere in this article manage data in the CCS at the <strong>conversation</strong>, <strong>user</strong>, or <strong>global</strong> level. <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">Learn about data scopes.</a></p>

<h4 id="understanding-entities">Understanding entities</h4>

<p>What’s an entity? An <strong>entity</strong> is something that exists as a single, distinct, and uniquely identifiable unit about which information is stored and managed.</p>

<p>The primary use case is <strong>the consumer</strong> about whom you want to store consumer-specific information like account balance, preference settings, loyalty status, and more. Here you can use <strong>your own brand’s internal consumer ID</strong> as the unique identifier (<code class="language-html highlighter-rouge">entityId</code>).</p>

<p>But entities can also be other things, such as a product or SKU, an order, a shipment, a store or location, a device or equipment, a campaign, a ticket, etc.</p>

<h4 id="issues-with-other-approaches">Issues with other approaches</h4>

<p>Historically, to store consumer context, brands used the <code class="language-html highlighter-rouge">setContextDataForUser</code> function (see "Set data by user"), which relies on the user ID that’s generated by Conversational Cloud as the unique identifier. But many brands found it more useful to rely on their own internal user IDs, so they used <code class="language-html highlighter-rouge">setGlobalContextData</code> instead (see "Set global data"), aggregating the data using the globally scoped functions. Not only were these approaches less desirable, the latter in particular yielded very large documents under the hood, opening up performance and manageability issues.</p>

<p>A better solution for storing consumer context is to use the <code class="language-html highlighter-rouge">setContextDataForEntity</code> functions (see "Set data by entity"). They allow you to <strong>segregate data</strong> using your own brand's internal unique identifiers, which avoids the previous performance and manageability problems.</p>

<h4 id="data-persistence">Data persistence</h4>

<p>When storing data using the <code class="language-html highlighter-rouge">setContextDataForEntity</code> functions, the properties are persisted for as long as the Time-to-Live (TTL) for the provided namespace.</p>

<p class="attn-note">Use appropriate TTL values, which renders manual deletion unnecessary. That said, we offer an entity-based delete method too.</p>

<h3 id="set-data-by-entity">Set data by entity</h3>

<p>Use <code class="language-html highlighter-rouge">setContextDataForEntity</code> to store context data for a given entity. The data is stored in <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">Entity scope</a>.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">setContextDataForEntity(namespace, entityId, name, value)</code></td>
      <td>Stores a specific property for a given entity in a namespace.</td>
      <td><em>namespace</em> - Required. A string. The name of the namespace.<br /><br /><em>entityId</em> - Required. A string. A flexible, unique identifier (up to 50 characters) that you can define for the entity, e.g., the consumer.<br /><br /><em>name</em> - Required. A string. The name of the property.<br /><br /><em>value</em> - Required. A JSON object. The value of the property.</td>
      <td>Boolean</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">setContextDataForEntity(namespace, entityId, properties)</code></td>
      <td>Stores a set of properties for a given entity in a namespace.</td>
      <td><em>namespace</em> - Required. See above.<br /><br /><em>entityId</em> - Required. See above.<br /><br /><em>properties</em> - Required. The list of properties to store. A stringified JSON object.</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<h4 id="example-3">Example</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">data</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">{ </span><span class="se">\"</span><span class="s2">property1</span><span class="se">\"</span><span class="s2">: </span><span class="se">\"</span><span class="s2">value1</span><span class="se">\"</span><span class="s2">, </span><span class="se">\"</span><span class="s2">property2</span><span class="se">\"</span><span class="s2">: </span><span class="se">\"</span><span class="s2">value2</span><span class="se">\"</span><span class="s2">, </span><span class="se">\"</span><span class="s2">property3</span><span class="se">\"</span><span class="s2">: </span><span class="se">\"</span><span class="s2">value3</span><span class="se">\"</span><span class="s2">, </span><span class="se">\"</span><span class="s2">property4</span><span class="se">\"</span><span class="s2">: </span><span class="se">\"</span><span class="s2">value4</span><span class="se">\"</span><span class="s2"> }</span><span class="dl">"</span><span class="p">;</span>

<span class="nx">setting</span> <span class="nx">batch</span> <span class="nx">properties</span> <span class="k">for</span> <span class="nx">an</span> <span class="nx">entity</span> 
<span class="kd">var</span> <span class="nx">result</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">setContextDataForEntity</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineNamespace</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">testEntity</span><span class="dl">"</span><span class="p">,</span> <span class="nx">data</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="nx">result</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">Successfully inserted batch property</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">not inserted batch property</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span>

<span class="c1">// setting name,value pair for and entity</span>
<span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">setContextDataForEntity</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">testEntity</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">intentThreshold</span><span class="dl">"</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">set context data for Entity: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="set-data-by-conversation">Set data by conversation</h3>

<p>Use <code class="language-html highlighter-rouge">setContextDataForConversation</code> to store data in the Conversation Context Service in <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">Conversation scope</a>.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">setContextDataForConversation(namespace, property, value)</code></td>
      <td>Stores a specific property in a namespace</td>
      <td>namespace (string), property (string), value (object)</td>
      <td>Boolean</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">setContextDataForConversation(namespace, properties)</code></td>
      <td>Stores a set of properties in a namespace</td>
      <td>Namespace (String), properties (String)</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<p class="attn-note">The <code class="language-html highlighter-rouge">properties</code> parameter is a string. If you’re working with a JSON object, before passing it in, convert it to a JSON string using <code class="language-html highlighter-rouge">JSON.stringify</code>.</p>

<h4 id="example---set-a-single-property">Example - set a single property</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">setContextDataForConversation</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">intentThreshold</span><span class="dl">"</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">set context data for conversation scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<h4 id="example-1---set-multiple-properties">Example 1 - set multiple properties</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">data</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">{ </span><span class="se">\"</span><span class="s2">property1</span><span class="se">\"</span><span class="s2">: </span><span class="se">\"</span><span class="s2">value1</span><span class="se">\"</span><span class="s2">, </span><span class="se">\"</span><span class="s2">property2</span><span class="se">\"</span><span class="s2">: </span><span class="se">\"</span><span class="s2">value2</span><span class="se">\"</span><span class="s2">, </span><span class="se">\"</span><span class="s2">property3</span><span class="se">\"</span><span class="s2">: </span><span class="se">\"</span><span class="s2">value3</span><span class="se">\"</span><span class="s2">, </span><span class="se">\"</span><span class="s2">property4</span><span class="se">\"</span><span class="s2">: </span><span class="se">\"</span><span class="s2">value4</span><span class="se">\"</span><span class="s2"> }</span><span class="dl">"</span><span class="p">;</span>

<span class="kd">var</span> <span class="nx">result</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">setContextDataForConversation</span><span class="p">(</span><span class="dl">"</span><span class="s2">testNamespace</span><span class="dl">"</span><span class="p">,</span> <span class="nx">data</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="nx">result</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">Successfully inserted batch property</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">not inserted batch property</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<h4 id="example-2---set-multiple-properties">Example 2 - set multiple properties</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">batchInsert</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">setContextDataForConversation</span><span class="p">(</span><span class="dl">"</span><span class="s2">testNamespace</span><span class="dl">"</span><span class="p">,</span> <span class="dl">'</span><span class="s1">{ "property1" : "value1", "property2" : "value2", "property3" : "value3", "property4" : "value4"}</span><span class="dl">'</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="nx">batchInsert</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">Successfully inserted batch property</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">not inserted batch property</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<h4 id="example-3---set-multiple-properties">Example 3 - set multiple properties</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">object</span> <span class="o">=</span> <span class="p">{</span>
<span class="dl">"</span><span class="s2">prop1</span><span class="dl">"</span> <span class="p">:</span> <span class="dl">"</span><span class="s2">value1</span><span class="dl">"</span><span class="p">,</span>
<span class="dl">"</span><span class="s2">prop2</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">value2</span><span class="dl">"</span>
<span class="p">};</span>
<span class="kd">var</span> <span class="nx">batchInsert</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">setContextDataForConversation</span><span class="p">(</span><span class="dl">"</span><span class="s2">testNamespace</span><span class="dl">"</span><span class="p">,</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">object</span><span class="p">));</span>
<span class="k">if</span><span class="p">(</span><span class="nx">batchInsert</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">Successfully inserted batch property</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">not inserted batch property</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<h3 id="set-data-by-user">Set data by user</h3>

<p>Use <code class="language-html highlighter-rouge">setContextDataForUser</code> to store data in the Conversation Context Service in <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">User scope</a>.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">setContextDataForUser(namespace, property, value)</code></td>
      <td>Stores a specific property in a namespace</td>
      <td>namespace (string), property (string), value (object)</td>
      <td>Boolean</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">setContextDataForUser(namespace, properties)</code></td>
      <td>Stores a set of properties in a namespace</td>
      <td>Namespace (String), properties (String)</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<p class="attn-note">The <code class="language-html highlighter-rouge">properties</code> parameter is a string. If you’re working with a JSON object, before passing it in, convert it to a JSON string using <code class="language-html highlighter-rouge">JSON.stringify</code>.</p>

<h4 id="example-4">Example</h4>

<p>See the examples of <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#example---set-a-single-property">setContextDataForConversation</a>; they are similar.</p>

<h3 id="set-global-data">Set global data</h3>

<p>Use <code class="language-html highlighter-rouge">setGlobalContextData</code> to store data in the Conversation Context Service in <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">Global scope</a>.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">setGlobalContextData(namespace, property, value)</code></td>
      <td>Stores a specific property in a namespace</td>
      <td>namespace (string), property (string), value (object)</td>
      <td>Boolean</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">setGlobalContextData(namespace, properties)</code></td>
      <td>Stores a set of properties in a namespace</td>
      <td>Namespace (String), properties (String)</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<p class="attn-note">The <code class="language-html highlighter-rouge">properties</code> parameter is a string. If you’re working with a JSON object, before passing it in, convert it to a JSON string using <code class="language-html highlighter-rouge">JSON.stringify</code>.</p>

<h4 id="example-5">Example</h4>

<p>See the examples of <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#example---set-a-single-property">setContextDataForConversation</a>; they are similar.</p>

<h3 id="legacy-approach-for-updating-multiple-variables">Legacy approach for updating multiple variables</h3>

<p>There’s also an older, legacy approach to updating multiple variables in the CCS at once: You can use the function for setting a <strong>single</strong> variable, which has a method signature that specifies <strong>three</strong> input parameters (not two). Essentially, you make a single API call submitting an object of key/value pairs as the <strong>third</strong> parameter. Here’s an example of the pre-process code:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">batchInsert</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">setContextDataForConversation</span><span class="p">(</span><span class="dl">"</span><span class="s2">testNamespace</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">batchInsert</span><span class="dl">"</span><span class="p">,</span> <span class="p">{</span>
  <span class="na">property1</span> <span class="p">:</span> <span class="dl">"</span><span class="s2">value1</span><span class="dl">"</span><span class="p">,</span>
  <span class="na">property2</span> <span class="p">:</span> <span class="dl">"</span><span class="s2">value2</span><span class="dl">"</span><span class="p">,</span>
  <span class="na">property3</span> <span class="p">:</span> <span class="dl">"</span><span class="s2">value3</span><span class="dl">"</span><span class="p">,</span>
  <span class="na">property4</span> <span class="p">:</span> <span class="dl">"</span><span class="s2">value4</span><span class="dl">"</span>
<span class="p">});</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">batchInsert</span><span class="p">)</span> <span class="p">{</span>
   <span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">Successfully inserted batch property</span><span class="dl">"</span><span class="p">);</span>
 <span class="p">}</span><span class="k">else</span><span class="p">{</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">Failed inserting batch property</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<p>In turn, the post-process code for our example might look like this:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">getBatchData</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getContextDataForConversation</span><span class="p">(</span><span class="dl">"</span><span class="s2">testNamespace</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">batchInsert</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">GET: Context Data: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">getBatchData</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">GET: Specific Context value: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">getBatchData</span><span class="p">.</span><span class="nx">property1</span><span class="p">);</span>
</code></pre></div></div>

<p>And the data from Bot Logs would look like this:</p>

<p><code class="language-html highlighter-rouge">Botcontext - debug message from interaction: COLLECT_PHONE_NUMBER, javascript code: POST_PROCESS, message:GET: Context Data: {property1=value1, property2=value2, property3=value3, property4=value4}</code></p>

<p><code class="language-html highlighter-rouge">Botcontext - debug message from interaction: COLLECT_PHONE_NUMBER, javascript code: POST_PROCESS, message:GET: specific value: value1</code></p>

<h5 id="to-migrate-or-not-to-migrate-from-the-legacy-approach">To migrate or not to migrate from the legacy approach</h5>

<p>If you’re not already using the legacy approach, don’t adopt it. Use the functions discussed farther above because they are specifically designed and intended for updating multiple properties at once.</p>

<p>If you’re already using the legacy approach, we recommend that you migrate to the functions discussed farther above <strong>only if</strong> your implementation makes multiple API calls to update batches of properties. But, if your implementation only makes just a single API call (with a single set of keys), the effort to migrate to the newer functions isn’t worth the investment of time and testing.</p>

<h3 id="get-data-by-entity">Get data by entity</h3>

<p>Use <code class="language-html highlighter-rouge">getContextDataForEntity</code> to retrieve context data for a given entity.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">getContextDataForEntity(namespace, entityId, name)</code></td>
      <td>Gets a specific property for a given entity in a namespace.</td>
      <td><em>namespace</em> - Required. A string. The name of the namespace.<br /><br /><em>entityId</em> - Required. A string. The unique identifier for the entity, e.g., the consumer.<br /><br /><em>name</em> - Required. A string. The name of the property for which to retrieve the value.</td>
      <td>An Object that represents a single value: a String, a number, a Boolean, or even another Object.</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">getContextDataForEntity(namespace, entityId)</code></td>
      <td>Gets a set of properties for a given entity in a namespace.</td>
      <td><em>namespace</em> - Required. A string. The name of the namespace.<br /><br /><em>entityId</em> - Required. A string. The unique identifier for the entity, e.g., the consumer, for which to retrieve all property values.</td>
      <td>A Map that represents the collection of properties for the entity. In each key-value pair, the key is a String; the value is an Object that represents a single value: a String, a number, a Boolean, or even another Object.</td>
    </tr>
  </tbody>
</table>

<h4 id="example-6">Example</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">//get batch data for an entity</span>
<span class="kd">var</span> <span class="nx">getBatchData</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getContextDataForEntity</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineNamespace</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">testEntity</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">GET: Context Data: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">getBatchData</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">GET: Specific Context value: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">getBatchData</span><span class="p">.</span><span class="nx">property1</span><span class="p">);</span>

<span class="c1">// get a variable from entity</span>
<span class="kd">var</span> <span class="nx">value</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getContextDataForEntity</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">intentThreshold</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">testEntity</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">get context data for entity: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">value</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="get-data-by-conversation">Get data by conversation</h3>

<p>Use <code class="language-html highlighter-rouge">getContextDataForConversation</code> to get data from the Conversation Context Service in <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">Conversation scope</a>.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">getContextDataForConversation(namespace, property)</code></td>
      <td>Retrieves a specific property from a namespace</td>
      <td>namespace (string), property (string)</td>
      <td>Object</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">getContextDataForConversation(namespace)</code></td>
      <td>Retrieves all of the properties from a namespace</td>
      <td>namespace (string)</td>
      <td>Object</td>
    </tr>
  </tbody>
</table>

<p><code class="language-html highlighter-rouge">getContextDataForConversation(namespace)</code> returns a <code class="language-html highlighter-rouge">java.util.HashMap</code>. To retrieve a specific property, use the <code class="language-html highlighter-rouge">keySet</code> method on the returned object, like is done in the following:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">function</span> <span class="nx">displayAllVars</span><span class="p">(</span><span class="nx">map</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">var</span> <span class="nx">stringOfMap</span> <span class="o">=</span> <span class="nx">map</span><span class="p">.</span><span class="nx">toString</span><span class="p">();</span>

  <span class="k">for</span> <span class="nx">each</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="k">in</span> <span class="nx">map</span><span class="p">.</span><span class="nx">keySet</span><span class="p">())</span> <span class="p">{</span>

       <span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Key → </span><span class="dl">'</span> <span class="o">+</span> <span class="nx">i</span><span class="p">);</span>
       <span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Value → </span><span class="dl">'</span> <span class="o">+</span> <span class="nx">map</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
  <span class="p">}</span>
<span class="p">}</span>
</code></pre></div></div>

<h4 id="examples">Examples</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">value</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getContextDataForConversation</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">intentThreshold</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">get context data for conversation scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">value</span><span class="p">);</span>
</code></pre></div></div>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">valuesMap</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getContextDataForConversation</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">get context data for conversation scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">valuesMap</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="get-data-by-user">Get data by user</h3>

<p>Use <code class="language-html highlighter-rouge">getContextDataForUser</code> to get data from the Conversation Context Service in <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">User scope</a>.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">getContextDataForUser(namespace, property)</code></td>
      <td>Retrieves a specific property from a namespace</td>
      <td>namespace (string), property (string)</td>
      <td>Object</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">getContextDataForUser(namespace)</code></td>
      <td>Retrieves all of the properties from a namespace</td>
      <td>namespace (string)</td>
      <td>Object</td>
    </tr>
  </tbody>
</table>

<p><code class="language-html highlighter-rouge">getContextDataForUser(namespace)</code> returns a <code class="language-html highlighter-rouge">java.util.HashMap</code>. To retrieve a specific property, use the <code class="language-html highlighter-rouge">keySet</code> method on the returned object, like is done in the following:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">function</span> <span class="nx">displayAllVars</span><span class="p">(</span><span class="nx">map</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">var</span> <span class="nx">stringOfMap</span> <span class="o">=</span> <span class="nx">map</span><span class="p">.</span><span class="nx">toString</span><span class="p">();</span>

  <span class="k">for</span> <span class="nx">each</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="k">in</span> <span class="nx">map</span><span class="p">.</span><span class="nx">keySet</span><span class="p">())</span> <span class="p">{</span>

       <span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Key → </span><span class="dl">'</span> <span class="o">+</span> <span class="nx">i</span><span class="p">);</span>
       <span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Value → </span><span class="dl">'</span> <span class="o">+</span> <span class="nx">map</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
  <span class="p">}</span>
<span class="p">}</span>
</code></pre></div></div>

<h4 id="examples-1">Examples</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">value</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getContextDataForUser</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">intentThreshold</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">get context data for user scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">value</span><span class="p">);</span>
</code></pre></div></div>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">valuesMap</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getContextDataForUser</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">get context data for user scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">valuesMap</span><span class="p">);</span>

</code></pre></div></div>

<h3 id="get-global-data">Get global data</h3>

<p>Use <code class="language-html highlighter-rouge">getGlobalContextData</code> to get a specific property in <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">Global scope</a> from the Conversation Context Service.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">getGlobalContextData(namespace, property)</code></td>
      <td>Retrieves a specific property from a namespace</td>
      <td>namespace (string), property (string)</td>
      <td>Object</td>
    </tr>
  </tbody>
</table>

<h4 id="example-7">Example</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">value</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getGlobalContextData</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">intentThreshold</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">get context data for global scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">value</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="delete-data-by-entity">Delete data by entity</h3>

<p>Use <code class="language-html highlighter-rouge">deleteContextDataForEntity</code> to delete context data for a given entity.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">deleteContextDataForEntity(namespace, entityId, name)</code></td>
      <td>Deletes a specific property for a given entity in a namespace.</td>
      <td><em>namespace</em> - Required. A string. The name of the namespace.<br /><br /><em>entityId</em> - Required. A string. The unique identifier for the entity, for example, the consumer.<br /><br /><em>name</em> - Required. A string. The name of the property to delete.</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<h4 id="example-8">Example</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">deleteContextDataForEntity</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineNamespace</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">testEntity</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">intentThreshold</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">delete context data for entity : </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="delete-data-by-conversation">Delete data by conversation</h3>

<p>Use <code class="language-html highlighter-rouge">deleteContextDataForConversation</code> to delete data from the Conversation Context Service that is stored in <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">Conversation scope</a>.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">deleteContextDataForConversation(namespace, property)</code></td>
      <td>Deletes a specific property from a namespace</td>
      <td>namespace (string), property (string)</td>
      <td>Boolean</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">deleteAllContextDataForConversation(namespace)</code></td>
      <td>Deletes all properties from a namespace</td>
      <td>namespace (string)</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<h4 id="examples-2">Examples</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">deleteContextDataForConversation</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">intentThreshold</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">delete context data for user scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">deleteAllContextDataForConversation</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">delete all context data for conversation scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="delete-data-by-user">Delete data by user</h3>

<p>Use <code class="language-html highlighter-rouge">deleteContextDataForUser</code> to delete data from the Conversation Context Service that is stored in <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">User scope</a>.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">deleteContextDataForUser(namespace, property)</code></td>
      <td>Delete a specific property from a namespace</td>
      <td>namespace (string), property (string)</td>
      <td>Boolean</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">deleteAllContextDataForUser(namespace)</code></td>
      <td>Delete all properties from a namespace</td>
      <td>namespace (string)</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<h4 id="example-9">Example</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">deleteContextDataForUser</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">intentThreshold</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">delete context data for user scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">deleteAllContextDataForUser</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">delete all context data for user scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="delete-global-data">Delete global data</h3>

<p>Use <code class="language-html highlighter-rouge">deleteGlobalContextData</code> to delete a specific property from the Conversation Context Service that is stored in <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#data-scopes">Global scope</a>.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Description</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">deleteGlobalContextData(namespace, property)</code></td>
      <td>Deletes a specific property from a namespace</td>
      <td>namespace (string), property (string)</td>
      <td>Boolean</td>
    </tr>
  </tbody>
</table>

<h4 id="examples-3">Examples</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">success</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">deleteGlobalContextData</span><span class="p">(</span><span class="dl">"</span><span class="s2">airlineTicketingBot</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">intentThreshold</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">delete context data for user scope: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">success</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="related-articles">Related articles</h3>

<ul>
  <li>For a more in-depth introducton to the Conversation Context Service and details on the Conversation Orchestrator API, see <a href="conversation-orchestrator-conversation-context-service-overview.html">Conversation Context Service</a>.</li>
  <li>New to Conversation Builder scripting functions in general? Review the <a href="conversation-builder-scripting-functions-introduction.html">introduction to scripting functions</a>.</li>
</ul>
]]></description>
      <!-- <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>KnowledgeAI Integrations</title>
      <link>https://developers.liveperson.com/conversation-builder-integrations-knowledgeai-integrations.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-integrations-knowledgeai-integrations.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>A KnowledgeAI™ integration searches a knowledge base for articles, i.e., answers to send to consumers.</p>

<p>One use case for this type of integration is within a <a href="conversation-builder-dialogs-fallback-dialogs.html">fallback dialog</a>, to funnel consumer utterances into a knowledge base search. If an appropriate search result is found, it can be displayed. If no results are found, you might then display a "sorry" message or transfer the conversation to a human agent.</p>

<p class="attn-note">The <a href="conversation-builder-templates-simple-faq.html">Simple FAQ bot template</a> provides a bot that answers a user's questions by connecting to a knowledge base.</p>

<h3 id="when-to-use-this-integration">When to use this integration</h3>

<p>To automate answers in a <a href="conversation-builder-bots-voice-bots.html">Voice bot</a>, use this type of integration (within an Integration interaction). See our example in the next section.</p>

<p>However, to automate answers in a <a href="conversation-builder-bots-messaging-bots.html">Messaging bot</a>, this type of integration is considered a <em>legacy</em> approach. We recommend the <a href="conversation-builder-interactions-integrations.html#knowledge-ai-interactions">Knowledge AI interaction</a> instead. It's simpler and more powerful in a Messaging context.</p>

<p class="attn-note">Using this integration to automate enriched answers created via Generative AI? <a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html#configure-the-knowledgeai-integration">See this discussion.</a></p>

<h3 id="search-flow">Search flow</h3>

<p><a href="#search-flowknowledgeai-key-terms-concepts-search-methods.html#search-flow">Learn about the search flow.</a></p>

<h3 id="knowledgeai-integrations-in-voice-bots">KnowledgeAI integrations in Voice bots</h3>

<p>Here’s a common approach to answering questions in a <a href="conversation-builder-bots-voice-bots.html">Voice bot</a>:</p>

<p><img style="width:800px" src="img/ConvoBuilder/voicebot_kai_integration.png" alt="An example of using an Integration interaction in a bot, where that interaction searches a specified knowledge base. After the Integration interaction, there's a Speech question that plays the answer and then either performs another search if the consumer says something, or transfers the call to an agent if the consumer says a word like help or agent" /></p>

<p>Learn more about these settings on the <a href="conversation-builder-interactions-integrations.html#integration">Integration interaction</a>:</p>

<ul>
  <li><a href="knowledgeai-key-terms-concepts-user-queries-contextualize.html">Enhance (rephrase) user's query using conversation context (LivePerson SLM)</a></li>
  <li><a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Enrich answers via Generative AI</a></li>
</ul>

<h3 id="add-a-knowledgeai-integration">Add a KnowledgeAI integration</h3>

<ol>
  <li>Open the bot, and click <strong>Integrations</strong> in the upper-left corner.</li>
  <li>Configure the integration settings (required fields are marked with asterisks):
    <ul>
      <li><strong>Integration Name</strong>: Enter the name of integration. Enter a name that's meaningful (it describes well the integration's purpose), concise, and follows a consistent pattern. This helps with organization, and it makes it easier for bot developers to work with the integration during bot development.</li>
      <li><strong>Response Data Variable Name</strong>: Enter the name of the variable that gets populated with the response from the API.</li>
      <li><strong>Integration Type</strong>: Select <strong>KnowledgeAI</strong>.</li>
      <li>
        <p><strong>Knowledge Base</strong>: Select the knowledge bases to search. You can select anywhere from one to five.</p>

        <p>The first knowledge base that you select filters the list of remaining ones you can choose from: All of the knowledge bases must belong to the same language group. For example, UK English and US English are fine together. Behind the scenes, the system validates the first two characters of the ISO language code.</p>

        <p>What's more, you can select a mix of <a href="knowledgeai-internal-knowledge-bases-introduction.html">internal knowledge bases</a> and <a href="knowledgeai-legacy-features-external-kbs-with-liveperson-ai.html">external knowledge bases that use LivePerson AI</a>. But you can’t mix <a href="knowledgeai-external-knowledge-bases-external-kbs-without-liveperson-ai.html">external knowledge bases that don’t use LivePerson AI</a> with any other type.</p>
      </li>
      <li><strong>Method</strong>: This is always "Phrase Search," which means the search is performed using the phrase that's defined in the request parameter.</li>
      <li><strong>Request Parameters</strong>:
        <ul>
          <li><em>mode</em>: Select from the following <a href="knowledgeai-key-terms-concepts-search-methods.html">search methods</a>: KnowledgeAI (recommended), Intent match only, or AI search only. In Production, we recommend that you use the “KnowledgeAI” offering. The “Intent match only” and “AI search only” options are primarily intended for testing and for diagnosing issues during troubleshooting. This field isn't shown if you've selected an <a href="knowledgeai-external-knowledge-bases-external-kbs-without-liveperson-ai.html">external knowledge base that doesn't use LivePerson AI</a>.</li>
          <li><em>threshold</em>: Select the <a href="knowledgeai-key-terms-concepts-search-methods.html#thresholds">threshold</a> (minimum score) that a result must have in order to be returned, either VERY GOOD, GOOD, or FAIR PLUS. This field isn't shown if you've selected an <a href="knowledgeai-external-knowledge-bases-external-kbs-without-liveperson-ai.html">external knowledge base that doesn't use LivePerson AI</a>.</li>
          <li><em>phrase</em>: Enter the phrase for which to search. The default value is <a href="conversation-builder-variables-slots-variables.html#store-the-consumers-response">{$query}</a>, which represents/stores the last, complete response sent by the consumer.</li>
          <li><em>multipleResults</em>: Select the number of matched articles to retrieve from the knowledge base, anywhere from one to five. The default value is 1. (The number of results that are ultimately sent to the consumer depends on how you implement the dialog in the bot, i.e., the interactions that send the answers.)</li>
        </ul>
      </li>
      <li><strong>Transform Result Script</strong>: If applicable, use this section to write JavaScript code that transforms the raw result (typically in JSON format), so you can use the information in the bot's dialog. For more on this, see <a href="conversation-builder-integrations-integration-basics.html#transform-an-api-result">Transform an API result</a>.</li>
      <li><strong>Custom Data Fields</strong>: Add <a href="conversation-builder-integrations-integration-basics.html#process-api-results-with-custom-data-fields">the fields</a> that will store the result data in key/value pairs. Users who are tasked with creating bots can use and display this data in interactions by referencing these fields.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="best-practices">Best practices</h3>

<p>When integrating answers from KnowledgeAI into a bot, carefully consider where in the bot flow it’s best to do this. You want the consumer’s utterance to be answered by the right, topically relevant knowledge base, at the right time. For example, in a bot that can handle billing tasks and questions, plug in a “Billing questions” knowledge base. This kind of contextual approach is more focused, so it generally yields a high answer rate.</p>

<p>In contrast, strategies that are less targeted can yield a lower answer rate. For example, plugging a <em>general purpose</em> knowledge base into the Fallback dialog is an option, but it could yield a low answer rate.</p>
]]></description>
      <!-- <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>KnowledgeAI Agents - Automate Enriched Answers</title>
      <link>https://developers.liveperson.com/conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note">Not ready to make use of Generative AI and LLMs? No problem. You don't need to incorporate these technologies into your solution. <a href="conversation-builder-interactions-integrations.html#knowledge-ai">Learn how to automate answers without Generative AI.</a></p>

<h3 id="whats-a-knowledgeai-agent">What's a KnowledgeAI agent?</h3>

<p>If you’re using LivePerson Conversation Builder bots to automate answers to consumers, you can send answers that are enriched by KnowledgeAI™'s LLM-powered answer enrichment service. We call bots like these <strong>KnowledgeAI agents</strong>. The resulting answers, formulated via Generative AI, are:</p>

<ul>
  <li>Grounded in knowledge base content</li>
  <li>Contextually aware</li>
  <li>Natural-sounding</li>
</ul>

<p><img class="fancyimage" style="width:450px" src="img/ConvoBuilder/genai_botexample2.png" alt="An example of helpful and warm answer from a bot" /></p>

<h4 id="key-benefits">Key benefits</h4>

<ul>
  <li><strong>Maximize your existing content investments</strong> by seamlessly integrating your existing knowledge bases, systems, and documents to answer frequently asked questions with a robust retrieval-augmented generation system.</li>
  <li><strong>Boost customer satisfaction</strong> by utilizing your brand’s knowledge to enable natural, context-aware interactions for a seamless customer experience.</li>
  <li><strong>Ensure safety</strong> by reducing hallucinations with our proprietary <a href="trustworthy-generative-ai-llm-gateway.html#hallucination-detection-post-processing">Hallucination Detection model</a>, ensuring that generated responses are more accurate and consistent with your business’s underlying data.</li>
</ul>

<h3 id="language-support">Language support</h3>

<p><a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#language-support">Learn about language support.</a></p>

<h3 id="before-you-start">Before you start</h3>

<p>When you use enriched answers, it’s important to be aware of the potential for <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#hallucinations">hallucinations</a>. This is especially important when you use them in automated conversations with bots. Unlike with <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">Conversation Assist</a>, there is no agent in the middle as a safeguard.</p>

<p class="attn-note">If you use enriched answers in <strong>consumer-facing</strong> bots, you accept this risk of hallucinations and the liability that it poses to your brand, as outlined in your legal agreement with LivePerson. <br /><br />Follow our best practices discussed later in this article: Test things out with internal bots and in Conversation Assist first.</p>

<h3 id="get-started">Get started</h3>

<ol>
  <li><a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Learn about KnowledgeAI's answer enrichment service.</a></li>
  <li><a href="https://community.liveperson.com/kb/articles/1502-get-started-with-our-solution#activate-the-generative-ai-features">Activate this Generative AI feature.</a></li>
  <li>Turn on enriched answers in one or more interactions in the bot. Select the prompt(s) to use. Configure the integration point.</li>
  <li>Test the consumer experience.</li>
</ol>

<h3 id="turn-on-enriched-answers">Turn on enriched answers</h3>

<p>In a bot, you might want to use enriched answers in some interactions but not others. This flexibility is possible to realize because the applicable setting is at the interaction level. Turn it on for some interactions but not others, or turn it on in all interactions. The choice is yours.</p>

<p>You'll find the <strong>Enriched answers via Generative AI</strong> setting on the face of the <a href="conversation-builder-interactions-integrations.html#knowledge-ai">KnowledgeAI interaction</a>:</p>

<p><img style="width:600px" src="img/ConvoBuilder/genai_cb_turnon1.png" alt="The Enriched answers via Generative AI toggle on the face of the KnowledgeAI interaction" /></p>

<p>Alternatively, in the <a href="conversation-builder-interactions-integrations.html#integration">Integration interaction</a>, display of the setting is dynamic. You’ll find it on the face of the interaction once you select a KnowledgeAI integration in the interaction. (Typically, you use the Integration interaction in Voice bots.)</p>

<p><img style="width:800px" src="img/ConvoBuilder/genai_cb_turnon2.png" alt="The Enriched answers via Generative AI toggle on the face of the Integration interaction" /></p>

<h3 id="default-prompts">Default prompts</h3>

<p>To get you up and running quickly, Generative AI integration points in bots make use of default <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#enrichment-prompts">Enrichment prompts</a>. An Enrichment prompt is required, and we don't want you to have to spend time on selecting one when you're just getting started and exploring.</p>

<p>Here's the default prompt for messaging bots:</p>

<p><img style="width:700px" src="img/ConvoBuilder/promptDefaultMessaging.png" alt="The prompt used by default in a KnowledgeAI interaction in a messaging bot" /></p>

<p>And here's the default prompt for voice bots:</p>

<p><img style="width:700px" src="img/ConvoBuilder/promptDefaultVoice.png" alt="The prompt used by default in an Integration interaction in a voice bot" /></p>

<p class="attn-note">Use the default prompts for a short time during exploration. But be aware that LivePerson can change these without notice, altering the behavior of your solution accordingly. To avoid this, at your earliest convenience, duplicate the prompt and use the copy, or select another prompt from the Prompt Library.</p>

<p class="attn-tip">You can learn more about the default prompts by reviewing their descriptions in the Prompt Library.</p>

<h3 id="select-a-prompt">Select a prompt</h3>

<p>The process of selecting or changing a prompt is the same for the <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#enrichment-prompts">Enrichment prompt</a> (required) and <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#no-article-match-prompts">No Article Match prompt</a> (optional).</p>

<ol>
  <li>In the interaction, select the existing prompt to open the Prompt Library.</li>
  <li>
    <p>Do one of the following:</p>

    <ul>
      <li>If you're currently using the default system prompt, click <strong>Select from library</strong> in the lower-right corner.</li>
      <li>If you're using one of your own prompts, click <strong>Go to library</strong> in the lower-left corner.</li>
    </ul>

    <p>By default, your prompts are listed in the Select Prompt window.</p>
  </li>
  <li>In <strong>My Prompts</strong>, select the prompt that you want to use.</li>
  <li>Click <strong>Select</strong>.</li>
</ol>

<p><img style="width:800px" src="img/ConvoBuilder/promptSelect.gif" alt="Changing the prompt to use in the interaction" /></p>

<p class="attn-note">Since you're accessing the Prompt Library from Conversation Builder, the system filters the available prompts to just those of an appropriate <strong>Client type</strong>. For example, if you have a messaging bot open, then you'll see only your prompts for messaging bots.</p>

<p class="attn-tip">When you're in the Prompt Library selecting a prompt, you can also <a href="trustworthy-generative-ai-prompt-library-manage-prompts.html">create, edit, and copy prompts</a> on the fly.</p>

<h3 id="configure-the-knowledgeai-integration">Configure the KnowledgeAI integration</h3>

<p>There are two ways to integrate KnowledgeAI answers into a bot:</p>

<ul>
  <li><strong><a href="conversation-builder-interactions-integrations.html#knowledge-ai">Knowledge AI interaction</a></strong>: Recommended for <a href="conversation-builder-bots-messaging-bots.html">Messaging bots</a> due to its power and simplicity.</li>
  <li><strong><a href="conversation-builder-interactions-integrations.html#integration">Integration interaction</a> that uses a <a href="conversation-builder-integrations-knowledgeai-integrations.html">KnowledgeAI integration</a></strong>: Required by <a href="conversation-builder-bots-voice-bots.html">Voice bots</a>.</li>
</ul>

<h4 id="using-the-knowledge-ai-interaction">Using the Knowledge AI interaction</h4>

<p>When using the <a href="conversation-builder-interactions-integrations.html#the-auto-render-plain-answer-layout">Auto Render, Plain answer layout</a>:</p>

<ul>
  <li>Use the <strong>Max number of answers</strong> interaction setting to specify how many matched articles to retrieve from the knowledge base and send to the LLM-powered service to generate a single, enriched answer.</li>
  <li>The interaction always sends just a single, plain-text answer (enriched by the LLM) to the consumer.</li>
</ul>

<p>Take care when using the <a href="conversation-builder-interactions-integrations.html#the-auto-render-rich-answer-layout">Auto Render, Rich answer layout</a>: In this context, the <strong>Max number of answers</strong> interaction setting has two purposes:</p>

<ol>
  <li>Determines how many matched articles to retrieve from the knowledge base and send to the LLM-powered service to generate a single, enriched answer</li>
  <li>Determines how many answers to send to the consumer.</li>
</ol>

<p>If you set <strong>Max number of answers</strong> to 1, only the top scoring article is used by the LLM service to generate the enriched answer (purpose 1), and only that enriched answer is sent to the consumer (purpose 2). The enriched answer is always considered the top answer match, i.e., the article at index 0.</p>

<p>However, if you set <strong>Max number of answers</strong> to a higher number, keep in mind that the setting has two purposes. If there's more than one article match, multiple articles will be used by the LLM service to generate the single, enriched answer (purpose 1). But this also means that the consumer is sent multiple answers, i.e., the enriched answer plus some <em>unenriched</em> answers too (purpose 2).</p>

<p>It can be advantageous to specify a number higher than 1 because more knowledge coverage is provided to the LLM service when generating the enriched answer. As a result, the enriched answer is often better than when it's generated using just a single article.</p>

<p>That said, if you do specify a number higher than 1, it's likely you <em>don't</em> want to send to the consumer unenriched answers along with the enriched one. If this is your case, keep the value higher than 1, and use the <a href="conversation-builder-interactions-integrations.html#no-auto-rendering-using-a-custom-answer-layout">No Auto Rendering (custom) answer layout</a> to send only the enriched answer to the consumer.</p>

<p><img style="width:800px" src="img/ConvoBuilder/genai_bot_noautorendering.png" alt="The Answer layout setting in the Advanced settings of the KnowledgeAI interaction, where the Answer layout setting is set to No auto rendering" /></p>

<p>You can display just the enriched answer with:</p>

<p><code class="language-html highlighter-rouge">{$.api_variableName.results[0].summary}</code></p>

<h5 id="important-notes">Important notes</h5>
<ul>
  <li><code class="language-html highlighter-rouge">variableName</code> is the response data variable name that you specified in the Knowledge AI interaction's settings.</li>
  <li>The enriched answer is always considered the top answer match, i.e., the article at index 0. And the content is returned in the <code class="language-html highlighter-rouge">Summary</code> field.</li>
</ul>

<p class="attn-alert">Use of the <a href="conversation-builder-interactions-integrations.html#the-auto-render-rich-answer-layout">Auto Render, Rich answer layout</a> is supported, but it isn’t recommended. This is because the generated answer from the LLM might not always align well substantively with the image/content URL associated with the highest-scoring article, which are what are used.</p>

<h4 id="using-the-knowledgeai-integration">Using the KnowledgeAI integration</h4>

<p>When using <a href="conversation-builder-integrations-knowledgeai-integrations.html">this integration</a>, things are a little more straightforward because this is a more manual approach. There’s less that is automated.</p>

<p>In the integration, the <strong>multipleResults</strong> setting determines only how many articles to try to retrieve from the knowledge base and send to the LLM-powered service to generate a single, enriched answer.</p>

<p>You can set <strong>multipleResults</strong> to 1. Or you can set it to a higher number. It can be advantageous to specify a higher number because more knowledge coverage is provided to the LLM service when generating the enriched answer. As a result, the enriched answer is often better than when it's generated using just a single article.</p>

<p>Whatever your choice, sending the enriched answer to the consumer is a manual implementation step via one or more interactions. Thus, you have control to ensure that only the enriched answer is sent.</p>

<p class="attn-note">The enriched answer is always considered the top answer match, i.e., the article at index 0. And the content is returned in the <code class="language-html highlighter-rouge">Summary</code> field.</p>

<p><a href="conversation-builder-bots-voice-bots.html#knowledgeai-integrations-in-voice-bots">Learn more about how to use this integration in a Voice bot.</a></p>

<h3 id="consumer-experience">Consumer experience</h3>

<p><img style="width:500px" src="img/ConvoBuilder/genai_bot_consumerexp.png" alt="An example of a bot conversing with a consumer, and the bot is sending enriched answers to the consumer" /></p>

<h3 id="hallucination-handling">Hallucination handling</h3>

<p><a href="trustworthy-generative-ai-prompt-library-key-terms-concepts.html#hallucinations">Hallucinations</a> in LLM-generated responses happen from time to time, so a Generative AI solution that’s trustworthy requires smart and efficient ways to handle them.</p>

<p>When returning answers to Conversation Builder bots, by default, KnowledgeAI takes advantage of our LLM Gateway's ability to <a href="trustworthy-generative-ai-llm-gateway.html#hallucination-detection-post-processing">rephrase responses to exclude hallucinated URLs, phone numbers, and email addresses</a>. This is so bots don't send messages containing these types of hallucinations.</p>

<h3 id="best-practices">Best practices</h3>

<h4 id="internal-bots">Internal bots</h4>

<p>Request feedback from your users.</p>

<h4 id="all-bots">All bots</h4>

<p>Always provide pathways (dialog flows) to ensure the user’s query can be resolved.</p>

<p>For example, assume you have a KnowledgeAI integration in the bot’s Fallback dialog, to “catch” and try to handle the queries that aren’t handled by the bot’s regular business dialogs. This is a common scenario. Further assume that this Fallback dialog transfers the conversation to an agent if no answers are returned. In this case, we don’t recommend that you ask us to turn on the feature that calls the enrichment service even when no article matches are found. Why? Because the bot would always provide some kind of response to the consumer. And the transfer to the agent would never happen.</p>

<h4 id="more-best-practices">More best practices</h4>

<p>See our <a href="knowledgeai-best-practices.html#best-practices-for-enriched-answers-via-generative-ai">KnowledgeAI best practices on using our enrichment service</a>.</p>

<h3 id="reporting">Reporting</h3>

<p>KnowledgeAI's <strong>Consumer Queries</strong> feature offers a <a href="knowledgeai-optimizing-your-content-evaluate-consumer-queries.html#reports">report on query-and-answer information</a>. It contains the consumer's query, the matched article (if any), how the article was matched, the confidence score, and more.</p>

<p>You can also use the <strong>Generative AI Dashboard</strong> in Conversational Cloud's Report Center to make data-driven decisions that improve the effectiveness of your Generative AI solution.</p>

<p><img style="width:800px" src="img/ConvoBuilder/genai_reportingdashboard.png" alt="A view of the Generative AI Reporting dashboard" /></p>

<p>The dashboard helps you to answer important questions, such as: How is Generative AI performing in my solution? To what extent is Generative AI helping my agents and bots?</p>

<p>The dashboard draws conversational data from all channels across Voice and Messaging, producing actionable insights that can drive business growth and improve consumer engagement.</p>

<p class="attn-tip">Access Report Center by clicking <strong>Optimize &gt; Manage</strong> on the left-hand navigation bar.</p>

<h3 id="faqs">FAQs</h3>

<h4 id="what-llm-is-used">What LLM is used?</h4>

<p>To learn which LLM is used by default, open the prompt in the Prompt Library, and check the prompt's <strong>Advanced</strong> settings.</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/genai_kai_bot1.png" alt="The LLM setting on the Advanced tab in a prompt" /></p>

<h4 id="can-i-use-your-llm-powered-features-to-take-action-on-behalf-of-consumers">Can I use your LLM-powered features to take action on behalf of consumers?</h4>

<p>Currently, there aren’t any LLM-powered features that trigger actions, i.e., the business-oriented dialogs in your bot. However, a common design pattern is to implement an LLM-powered KnowledgeAI integration in the bot’s Fallback dialog. This takes care of warmly and gracefully handling all consumer messages that the bot can’t handle. Once the consumer says something that triggers an intent-driven dialog, that dialog flow begins immediately.</p>

<p>As an example, the flow below illustrates a typical conversation between a Telco bot and a consumer inquiring about Internet packages. The consumer’s first 3 messages are handled by the Fallback dialog, but the 4th triggers the business dialog that takes action.</p>

<p><img style="width:800px" src="img/ConvoBuilder/genai_designpattern.png" alt="Flow of a conversation to a business dialog when an intent is matched or to a Fallback dialog when it isn't" /></p>

<p>The great thing about this design pattern is that it works very well with our <a href="conversation-builder-dialogs-dialog-basics.html#context-switching">context switching</a> feature. Once the business dialog begins, it remains “in play” until it’s completed. So, if the consumer suddenly interjects another question that the bot can’t handle — like, “Wait, can I bundle Internet and TV together?” — the flow will move to the Fallback dialog for another LLM-powered, enriched answer. And then, importantly, it will return automatically to the business dialog after sending that answer.</p>

<p>The other great thing about this design pattern is that it works very well with <a href="conversation-builder-bots-bot-to-bot-transfers.html#automatic-transfers-via-bot-group">bot groups</a> too. That is, if the consumer’s message matches a dialog in a bot within the same bot group, that other bot’s dialog is immediately triggered. The first bot’s Fallback dialog is never triggered for an enriched answer. Instead, the consumer is taken right into the action-oriented business flow.</p>

<h4 id="im-getting-different-results-in-conversation-builders-preview-tool-versus-knowledgeais-answer-tester-is-this-expected">I’m getting different results in Conversation Builder’s Preview tool versus KnowledgeAI’s Answer Tester. Is this expected?</h4>

<p>Semantically speaking, you should get the same answer to the same question when the context is the same. However, don’t expect the exact wording to be the same every time. That’s the nature of the Generative AI at work creating unique content.</p>

<p>Also, keep in mind that when using KnowledgeAI's Answer Tester, no conversation context is passed to the <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#answer-enrichment-flow">LLM service that does the answer enrichment</a>. So, the results will be slightly different.</p>

<p>Conversation context is only passed when using:</p>

<ul>
  <li><a href="conversation-builder-testing-deployment-preview-the-bot.html">Preview</a></li>
  <li><a href="conversation-builder-testing-deployment-test-debug-post-deployment.html">Conversation Tester</a></li>
  <li>A deployed bot</li>
</ul>

<p>The added conversation context can yield better results.</p>

<h3 id="troubleshooting">Troubleshooting</h3>

<h4 id="what-debugging-tools-are-available">What debugging tools are available?</h4>

<p>You can use both <a href="conversation-builder-testing-deployment-debug-the-bot.html">Bot Logs</a> and <a href="conversation-builder-testing-deployment-test-debug-post-deployment.html">Conversation Tester</a> within Conversation Builder to debug your Generative AI solution. Both tools provide detailed info on the article matching and the prompt used. Here's an example from Bot Logs:</p>

<p><img style="width:800px" src="img/ConvoBuilder/genai_debugging.png" alt="An example of viewing the data in Bot Logs while debugging a conversation in the Preview tool" /></p>

<h4 id="my-consumers-arent-being-sent-answers-as-i-expect-what-can-i-do">My consumers aren’t being sent answers as I expect. What can I do?</h4>

<p>In the interaction or integration (depending on the <a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html#configure-the-knowledgeai-integration">implementation approach</a> you're using), try adjusting the <strong>Min Confidence Score for Answers</strong> (a.k.a. <strong>threshold</strong>) setting. But also see the KnowledgeAI <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#confidence-thresholds">discussion on confidence thresholds</a>.</p>

<h3 id="related-articles">Related articles</h3>

<ul>
  <li><a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Enriched Answers via Generative AI</a> (KnowledgeAI)</li>
  <li><a href="trustworthy-generative-ai-prompt-library-overview.html">Prompt Library Overview</a></li>
  <li><a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">Offer Enriched Answers via Generative AI</a> (Conversation Assist)</li>
  <li><a href="https://community.liveperson.com/kb/articles/1501-trustworthy-generative-ai-for-the-enterprise">Trustworthy Generative AI for the Enterprise</a></li>
  <li><a href="trustworthy-generative-ai-bring-your-own-llm.html">Bring Your Own LLM</a></li>
</ul>
]]></description>
      <!-- <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Integrations</title>
      <link>https://developers.liveperson.com/conversation-builder-interactions-integrations.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-interactions-integrations.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>Integration interactions make programmatic calls to retrieve or post data to external systems and perform actions. They perform their work and then execute the next action.</p>

<p>If an integration retrieves data, that data can be stored in custom fields, so you can <a href="conversation-builder-interactions-interaction-basics.html#display-variables-in-interactions">use it in subsequent interactions</a>.</p>

<p>Integrations are similar to questions in that you can define conditions that each perform different next actions (based on which condition is met). Common uses for this include checking whether the integration call was a success or failure, having a condition triggered by the value of an API response, and having these events direct the flow of the conversation in a desired manner.</p>

<h3 id="integration">Integration</h3>

<p>Use the Integration interaction to make a programmatic call for some reason, for example:</p>

<ul>
  <li>To retrieve or post data to an external system</li>
  <li>To perform some action</li>
</ul>

<p class="attn-note">Before you can add an Integration interaction, you need to <a href="conversation-builder-integrations-integration-basics.html#integration-types">create the integration</a> itself.</p>

<p><img style="width:550px" src="img/ConvoBuilder/integrations_api.png" alt="Selecting the integration for the Integration interaction" /></p>

<h4 id="integration-name">Integration name</h4>

<p>Select the name of the integration to invoke.</p>

<h4 id="settings-for-knowledgeai-integrations">Settings for KnowledgeAI integrations</h4>

<p>If you select an integration whose type is "KnowledgeAI," settings for additional features dynamically appear:</p>

<p><img style="width:700px" src="img/ConvoBuilder/integrations_api2.png" alt="Selecting the integration for the Integration interaction" /></p>

<p>Learn about these features:</p>

<ul>
  <li><a href="knowledgeai-key-terms-concepts-user-queries-contextualize.html">Enhance (rephrase) user's query using conversation context (LivePerson SLM)</a></li>
  <li><a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Enrich answers via Generative AI</a></li>
</ul>

<h4 id="defining-rules-based-on-the-result-of-the-api-integration">Defining rules based on the result of the API integration</h4>

<p class="attn-note">It's recommended that you take advantage of the ability to define rules based on the <em>result</em> of the API integration.</p>

<p>In our example below, we've added a rule that checks for a "success" result, and we've configured the next step to continue to the next interaction…</p>

<p><img style="width:700px" src="img/ConvoBuilder/integrations_api_rule1.png" alt="Configuring a Success rule when the API call succeeds" /></p>

<p>…so, if our "Balance" integration succeeds, the user's balance is displayed (and then the interaction ends). We've likewise added a second rule that checks for a "failure" result, and then we've configured the next step to continue to a "fail" interaction. In this case, if our "Balance" integration fails, the user is notified that something went wrong.</p>

<p><img style="width:550px" src="img/ConvoBuilder/integrations_api_rule2.png" alt="The rest of the dialog flow based on whether the API call succeeds or fails" /></p>

<h4 id="best-practices">Best practices</h4>

<p>In the Pre-Process Code, save the API payload and <a href="conversation-builder-scripting-functions-log-debug.html#log-custom-event">log a custom event</a>. This can be useful for debugging later on. The example below conveys the idea, but note that it relies on some helper functions whose definitions aren’t shown.</p>

<p><img style="width:500px" src="img/ConvoBuilder/integrations_api_logcustomevent.png" alt="Example code for logging a custom event in Pre-Process Code" /></p>

<h3 id="knowledge-ai">Knowledge AI</h3>

<p>Use a KnowledgeAI™ interaction in a bot when you want to search a knowledge base for articles. This interaction always performs the search using the consumer’s most recent message as the search phrase.</p>

<p><img src="img/ConvoBuilder/knowledge_ai.gif" alt="Carousel" /></p>

<p>Powering bots with intelligent answers can increase containment: It helps to ensure that the conversation stays between the bot and the consumer and that the consumer's need is resolved by the bot.</p>

<p class="attn-note">This interaction isn't supported in <a href="conversation-builder-bots-voice-bots.html">Voice bots</a>. Instead, use an Integration interaction that uses a <a href="conversation-builder-integrations-knowledgeai-integrations.html">KnowledgeAI integration</a>. <a href="conversation-builder-bots-voice-bots.html#knowledgeai-integrations-in-voice-bots">Learn more.</a></p>

<h4 id="watch-the-video">Watch the video</h4>

<iframe src="https://player.vimeo.com/video/1077413832?h=1bd835e9fe" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<h4 id="how-the-knowledge-ai-search-works">How the Knowledge AI search works</h4>

<ul>
  <li><strong>The search phrase</strong>: The Knowledge AI interaction always passes the value of <code class="language-html highlighter-rouge">{$userMessage}</code> (which stores the consumer’s most recent message) into the search as the search phrase.</li>
  <li><strong>The search</strong>: When performing the search, the <a href="knowledgeai-key-terms-concepts-search-methods.html">search mode</a> is always “KnowledgeAI.” This cannot be changed. <a href="knowledgeai-key-terms-concepts-search-methods.html#search-flow">Learn about the search flow.</a></li>
  <li><strong>The results</strong>: The answers that are returned must meet or exceed the confidence score that you specify within the interaction’s configuration. This minimum threshold can be VERY GOOD, GOOD or FAIR PLUS.</li>
</ul>

<h4 id="how-the-answers-are-rendered">How the answers are rendered</h4>

<p>When you configure a Knowledge AI interaction, you specify an <strong>Answer layout</strong> for the answers, i.e., one of these:</p>

<p><img style="width:400px" src="img/ConvoBuilder/knowledge_ai_answerlayout.png" alt="The options for the Answer layout setting" /></p>

<p>The first two options are <em>rendered automatically</em>, and each uses a particular layout. With these options, there's no need to follow the Knowledge AI interaction with subsequent interactions that display the answers. The Knowledge AI interaction handles it all: both the knowledge base search and the rendering of the answers. When it meets your needs, one of these options is the simpler choice.</p>

<p>If you require control over the article content and layout that's used, you can choose to use a custom answer layout instead of auto rendering. In this case, you must follow the Knowledge AI interaction with subsequent interactions that display the answers.</p>

<p>Select an answer layout based on the target channels and your requirements. See <a href="conversation-builder-interactions-interaction-support.html">this topic</a> on interaction support.</p>

<h4 id="the-auto-render-rich-answer-layout">The "Auto render, rich" answer layout</h4>

<p>This layout looks like this:</p>

<p><img style="width:600px" src="img/ConvoBuilder/knowledge_ai_rich.png" alt="How the rich layout appears to the consumer" /></p>

<p>With this layout:</p>

<ul>
  <li>Anywhere from one to three results are returned based on the maximum number of answers that you've specified in the interaction.</li>
  <li>The results degrade gracefully to the "Auto render, plain" layout when the channel in use doesn't support the carousel.</li>
</ul>

<h4 id="the-auto-render-plain-answer-layout">The "Auto render, plain" answer layout</h4>

<p>This layout doesn’t include rich elements like images. If the channel is Web messaging, which supports <code class="language-html highlighter-rouge">href</code> tags, the output looks like this:</p>

<p><img style="width:600px" src="img/ConvoBuilder/knowledge_ai_plain.png" alt="How the plain layout appears to the consumer in Web messaging" /></p>

<p>On all other channels, it looks like this:</p>

<p><img style="width:700px" src="img/ConvoBuilder/knowledge_ai_plain2.png" alt="How the plain layout appears to the consumer in all other channels" /></p>

<p>With this layout:</p>

<ul>
  <li>Only a single, best result is returned regardless of the maximum number of answers that you've specified in the interaction.</li>
  <li>Any HTML in the article's content is <strong>not</strong> removed. (Take note of the formatting applied to <strong>Cancel Flight</strong> in the image above.) Use HTML in your source knowledge base only when your target channels support it.</li>
</ul>

<h4 id="best-practices-1">Best practices</h4>

<p>When integrating answers from KnowledgeAI into a bot, carefully consider where in the bot flow it’s best to do this. You want the consumer’s utterance to be answered by the right, topically relevant knowledge base, at the right time. For example, in a bot that can handle billing tasks and questions, plug in a “Billing questions” knowledge base. This kind of contextual approach is more focused, so it generally yields a high answer rate.</p>

<p>In contrast, strategies that are less targeted can yield a lower answer rate. For example, plugging a <em>general purpose</em> knowledge base into the <a href="conversation-builder-dialogs-fallback-dialogs.html">Fallback dialog</a> is an option, but it could yield a low answer rate.</p>

<h4 id="knowledge-bases">Knowledge bases</h4>

<p>On the face of the interaction, select the knowledge bases to search. You can select anywhere from one to five.</p>

<p><img style="width:600px" src="img/ConvoBuilder/knowledge_ai_add.png" alt="Selecting the knowledge bases to search on the KnowledgeAI interaction" /></p>

<p>The first knowledge base that you select filters the list of remaining ones you can choose from: All of the knowledge bases must belong to the same language group. For example, UK English and US English are fine together. Behind the scenes, the system validates the first two characters of the ISO language code.</p>

<p>You can select multiple <a href="knowledgeai-internal-knowledge-bases-introduction.html">internal knowledge bases</a>, or you can select multiple <a href="knowledgeai-external-knowledge-bases-external-kbs-without-liveperson-ai.html">external knowledge bases that don’t use LivePerson AI</a>. But you can't mix the two types together in a single interaction.</p>

<h4 id="enhance-rephrase-users-query-using-conversation-context-liveperson-slm">Enhance (rephrase) user's query using conversation context (LivePerson SLM)</h4>

<p>Often the user’s query doesn’t include enough context to retrieve a high-quality answer from a knowledge base. To solve this, you can turn on this setting if you want the system to gather additional conversation context (conversation turns) and use it to rephrase the user’s query before searching the knowledge base. Rephrasing is done using <a href="knowledgeai-key-terms-concepts-user-queries-contextualize.html">KnowledgeAI’s Query Contextualization</a> feature.</p>

<p>As mentioned in the article at the link above, queries that are <strong>not in English</strong> are not enhanced.</p>

<p><img style="width:600px" src="img/ConvoBuilder/knowledge_ai_rephraseUserQuery.png" alt="Selecting the knowledge bases to search on the KnowledgeAI interaction" /></p>

<h4 id="enriched-answers-via-generative-ai">Enriched answers via Generative AI</h4>

<p>To enrich the automated answers via Generative AI, turn on the <strong>Enriched answers via Generative AI</strong> toggle. Then select an <strong>Enrichment prompt</strong> and optionally a <strong>No Article Match</strong> prompt. <a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html">Learn more.</a></p>

<p><img style="width:600px" src="img/ConvoBuilder/knowledge_ai_add2.png" alt="Turning on the Enriched Answers via Generative AI toggle" /></p>

<h4 id="basic-settings">Basic settings</h4>

<ul>
  <li><strong>Message When Results Not Found</strong>: Enter the message to send to the consumer when there is no response returned from the knowledge base search. This might be due to no articles being found or due to a failed search. If you don't want this message to be sent, enter "BLANK_MESSAGE".</li>
</ul>

<p><a href="conversation-builder-interactions-configuration-settings.html#basic-settings">Learn about basic settings common to all interactions.</a></p>

<h4 id="advanced-settings">Advanced settings</h4>

<ul>
  <li>
    <p><strong>Min Confidence Score for Answers</strong>: Select the minimum score that a result must have in order to be returned, either VERY GOOD, GOOD, or FAIR PLUS. If you downgrade this <a href="knowledgeai-key-terms-concepts-search-methods.html#match-scores-and-thresholds">threshold</a> to FAIR PLUS, be sure to test whether the quality of the results meets your expectations. It's generally recommended to keep the quality above FAIR PLUS.</p>

    <p>This field isn't shown if you've selected an <a href="knowledgeai-external-knowledge-bases-external-kbs-without-liveperson-ai.html">external knowledge base that doesn't use LivePerson AI</a>. In this case, the results are simply those returned by the call to the external CMS.</p>
  </li>
  <li><strong>Max Number of Answers</strong>: Select the maximum number of matched articles to retrieve from the knowledge base <em>and</em> send to the consumer, anywhere from one to five. The default value is 1.</li>
  <li><strong>Answer Layout</strong>: Select "Auto render, rich," "Auto render, plain," or "No auto rendering" based on your requirements. These layout options are discussed farther above.</li>
  <li><strong>Link Text for Content URL</strong>: This setting is available when you select an "auto rendering" option for the <strong>Answer Layout</strong>. Enter the "learn more" text to use. You can enter a botContext or environment variable here, e.g., {$botContext.&lt;name&gt;}. When the "Auto render, rich" layout is used, and when the "Auto render, plain" layout is used and the channel is Web messaging, this is the text for the <code class="language-html highlighter-rouge">href</code> link to the article's content URL. When the "Auto render, plain" layout is used in any other channel, this value is sent as static text: [this value] + [article's content URL in shortened form], for example, "Learn more at www.mysite.com/abc." For illustrations, see the images earlier in this topic.</li>
  <li><strong>Default Image URL</strong>: This optional setting is available only when you select "Auto render, rich" for the <strong>Answer Layout</strong>. If you enter an image URL, then when an article doesn't have an image URL within the knowledge base, this image is used in the rich output. This presents a uniform consumer experience across all articles, even when some articles have images but others don't. You might specify a company logo. Remember to <a href="conversation-builder-networking-security.html#whitelisting-rich-media">whitelist the image URL</a>. You can also enter a botContext or environment variable here, e.g., {$botContext.&lt;name&gt;}.</li>
  <li><strong>Response Data Variable</strong>: This setting is available only when you select "No auto rendering" for the <strong>Answer Layout</strong>. Enter the name of the response data variable that will store the answer results. The default variable name is "kb_search."</li>
</ul>

<h4 id="direct-the-conversation-flow-based-on-the-result">Direct the conversation flow based on the result</h4>

<p>By default, a Knowledge AI interaction includes two custom rules: one rule for when the knowledge base search returns an answer and the other rule for when the search doesn’t.</p>

<p><img style="width:600px" src="img/ConvoBuilder/knowledge_ai_flow1.png" alt="Custom rules in the interaction, for directing the flow based on whether a match in the knowledge base was found" /></p>

<p>Within each rule, the condition specifies the particular search result, either "Found" or "Not Found."</p>

<p><img style="width:800px" src="img/ConvoBuilder/knowledge_ai_flow2.png" alt="Configuring the KB Result condition in the rule" /></p>

<p>Configure the <strong>Next Action</strong> for each of these rules based on the direction in which the conversation should flow in each case.</p>

<p><img style="width:600px" src="img/ConvoBuilder/knowledge_ai_flow3.png" alt="Configuring the next action for the rules for success and failure" /></p>

<p>If you're not using Generative AI and you delete the <strong>Match Not Found</strong> rule, then when a search is performed and no result is found, the fallback message is sent ("Sorry, I could not find anything for that."). However, if you've configured the <strong>Message when results not found</strong> setting in the interaction, then that message is sent instead.</p>

<p>If you're using Generative AI and you use a <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#no-article-match-prompts">No Article Match prompt</a>, then the <strong>Match Not Found</strong> rule is never triggered. This is because, when you use that kind of prompt, you always get a result—an answer from the LLM service—even when no matched articles are found in the knowledge base.</p>

<h4 id="no-auto-rendering-using-a-custom-answer-layout">No auto rendering: Using a custom answer layout</h4>

<p>Choose the "No auto rendering" answer layout when you require control over how the answers are rendered. With this option, you must manually add the interactions that display the article content.</p>

<p>To display a single, best result, use the syntax below, where "variableName" is the response data variable name that you specified in the Knowledge AI interaction's settings:</p>

<p><code class="language-html highlighter-rouge">{$.api_variableName.results[0].title}</code><br />
<code class="language-html highlighter-rouge">{$.api_variableName.results[0].summary}</code><br />
<code class="language-html highlighter-rouge">{$.api_variableName.results[0].detail}</code><br />
<code class="language-html highlighter-rouge">{$.api_variableName.results[0].imageURL}</code><br />
<code class="language-html highlighter-rouge">{$.api_variableName.results[0].contentURL}</code><br /></p>

<p>For example:</p>

<p><img style="width:800px" src="img/ConvoBuilder/knowledge_ai_result3.png" alt="The Answer layout setting and the Response data variable setting in the interaction" /></p>

<p><img style="width:600px" src="img/ConvoBuilder/knowledge_ai_result1.png" alt="An example of using a custom answer layout to send the answer to the consumer" /></p>

<p>To iterate over and display multiple results, use the syntax below in a similar manner:</p>

<p><code class="language-html highlighter-rouge">{$.api_variableName.results[i].title}</code><br />
<code class="language-html highlighter-rouge">{$.api_variableName.results[i].summary}</code><br />
<code class="language-html highlighter-rouge">{$.api_variableName.results[i].detail}</code><br />
<code class="language-html highlighter-rouge">{$.api_variableName.results[i].imageURL}</code><br />
<code class="language-html highlighter-rouge">{$.api_variableName.results[i].contentURL}</code><br /></p>

<p>For example:</p>

<p><img style="width:600px" src="img/ConvoBuilder/knowledge_ai_result2.png" alt="An example of how to configure things so that multiple results are iterated over and each is displayed" /></p>

<h3 id="agent-transfer">Agent Transfer</h3>

<p>In a messaging bot, use an Agent Transfer interaction when you want to manually transfer the conversation to another messaging bot or to a human agent.</p>

<p>In a voice bot, use this interaction when you want to manually transfer the conversation to another voice bot. (Transfers to human agents in third-party contact centers are done using the Transfer Call interaction.)</p>

<h4 id="notes">Notes</h4>

<ul>
  <li>If you add an Agent Transfer interaction to a Voice bot <em>after</em> creating and starting the bot's agent connector, you must restart the existing agent connector before testing the change.</li>
  <li>If, given your use case, you need to <a href="conversation-builder-dialogs-dialog-basics.html#preventing-context-switching">prevent context switching</a> from occurring during the transfer (e.g., messages are sent after the transfer that shouldn't be), you can do so.</li>
  <li>Be aware that manual transfers aren't the only way to perform transfers to other bots. Transfers can also be done <a href="conversation-builder-bots-bot-to-bot-transfers.html">automatically using a collaborative bot group</a>.</li>
</ul>

<p class="attn-tip">For some practice with this interaction type, complete the <a href="tutorials-get-started-with-bot-building-messaging-escalate-to-an-agent.html">Escalate to an Agent tutorial</a>, which involves a messaging bot.</p>

<h4 id="interaction-configuration">Interaction configuration</h4>

<h5 id="message-to-send">Message to send</h5>

<p>In messaging bots only, in the interaction, enter the message to send to the user prior to being transferred, something like, “Hold on while I connect you with an agent.” You can enter either static text, use a variable, or a combination of both. If you need to insert a new line, use an escape character like so: \\n.</p>

<p>This field is required in messaging bots, so if you don't want to send a message, enter "BLANK_MESSAGE" here. That satisfies the underlying, system requirement for a message, but it doesn't actually send one. The default value is, "Transferring to an agent…"</p>

<p><img style="width:600px" src="img/ConvoBuilder/interactions_agentTransfer.png" alt="The default message to send to the consumer, which appears on the interaction's face" /></p>

<h5 id="advanced-settings-1">Advanced settings</h5>

<ul>
  <li>
    <p><strong>Agent ID</strong>: Optional. Used for bot-to-human transfers only. Specify the ID of the human agent to which to transfer the conversation. (You can obtain the ID from the address bar when the user profile is displayed in Conversational Cloud.) For Messaging, specify the agent ID as <code class="language-html highlighter-rouge"><span class="nt">&lt;account</span> <span class="na">ID</span><span class="nt">&gt;</span>.<span class="nt">&lt;agent</span> <span class="na">ID</span><span class="nt">&gt;</span></code>. For Live Chat, specify just the <code class="language-html highlighter-rouge"><span class="nt">&lt;agent</span> <span class="na">ID</span><span class="nt">&gt;</span></code>. Transfer of the conversation to this agent ID occurs if the agent is available. If the agent isn't available, the conversation is added to the queue for the skill specified in <strong>Agent Skill ID</strong> in this interaction, and the conversation is routed according to Conversational Cloud’s <a href="https://community.liveperson.com/kb/articles/1495-transfer-to-agent">Transfer to agent</a> rules.</p>
  </li>
  <li>
    <p><strong>Agent Skill</strong>: Mandatory; without this, the transfer won’t work. Select the name of the skill to which to transfer the conversation. Behind the scenes, the system retrieves the skill's ID as the value to use. You can also enter a bot context variable that stores a skill ID, for example, <code class="language-html highlighter-rouge">{$botContext.skillId}</code>. You <strong>can't</strong> enter a bot context variable that stores a skill name.</p>

    <p>When the transfer is attempted, the value is evaluated.</p>

    <p>If the value isn't numeric, the fallback message is sent to the user. (This never happens if you select a skill name.)</p>

    <p>If the value is numeric and the bot responds, the conversation is added to the queue for the selected skill. The conversation is then routed according to Conversational Cloud’s <a href="https://community.liveperson.com/kb/articles/1495-transfer-to-agent/">Transfer to agent</a> rules.</p>

    <p>If the value is numeric, but the bot doesn't respond for more than 3 minutes (e.g., the chat server becomes overloaded and drops the message), an attempt is made to transfer to the Fallback Skill ID <em>if one is specified in the <a href="conversation-builder-testing-deployment-deploy-the-bot.html#add-an-agent-connector">agent connector</a></em> (in <strong>Advanced Options</strong>). Otherwise, the transfer fails. For information on handling failures, see below.</p>
  </li>
  <li>
    <p><strong>Transfer Bot Context</strong>: Used for <a href="conversation-builder-bots-bot-to-bot-transfers.html#manual-transfers">manual, bot-to-bot transfers</a> only. Select this to <em>automatically</em> pass the user's intent and/or message from the sender bot to the receiver bot. This lets the receiver bot know the appropriate dialog to start after the transfer.</p>
  </li>
</ul>

<h4 id="best-practices-2">Best practices</h4>

<h5 id="send-a-transfer-message">Send a transfer message</h5>

<p>When transferring the consumer to a live agent, it's customary to send some form of message to the user like, "Hold on while I connect you with an agent" (see step 2 above). You might want to send this as a Text statement in the dialog. However, supplying the message as a part of the interaction's configuration guarantees the message is the last one seen by the consumer prior to the transfer (because the message is sent as a part of the post body in the underlying Transfer API).</p>

<p>In the interaction, you don't have to supply a message, but if you don't, you'll need to set the field to <code class="language-html highlighter-rouge">BLANK_MESSAGE</code> to satisfy the system requirement for a value.</p>

<h5 id="add-a-time-delay-to-the-transfer-if-needed">Add a time delay to the transfer if needed</h5>

<p>If you're sending one or more messages to the consumer before the transfer, it's recommended that you add to the Agent Transfer interaction an interaction delay that accounts for each message to be sent. The transfer is an asynchronous process, and you don’t want the bot to start it too soon. The cumulative delay on the Agent Transfer interaction provides the time delay that’s needed.</p>

<p>For example, if you're sending 3 messages before the transfer, each with its own 2000 millisecond delay, you might add a 6000 millisecond delay to the Agent Transfer interaction (3 messages x 2000 millisecond delay per message = an aggregate 6000 millisecond delay).</p>

<p>Specify the delay in the <strong>Interaction Delay</strong> field in the Agent Transfer interaction's settings.</p>

<h5 id="handle-transfer-failures">Handle transfer failures</h5>

<p>First, if an immediate error occurs when calling the transfer API (due to an invalid skill ID or a system failure of some sort), a failure response will be returned. You can catch and handle these errors by adding a custom rule to the interaction that checks for a “failure” result. (For an example of this, see farther above in the <em>Integration interactions</em> section in this article.)</p>

<p>Second, most often in Chat, but occasionally with Messaging, it can happen that the transfer API call is successful, but an attempt at transferring to a skill will fail after some time. When this happens, the platform sends the message <code class="language-html highlighter-rouge">__agent_escalation_failed__</code> to the bot. If you don’t have a dialog set up to catch this pattern, the bot will treat it like any other consumer message. In most cases, it will go to the Fallback dialog.</p>

<p>Setting up a dialog to catch the <code class="language-html highlighter-rouge">__agent_escalation_failed__</code> pattern allows you to send an appropriate message to the consumer, e.g., "Sorry, we're unable to perform the transfer at this time. Please try again later."</p>

<p>If the <code class="language-html highlighter-rouge">__agent_escalation_failed__</code> message is sent 3 times to the bot, and the 4th attempt also fails, the escalation stops, and the following default response is sent to the consumer, "Not able to transfer to Agent at this time. Please try later." Alternatively, if you've specified a "default user-friendly response" (for when errors and exceptions occur) in <a href="conversation-builder-bots-bot-basics.html#configure-bot-settings">Bot Settings</a>, that response is sent instead.</p>

<h3 id="secure-form">Secure Form</h3>

<p class="attn-note">This interaction is supported only in Messaging bots.</p>

<p>There might be times when you want the bot to collect sensitive or private data from the consumer, such as their credit card info. You can use the Secure Form interaction to present a secure form to the consumer for this purpose.</p>

<h4 id="benefits-of-secure-forms">Benefits of secure forms</h4>

<p>A secure form is an online form that’s designed and implemented with security measures that protect the info being submitted. The form is developed with the goal of safeguarding sensitive or private data from unauthorized access, data breaches, or misuse. There are many benefits of using secure forms, such as:</p>

<ul>
  <li><strong>Data privacy</strong>: Secure forms help maintain data privacy and confidentiality because the data is encrypted during transmission.</li>
  <li><strong>Data integrity</strong>: Encryption prevents unauthorized modifications, ensuring the data submitted by consumers remains unchanged during transmission.</li>
  <li><strong>Prevention of data breaches</strong>: Without encryption, data transmitted over the Internet can be intercepted by malicious actors, leading to potential data leaks and breaches.</li>
  <li><strong>Trust and reputation</strong>: Consumers are more likely to trust a website or organization that prioritizes their data security.</li>
  <li><strong>Compliance with regulations</strong>: Depending on your jurisdiction, there might be data protection laws that require you to implement appropriate security measures when handling consumer data.</li>
</ul>

<h4 id="consumer-experience">Consumer experience</h4>

<ol>
  <li>
    <p>During an automated conversation, the secure form invitation is presented to the consumer. Once the consumer clicks the invitation link, the form is presented in a slideout window:</p>

    <p><img style="width:800px" src="img/ConvoBuilder/secureForm1.png" alt="An example conversation where the consumer is presented with a secure form in a slideout window" /></p>
  </li>
  <li>The consumer enters their info and submits the secure form.</li>
  <li>The data is saved to LivePerson’s PCI-compliant vault, so it can be used for a short period of time. Also, the bot is notified of the successful form submission.</li>
  <li>
    <p>Most commonly, the conversation is then transferred to an agent that’s trained in handling sensitive info.</p>

    <p class="attn-note">Currently, the bot cannot access the data provided via the secure form, so the bot can’t push that data to your external systems.</p>
  </li>
  <li>The agent gets the ring signaling a new conversation and accepts the conversation.</li>
  <li>The agent then handles the sensitive info as required.</li>
</ol>

<h4 id="before-you-begin">Before you begin</h4>

<p>Before adding the Secure Form interaction to a bot:</p>

<ol>
  <li><a href="https://community.liveperson.com/kb/articles/1427-secure-forms-for-messaging-user-guide">Learn about LivePerson secure forms</a> in our Community Center.</li>
  <li>Request that your LivePerson representative activate 1) the Secure Forms feature and 2) the Secure Form Studio for your account. This requires that we flip several switches under the hood. <a href="https://community.liveperson.com/kb/articles/1427-secure-forms-for-messaging-user-guide">Learn about account setup and necessary permissions</a> in the Community Center.</li>
  <li>In LivePerson’s self-service Secure Form Studio, create the secure form and customize the styling for your brand. You can access the studio via the Management Console in Conversational Cloud. <a href="https://community.liveperson.com/kb/articles/1427-secure-forms-for-messaging-user-guide">Learn about best practices</a> in the Community Center.</li>
</ol>

<h4 id="add-and-configure-the-secure-form-interaction">Add and configure the Secure Form interaction</h4>

<p>In the bot, add the Secure Form integration interaction at the point in the dialog flow where you want to present the secure form to the consumer.</p>

<p><img style="width:600px" src="img/ConvoBuilder/secureForm2.png" alt="The default state of the Secure Form interaction" /></p>

<h4 id="advanced-interaction-settings">Advanced interaction settings</h4>

<ul>
  <li><strong>Form title</strong>: Enter a descriptive title to display at the top of the secure form.</li>
  <li><strong>Form ID</strong>: Enter the ID of the secure form that you created via LivePerson’s Secure Form Studio.</li>
  <li><strong>Agent skill ID</strong>: Enter the ID of the skill to which to transfer the conversation after successful submission of the form. You must enter a direct, numeric value. Typically, agents assigned to the skill have PCI-compliant certifications, so they understand how to handle sensitive or private consumer info. The skill is defined in Conversational Cloud.</li>
  <li><strong>Agent ID (optional)</strong>: Enter the ID of the agent to which to transfer the conversation. Typically, this agent has PCI-compliant certification, so they understand how to handle sensitive or private consumer info. (You can obtain the ID from the address bar when the user profile is displayed in Conversational Cloud.) For Messaging, specify the agent ID as &lt;account ID&gt;.&lt;agent ID&gt;. For Live Chat, specify just the &lt;agent ID&gt;. Transfer of the conversation to this agent ID occurs if the agent is available. If the agent isn’t available, the conversation is added to the queue for the skill specified in <strong>Agent skill ID</strong> in this interaction, and the conversation is routed according to Conversational Cloud’s <a href="https://community.liveperson.com/kb/articles/1495-transfer-to-agent">Transfer to Agent</a> rules.</li>
  <li><strong>Transfer message to consumer</strong>: Enter the message to send to the consumer immediately after successful submission of the form and just before transfer to an agent. Example: Thanks! We’ve got your info. Transferring you to an agent now…</li>
</ul>

<h4 id="next-action---form-success-flow">Next action - Form success flow</h4>

<p>In most cases, after the consumer enters their info and submits the secure form, you’ll want to transfer the conversation to an agent that’s trained to handle sensitive data. Since this flow is most common, the default “Form success” rule specifies “Escalation” as the <strong>Next Action</strong>.</p>

<p><img style="width:600px" src="img/ConvoBuilder/secureForm3.png" alt="The Secure Form interaction, with a callout pointing to the form success rule configured to transfer the conversation" /></p>

<p><img style="width:800px" src="img/ConvoBuilder/secureForm4.png" alt="The form success rule itself, with callouts pointing to the Secure Form Submission condition and the Escalation next action" /></p>

<p>The "Escalation" <a href="conversation-builder-interactions-configuration-next-action.html">next action</a> sends the message that's configured in the <strong>Transfer message to consumer</strong> setting in the interaction's settings, and then it transfers the conversation to the skill or agent specified in the interaction’s settings.</p>

<p>In the success flow, you don’t have to transfer (escalate) the conversation to an agent, although this is most common. Change the default rule as needed.</p>

<p class="attn-note">Keep in mind that, currently, the bot cannot access the data provided via the secure form, so the bot can’t push that data to your brand’s external systems. Nor can you use the data to drive or otherwise inform the bot flow.</p>

<h4 id="next-action---form-failure-flow">Next action - Form failure flow</h4>

<p>Once the secure form is presented to the consumer, the clock starts ticking, and the secure form expires after a period of time. This time period is configurable, as discussed in our <a href="https://community.liveperson.com/kb/articles/1427-secure-forms-for-messaging-user-guide">secure forms documentation</a> in the Community Center.</p>

<p>If the consumer fails to submit the form within the specified period of time, the bot receives a result of "failure" for the secure form submission, and the "Form failure" rule in the interaction is triggered. Specify a next action for this scenario per your requirements.</p>

<p><img style="width:800px" src="img/ConvoBuilder/secureForm5.png" alt="A pointer to the default form failure rule in the inteaction" /></p>

<p>In our example below, we've redirected the flow to a question that asks the consumer whether they'd like to try again.</p>

<p><img style="width:400px" src="img/ConvoBuilder/secureForm6.png" alt="In a messaging conversation, the consumer is notified that the form has expired, and they're asked whether they want to try again" /></p>

<h4 id="faqs">FAQs</h4>

<h5 id="where-can-i-learn-about-the-security-measures-that-support-this-solution">Where can I learn about the security measures that support this solution?</h5>

<p>The Secure Forms interaction simply presents the secure form to the consumer, and then drives the bot flow as you have configured it. You can <a href="https://community.liveperson.com/kb/articles/1427-secure-forms-for-messaging-user-guide">learn about LivePerson secure forms</a> in our Community Center. There you’ll find info on:</p>

<ul>
  <li>Payment Card Industry Data Security Standards (PCI-DSS) compliance</li>
  <li>Security measures that are used</li>
  <li>Impact on conversation transcripts</li>
  <li>And more</li>
</ul>

<h5 id="can-i-handle-a-failed-transfer">Can I handle a failed transfer?</h5>

<p>Failed transfers shouldn’t be common, but currently it isn’t possible to catch and handle a failed transfer. The bot can’t handle this case.</p>

<h3 id="file-upload">File Upload</h3>

<p><a href="conversation-builder-dialogs-file-upload-dialogs.html">Learn about approaches to adding suppport for uploading of files by consumers.</a></p>

<h3 id="dynamic-routing">Dynamic Routing</h3>

<p><a href="conversation-orchestrator-dynamic-routing-overview.html">Dynamic Routing</a> is the intelligent routing of consumer conversations to the most qualified agents — bot or human — based on intent data and other contextual data: consumer inputs, past interactions, loyalty tier, and other attributes. Dynamic routing makes possible highly personal consumer journeys and routing at scale. It is a key architectural component of Conversation Orchestrator, one of LivePerson’s Conversational AI applications.</p>

<p>LivePerson Conversation Builder includes a <strong>Dynamic Routing interaction</strong> that significantly simplifies the usage of the Dynamic Routing capability. While there are other methods of implementing Dynamic Routing, using this interaction instead is recommended for its ease of use and lack of code.</p>

<p class="attn-note">The Dynamic Routing interaction is only available to brands who log in with single sign-on via Conversational Cloud. It isn’t available if you log into Conversation Builder directly. <br /><br />
This section provides basic information on Conversation Builder’s Dynamic Routing interaction. For detailed information on using this interaction, see the <a href="conversation-orchestrator-dynamic-routing-get-started.html">Conversation Orchestrator getting started documentation</a>.</p>

<h4 id="how-the-interaction-works">How the interaction works</h4>

<p>A Dynamic Routing interaction does the following:</p>

<ol>
  <li>
    <p>It automatically performs an <code class="language-html highlighter-rouge">askMaven</code> call to get the next routing actions for the current conversation.</p>

    <p><a href="conversation-builder-scripting-functions-askmaven.html">askMaven</a> is the Conversation Builder JavaScript function that conveniently wraps Conversation Orchestrator’s Next Actions API. You don’t need to manually add this call; the Dynamic Routing interaction automates the logic.</p>
  </li>
  <li>
    <p>It sets the following in the Conversation Orchestrator namespace:</p>

    <ul>
      <li><strong>orchestrator.channel</strong>: The channel in use</li>
      <li><strong>orchestrator.userMessage</strong>: The most recent user message</li>
      <li><strong>orchestrator.intent</strong>: The ID of the most recently matched Dialog Starter intent</li>
    </ul>
  </li>
  <li>
    <p>It iterates through the next actions returned by the <code class="language-html highlighter-rouge">askMaven</code> call and automatically performs all the actions in the order they were returned. For example, it might send a message to the consumer, and then transfer the conversation to a particular skill. A next action can be one of:</p>

    <ul>
      <li>Send a message</li>
      <li>Route to skill</li>
      <li>Route to agent</li>
    </ul>

    <p><strong>Note:</strong> If the next action returned by the <code class="language-html highlighter-rouge">askMaven</code> call is just to send a message, the bot does this and then transfers to the fallback skill specified in the interaction. If a fallback skill isn't specified, the conversation flow continues to the next action in the dialog.</p>
  </li>
</ol>

<h4 id="prerequisites">Prerequisites</h4>

<p>Before using the Dynamic Routing interaction, make sure that Conversation Orchestrator’s <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#get-started---set-up-the-ccs">Conversation Context Service is enabled for your account</a>. If your account is relatively new, it’s likely that this was done automatically for you by LivePerson when your account was set up. However, brands with older accounts will need to enable this manually.</p>

<p>Enabling the Conversation Context Service for your account is necessary because when the Dynamic Routing interaction performs the <code class="language-html highlighter-rouge">askMaven</code> call, the CCS is used to store and pass some information.</p>

<h4 id="interaction-configuration-1">Interaction configuration</h4>

<h5 id="routing-policies">Routing policies</h5>

<p>In the interaction, click <strong>Manage routing policies</strong>. As a convenience, this link takes you to Conversation Orchestrator, where you can <a href="conversation-orchestrator-dynamic-routing-manage-routing-policies.html">define and prioritize your routing policies</a> if you haven’t done so already.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/integrations_dynrouting.png" alt="" /></p>

<h5 id="basic-settings-1">Basic settings</h5>

<ul>
  <li><strong>Fallback Skill ID</strong>: If the <code class="language-html highlighter-rouge">askMaven</code> call returns just a next action of “send message,” doesn’t return any next actions, returns an error, or fails for some reason, this is the ID of the agent skill to which the conversation is transferred. You can specify the ID using a bot context variable like {botContext.skillId}, or you can enter a direct, numeric value. If this setting isn’t set, the conversation flow continues to the next action in the dialog.</li>
  <li><strong>Fallback Skill Name</strong>: Enter the name of the agent skill that you specified in the <strong>Fallback Skill ID</strong> setting. Entering the name provides you with something display-friendly and “readable” by which to readily understand which skill is being used (since the skill ID is a number).</li>
</ul>

<h5 id="advanced-settings-2">Advanced settings</h5>

<ul>
  <li><strong>Escalation Message</strong>: This is the message to send to the consumer before transferring the conversation as determined by the next actions, for example, “Hold on while I connect you with a suitable agent who can assist you.” You can enter static text, use a variable, or both. If you need to insert a new line, use an escape character like so: \\n.</li>
</ul>

<h4 id="overriding-standard-behaviors">Overriding standard behaviors</h4>

<p>Optionally, you can add Pre-Process or Post-Process code to the interaction to override standard behaviors. For example, you might want to direct the flow to a different interaction, not to the Dynamic Routing interaction, based on certain conditions. You could do this in the Pre-process Code.</p>

<h4 id="using-the-dynamic-routing-bot">Using the Dynamic Routing bot</h4>

<p>If you are setting up a new routing or concierge bot, it might be helpful to <a href="conversation-orchestrator-dynamic-routing-get-started.html">use the Dynamic Routing bot</a>. The bot already includes the Dynamic Routing interactions and additional, out-of-the-box functionality, such as routing by intent.</p>

<h4 id="faqs-1">FAQs</h4>

<p><strong>How many Dynamic Routing interactions can I add within a bot?</strong></p>

<p>You can add just one.</p>

<p><strong>How does disambiguation work when a Dynamic Routing interaction is used?</strong></p>

<p>Disambiguation is the responsibility of the bot, so if you want to let the consumer clarify their intent before the flow moves to the Dynamic Routing interaction, implement a <a href="conversation-builder-dialogs-disambiguation-dialogs.html">Disambiguation dialog</a>.</p>

<p><strong>Why can’t I add custom rules to the interaction?</strong></p>

<p>As mentioned above, the end result of this interaction is always a transfer. Custom rules that control the next action can’t be specified because the transfer happens asynchronously.</p>

<p><strong>Can I alter the behavior of the askMaven call that’s performed by the Dynamic Routing interaction?</strong></p>

<p>No, this can’t be done. If you’d like to do this, the Dynamic Routing interaction isn’t the best solution. Use one of the <a href="conversation-orchestrator-dynamic-routing-getting-started-legacy.html">more manual methods</a>.</p>

<h3 id="apple-pay">Apple Pay</h3>

<p><strong>For Apple Messages for Business only.</strong></p>

<p>If your business uses Apple’s Messages for Business service to chat with consumers via the Messages app, you can use the Apple Pay integration interaction to let the consumer make a payment for goods and services using Apple Pay.</p>

<p>The interaction has been developed per Apple's Apple Pay <a href="https://register.apple.com/resources/messages/msp-rest-api/type-interactive#apple-pay-message">specifications</a>. Keep in mind <a href="https://developer.apple.com/design/human-interface-guidelines/technologies/messages-for-business/introduction">Apple's guidelines</a>.</p>

<h4 id="prerequisite-setup-steps">Prerequisite setup steps</h4>

<ol>
  <li>Review and follow <a href="https://community.liveperson.com/kb/articles/1137-apple-messages-for-business-setup-guide">LivePerson’s Apple Messages for Business setup guide</a>.</li>
  <li>As a part of the setup for Apple Pay in specific, you’ll need to create and set up your merchant account and the services needed to use Apple Pay, and you’ll need to provide your Merchant ID in Apple Business Register. For more info on these steps, see <a href="https://developer.apple.com/documentation/businesschatapi/messages_sent/interactive_messages/apple_pay_in_business_chat/initiating_apple_pay">this section</a> on Apple's developer site. Contact your LivePerson representative (other contact options: chat with us on this page, or <a href="https://community.liveperson.com/kb/articles/1576-how-to-contact-support">message Support</a>) for help with this if needed.</li>
  <li><a href="https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/requesting_an_apple_pay_payment_session">Implement your own merchant session endpoint</a>.</li>
</ol>

<p>Once this setup is completed, you can add the Apple Pay integration to your bot and configure it as described below.</p>

<h4 id="interaction-configuration-2">Interaction configuration</h4>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/integrations_applepay1.png" alt="The default state of the Apple Pay interaction" />
<br />
<img style="width:400px" src="img/ConvoBuilder/integrations_applepay3.png" alt="How the interaction is rendered to the consumer" />
<br />
<img style="width:450px" src="img/ConvoBuilder/integrations_applepay4.png" alt="Another view of how the interaction renders to the consumer" /></p>

<h5 id="tile-settings">Tile settings</h5>

<table>
  <thead>
    <tr>
      <th>Setting</th>
      <th>Description</th>
      <th>Required?</th>
      <th>Example</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>ADD IMAGE → Image URL</td>
      <td>The URL of the image to display. The domain in the URL must be <a href="conversation-builder-networking-security.html#whitelisting-rich-media">whitelisted</a>. If used, specify an image that’s appropriate for the overall pay experience.</td>
      <td>Optional</td>
      <td><a href="https://www.mysite/images/mylogo.jpg">https://www.mysite/images/mylogo.jpg</a></td>
    </tr>
    <tr>
      <td>ADD IMAGE → Image Style</td>
      <td>The size of the image, either Icon (smallest), Small, or Large.</td>
      <td>Optional</td>
      <td>Icon</td>
    </tr>
    <tr>
      <td>Title</td>
      <td>The title of the Apple Pay bubble.</td>
      <td>Required</td>
      <td>Your order</td>
    </tr>
    <tr>
      <td>Item name</td>
      <td>A short description of the item. You can specify a botContext or integration variable name. You can also express these using an array enumerator, i.e., specify the variable using “i” as the index.</td>
      <td>Required</td>
      <td>{applePayData.lineItems[i]}</td>
    </tr>
    <tr>
      <td>Item price</td>
      <td>The amount of the item. You can specify a botContext or integration variable name. You can also express these using an array enumerator, i.e., specify the variable using “i” as the index.</td>
      <td>Required</td>
      <td>{applePayData.itemPrices[i]}</td>
    </tr>
    <tr>
      <td>Total</td>
      <td>The total amount for all items, in effect, the subtotal (minus tax). You can specify a botContext or integration variable name.</td>
      <td>Required</td>
      <td>{$botContext.total}</td>
    </tr>
  </tbody>
</table>

<h5 id="advanced-interaction-settings-1">Advanced interaction settings</h5>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/integrations_applepay2.png" alt="The Advanced settings in an Apple Pay interaction" /></p>

<p><strong>Merchant Information</strong></p>

<ul>
  <li><strong>Merchant Identifier</strong>: The unique identifier that represents you as a merchant for Apple Pay.</li>
  <li><strong>Merchant Name</strong>: The canonical name for your store, suitable for display and consisting of 64 or fewer UTF-8 characters.</li>
  <li><strong>Country</strong>: Your two-letter ISO 3166 country code as a merchant.</li>
  <li><strong>Currency</strong>: The three-letter ISO 4217 currency code for the payment.</li>
  <li><strong>Merchant Session</strong>: A unique token representing the transaction between the consumer and you as the merchant. This token is used by Apple to confirm that the pay session was created by a valid merchant and that it is being used within the time bounds allowed by Apple. Create an integration that points to your merchant session endpoint, and provide the response received from the endpoint here. You can specify a botContext or integration variable name.</li>
  <li><strong>Account Signature</strong>: This field allows for the account signature to be generated and added as a part of the request, for extra validation. The field stores a signed hash of the merchant session payload. The hash is sent as a part of the structured content request to the connector, which validates it and rejects it if invalid. You can enter an alphanumeric string or specify a botContext or integration variable name. This field is optional and only needed for accounts using this <a href="apple-messages-for-business-templates-apple-pay-template.html#apple-pay-signature-flow">sign/validate flow from Apple</a>. Note that opting in to this additional verification requires some internal account configuration; please contact your LivePerson representative (other contact options: chat with us on this page, or <a href="https://community.liveperson.com/kb/articles/1576-how-to-contact-support">message Support</a>) for help with setting this up.</li>
  <li><strong>Request Identifier</strong>: This field stores the unique identifier representing the merchant session request. The request identifier is a consistent ID throughout the lifetime of the pay session, and it’s used by LivePerson APIs and services to track the pay session from start to finish. You can enter an alphanumeric string or specify a botContext or integration variable name.</li>
</ul>

<p><strong>Shipping Methods</strong></p>

<p>You can add a list of available shipping methods. For each shipping method, specify:</p>

<ul>
  <li><strong>Name</strong>: A short description of the shipping method.</li>
  <li><strong>Shipping Cost</strong>: The cost associated with the shipping method.</li>
  <li><strong>Description</strong>: An additional description of the shipping method.</li>
  <li><strong>ID</strong>: (Optional) A value that you provide to identify the shipping method.</li>
</ul>

<p class="attn-note">The shipping method fields can be updated dynamically via an API call, i.e., you can specify a botContext or integration variable name in these fields.<br /><br />The first shipping method that you add is used as the default method.</p>

<p><strong>Additional Fields and Payment Capabilities</strong></p>

<ul>
  <li><strong>Required Billing Fields</strong>: Select the billing contact fields required to process the transaction. <strong>Tip:</strong> Select only the fields that are needed to process the payment. Selecting unnecessary fields adds complexity to the transaction; this can increase the chances of the customer canceling the payment request.</li>
  <li><strong>Required Shipping Fields</strong>: Select the shipping contact fields required to fulfill the order. For example, if you need the customer’s email address or phone number, select these.</li>
  <li><strong>Merchant Capabilities</strong>: Specify the payment capabilities supported by you as the merchant. You must include “3DS.”</li>
  <li><strong>Supported Networks</strong>: Specify one or more of the payment networks supported by you as the merchant.</li>
</ul>

<p><strong>Endpoint URLs</strong></p>

<p>Only the <strong>Payment Gateway URL</strong> is required. This URL is called by Apple Pay to process the payment through the payment provider.</p>

<p>The optional endpoint URLs are for receiving and managing any updates a customer might make before confirming the payment. These include:</p>

<ul>
  <li><strong>Payment Method Update URL</strong>: Called by Apple Pay when the customer changes the payment method.</li>
  <li><strong>Shipping Method Update URL</strong>: Called by Apple Pay when the customer changes the shipping method.</li>
  <li><strong>Shipping Contact Update URL</strong>: Called by Apple Pay when the customer changes their shipping address information.</li>
  <li><strong>Fallback URL</strong>: A URL that opens in a web browser so the customer can complete the purchase if their device is unable to make payments using Apple Pay.</li>
  <li><strong>Order Tracking URL</strong>: Called by Apple Messages for Business after completing the order; provides you with an opportunity to update the order information in your system.</li>
</ul>

<p>For more on these endpoints, see <a href="https://developer.apple.com/documentation/businesschatapi/applepayendpoints">this topic</a> on Apple developer's site.</p>

<h3 id="transfer-call">Transfer Call</h3>

<p class="attn-note">This interaction is supported only in <a href="conversation-builder-bots-voice-bots.html">Voice bots</a>.</p>

<p>There might be times when you want the bot to transfer the conversation to a human agent in a third-party voice contact center. In this case, use a Transfer Call integration to transfer the conversation to the center in one of two ways:</p>

<ul>
  <li><strong>Make a SIP call to the center over a SIP trunk</strong>. What’s a SIP call? SIP stands for Session Initiation Protocol. It’s a specific set of rules that allow you to make and receive phone calls over the Internet (i.e., without the use of the phone carrier network), using any device (computer, desktop phone, mobile phone, etc.). Contact centers often set up and use SIP calling due its many benefits: flexibility, affordability, scalability, and more.</li>
  <li><strong>Make a call to the center’s E.164 number over the public switched telephone network (PSTN)</strong>. What’s an E.164 number? It’s a type of phone number that’s assigned to devices and services in the PSTN. It’s also a unique identifier that helps to route calls to the correct destination.</li>
</ul>

<p><img style="width:600px" src="img/ConvoBuilder/voicebot_transferCall1.png" alt="An example Transfer Call integration interaction" /></p>

<h4 id="transfer-type">Transfer type</h4>

<p>Select the type of call to make:</p>

<ul>
  <li>Make SIP call over SIP trunk</li>
  <li>Call E.164 number over PSTN</li>
</ul>

<p class="attn-note">Need help setting up a SIP Transfer using a specific communications vendor, such as Avaya? Contact your LivePerson representative for assistance.</p>

<h4 id="sip-uri-or-e164-number">SIP URI or E.164 number</h4>

<p>For a SIP call, enter the SIP URI to which to transfer the call in the space indicated. This takes the form of:</p>

<p><code class="language-html highlighter-rouge">sip:<span class="nt">&lt;username&gt;</span>@<span class="nt">&lt;domain</span> <span class="na">or</span> <span class="na">IP</span><span class="nt">&gt;</span>:<span class="nt">&lt;port&gt;</span></code></p>

<p>You’ll need to obtain this URI from the administrator of the third-party voice contact center solution.</p>

<p>Alternatively, for a call to an E.164 number, enter the E.164 number. This takes the form of:</p>

<p><code class="language-html highlighter-rouge">[+][country code][subscriber number including area code]</code></p>

<p class="attn-note">Don't include any spaces in the E.164 number.</p>

<h4 id="sip-headers">SIP headers</h4>

<p>Regardless of the type of call you make (SIP or E.164), under <strong>SIP Headers</strong>, you can use the free-form fields to add key/value pairs for the contextual information to pass along in the call. The contact center’s system uses this information to route the call to the best possible agent. Here again, you’ll need to obtain the keys from the administrator of the third-party voice contact center solution. For the values, you can enter a string, a botContext variable, an environment variable, or a combination thereof.</p>

<p class="attn-note">Generally speaking, for security reasons, don’t capture and store within Conversation Builder any data that needs to be secure. So, when it comes to the SIP headers in particular, don’t directly include any sensitive information (password, authentication token, etc.) or personally identifiable information (consumer’s credit card number, etc.).</p>

<p>Use these best practices for specifying headers:</p>

<ul>
  <li>Add a SIP header for the conversation ID.</li>
  <li>Optionally, use your own authentication API to obtain the authentication token for the SIP transfer, and specify that variable in another SIP header.</li>
  <li>Optionally, use the <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html">Conversation Context Service</a> to store additional data. You might use the service to store the authentication token and possibly more data that’s been gathered during the bot flow. (See <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html">code examples</a> of writing data to and reading data from the Conversation Context Service.) Once the data is set in a variable, you can specify that variable in another SIP header.</li>
</ul>

<p class="attn-alert">In the case of a PSTN-based transfer using an E.164 number, the SIP headers might be dropped by intermediate service providers. If you need to ensure that the headers are sent, use a SIP transfer over a SIP trunk instead.</p>

<h4 id="use-callers-phone-number">Use caller's phone number</h4>

<p>This setting determines who the "calling party" is. Turn this on if you want the caller's phone number to be shown to the recipient as the calling number when the call is transferred. Turn this off to use the Voice bot’s phone number instead.</p>

<h4 id="success-and-failure-rules">Success and Failure rules</h4>

<p>In the interaction, note the <strong>Success</strong> rule that’s provided by default. This closes the conversation with the Voice bot when the transfer is successful. You can keep this rule as is.</p>

<p>Customize the <strong>Failure</strong> rule per your requirements. A failure isn’t likely to happen, but it can occur if the Transfer Call interaction is configured improperly. So, the Voice bot should handle failures gracefully. For example, you might want to play a message to the consumer, e.g., “We’re unable to transfer you to an agent at this time. Please try again later.” A more complex solution might involve logging a ticket in your CRM system, so you can call the consumer back.</p>

<p><img style="width:600px" src="img/ConvoBuilder/voicebot_transferCall2.png" alt="A Transfer Call integration with a pointer to the Failure rule that you should customize" /></p>

<h4 id="notes-about-call-transfers">Notes about call transfers</h4>

<ul>
  <li>If the Transfer Call integration is configured properly, the transfer will begin, and a success notification will be received by the Voice bot. This causes the Voice bot conversation to be closed, as per the <strong>Success</strong> rule in the interaction. Note that Conversation Builder doesn’t wait for the third-party voice contact center to actually respond.</li>
  <li>Once the call transfer is initiated, the call is handled according to the business logic of the contact center’s telephony system.</li>
</ul>

<h4 id="best-practices-3">Best practices</h4>

<ul>
  <li><strong>Play a transfer message</strong> to let the consumer know the transfer is happening, e.g., “Just a second. Let me connect you with one of our agents.” You can do this by adding a Speech or Audio statement immediately before the Transfer Call interaction.</li>
  <li><strong>Add a time delay</strong> to the transfer if needed. If you’re playing one or more responses before the transfer, it’s recommended that you add to the Transfer Call interaction an interaction delay that accounts for each response you need to play. This gives the Voice bot sufficient time to play the messages before transferring the conversation. For example, if you’re playing 3 messages before the transfer, you might add a 6000 millisecond delay to the Transfer Call interaction (3 messages x 2000 millisecond delay per message = an aggregate 6000 millisecond delay.) Specify the delay in the <strong>Interaction Delay</strong> field in the interaction’s settings.</li>
</ul>

<h3 id="send-sms">Send SMS</h3>

<p class="attn-note">This interaction is supported only in <a href="conversation-builder-bots-voice-bots.html">Voice bots</a>.</p>

<p>During an automated voice conversation, there are times in the flow when you might need to send an SMS message to the consumer. Use the Send SMS integration to do this. It’s useful for sending:</p>

<ul>
  <li>Instructions</li>
  <li>Reminders</li>
  <li>A link to the directions to your office</li>
  <li>A link to the results of a product search</li>
  <li>And more</li>
</ul>

<p class="attn-note">Sending an SMS message doesn’t affect the voice conversation with the bot.</p>

<h4 id="message-to-send-and-mobile-number">Message to send and mobile number</h4>

<p><img style="width:600px" src="img/ConvoBuilder/voicebot_sendsms1.png" alt="A blank Send SMS integration interaction" /></p>

<p>Enter the message to send. About 160 characters are allowed. As a best practice, include some language to indicate to the consumer that they should not reply to the message since this will not work.</p>

<p>Also enter the consumer’s mobile number.</p>

<p class="attn-note">For the mobile number, enter " + " (plus sign) followed by the number in <a href="https://www.itu.int/rec/T-REC-E.164-201011-I/en">e.164 format</a>, for example " +18605551212 ". Typically, you’ll specify a botContext variable here because you’ve saved the consumer’s number to the bot’s context. As a best practice, use a botContext variable or an environment variable.</p>

<h4 id="limitations">Limitations</h4>

<p>The SMS channel doesn’t support HTML, so neither does the Send SMS integration. If you need to include a link, add it directly like so:</p>

<p><img style="width:600px" src="img/ConvoBuilder/voicebot_sendsms2.png" alt="A Send SMS integration interaction that shows a direct URL link added" /></p>

<h4 id="handling-success-and-failure">Handling success and failure</h4>

<p>Configure the Success and Failure rules to direct the bot’s flow to the appropriate interaction for each case.</p>

<p><img style="width:600px" src="img/ConvoBuilder/voicebot_sendsms3.png" alt="A Send SMS integration interaction that shows two configured Success and Failure rules" /></p>

<p>Taking care to handle failures is a best practice. Make sure to handle failure cases by configuring the Failure rule to direct the bot’s flow to the appropriate interaction.</p>

<h4 id="best-practices-4">Best practices</h4>

<p>If the consumer attempts to reply to the SMS message, this will not work. So, include some language in the message to indicate that they shouldn’t do this.</p>

<p>That said, you can use LivePerson’s <a href="https://community.liveperson.com/kb/articles/1209-connect-to-messaging-overview">Connect to Messaging (C2M) functionality</a> to move the conversation from Voice to Messaging. This is done via an <a href="conversation-builder-interactions-integrations.html#integration">Integration interaction</a>.</p>

<h3 id="transfer-to-messaging">Transfer to Messaging</h3>

<p class="attn-note">This interaction is supported only in Voice bots.</p>

<p class="attn-tip"><a href="tutorials-get-started-with-bot-building-voice-transfer-to-messaging.html">Check out the Transfer to Messaging tutorial.</a></p>

<p>During an automated voice conversation, there are times in the flow when you might want to transfer the call to one of your supported messaging channels. Use the Transfer to Messaging integration interaction to accomplish this.</p>

<p><img style="width:800px" src="img/ConvoBuilder/interactions_c2m3.png" alt="An example of a conversation transferred from voice to messaging, with a view of the Agent Workspace and the consumer's mobile phone" /></p>

<p>The Transfer to Messaging interaction makes three API calls (internally) to LivePerson’s Connect-to-Messaging (C2M) system:</p>

<ol>
  <li><strong>Authentication</strong>: This first call is used to authenticate with LivePerson’s Connect-to-Messaging (C2M) system. If authentication is successful, the C2M system provides an access token to use when making the subsequent API calls.</li>
  <li><strong>Eligibility</strong>: This second call checks whether the consumer is reachable via the messaging channel.</li>
  <li><strong>Invite</strong>: This last call initiates the messaging conversation with the consumer.</li>
</ol>

<h4 id="use-cases">Use cases</h4>

<p>You might want to use the Transfer to Messaging interaction if:</p>

<ul>
  <li>Your consumers prefer Messaging. You interact with them over Voice and Messaging, but you aim to always redirect the conversation to their channel of choice.</li>
  <li>You want to reduce the volume of calls handled by your agents. High call volume can overwhelm agents and lead to lower call answer rates. You intend to redirect calls to Messaging to alleviate these pain points and raise consumer satisfaction (CSAT).</li>
  <li>You mostly or solely communicate with your consumers over messaging. In this case, the primary and perhaps only purpose of your voicebot is to redirect your consumers to a messaging channel.</li>
</ul>

<h4 id="consumer-experience-1">Consumer experience</h4>

<ol>
  <li>The consumer converses with the Voice bot over the Voice channel.</li>
  <li>The Voice bot uses LivePerson’s C2M system to initiate a messaging conversation with the consumer by sending them a message on the messaging channel.</li>
  <li>If the consumer replies to the message, an agent in Conversational Cloud picks up that messaging conversation. And the conversation over messaging continues.</li>
</ol>

<h4 id="notes-1">Notes</h4>

<ul>
  <li>Both the voice and messaging conversations can happen in parallel as two separate conversations. But this depends on your needs.</li>
  <li>Does your solution use summaries of ongoing and historical conversations generated by Generative AI? If so, when the transfer to messaging occurs, a summary of the voice conversation is created. <a href="https://community.liveperson.com/kb/articles/1571-conversation-copilott">Learn about automated conversation summaries.</a></li>
</ul>

<h4 id="before-you-begin-1">Before you begin</h4>

<ol>
  <li><a href="https://community.liveperson.com/kb/articles/1552-connect-to-messaging-user-guide">Learn about LivePerson’s C2M solution</a> in our Community Center. Also familiarize yourself with the <a href="connect-to-messaging-api.html">C2M API documentation</a> in our Developer Center.</li>
  <li>Request that your LivePerson account representative activate LivePerson's C2M system for your account.</li>
  <li>Request from your LivePerson account representative the credentials info (client ID and client secret) that the Transfer to Messaging credential must use. (This credential is needed to establish a secure and authorized communication channel between the Conversation Builder Voicebot and LivePerson’s C2M system.)</li>
  <li>
    <p><a href="https://community.liveperson.com/kb/articles/1552-connect-to-messaging-user-guide">Configure the C2M system in the C2M Web Tool</a>, specifically:</p>

    <ul>
      <li>Under <strong>API Handoffs</strong>, create an API handoff. This is the group of configuration settings to use when the Voicebot calls the Eligibility API.</li>
      <li>Under <strong>Settings &gt; Device Check</strong>, turn on the mobile device check that checks whether the consumer’s phone number is a landline or mobile number.</li>
      <li>Under <strong>Settings &gt; Channels</strong>, enable the messaging channels that you’ll use.</li>
      <li>Under <strong>Settings &gt; Routing</strong>, select (to enable) the skills that you’ll use.</li>
    </ul>
  </li>
</ol>

<h4 id="add-and-configure-the-transfer-to-messaging-interaction">Add and configure the Transfer to Messaging interaction</h4>

<p>In the bot, add the Transfer to Messaging integration interaction at the point in the dialog flow where you want the transfer to occur.</p>

<p><img style="width:600px" src="img/ConvoBuilder/interactions_c2m1.png" alt="The default state of the Transfer to Messaging interaction" /></p>

<h5 id="post-body">Post body</h5>

<p>The <strong>Post body</strong> is where you specify the data to include in the POST request that will be made during the Eligibility API call.</p>

<p>To specify the POST body, click <strong>+ Add JSON</strong>. This opens a window where you can enter JSON in the middle panel. To get this done quickly, we recommend that you copy and paste one of the available channel-specific templates, and then edit it to suit your needs.</p>

<p><img style="width:800px" src="img/ConvoBuilder/interactions_c2m2.png" alt="The editor in which you add the JSON and optionally copy a template as a starting point" /></p>

<p>When specifying the post body, keep the following in mind:</p>

<ul>
  <li>Include all required parameters. Info on these is available in our <a href="connect-to-messaging-api.html">C2M API documentation</a>. Use the API documentation to guide you.</li>
  <li>The templates are robust and illustrate all of the <a href="engagement-attributes.html">engagement attributes</a> that can be used. Remove what you don’t need.</li>
  <li>Use botContext and environment variables as you require. For example, typically, the consumer’s phone number will be set in a botContext variable.</li>
  <li>Ensure the JSON is well-formed.</li>
</ul>

<h5 id="credential">Credential</h5>

<p>Selecting a credential is required, as the credentials must be used to authenticate with LivePerson’s C2M system. You can select from all of your account’s credentials of type “Transfer to Messaging.”</p>

<p><a href="conversation-builder-bot-accounts-credentials.html#transfer-to-messaging">Learn how to create a Transfer to Messaging credential.</a></p>

<h5 id="next-action">Next action</h5>

<p>Build out the success and failure flows in the bot. And <a href="conversation-builder-testing-deployment-debug-the-bot.html#log-custom-events-in-the-bot">log custom events in the bot</a> along the way. This traceability can support resolving issues.</p>

<p>Once the success and failure flows are built out, specify next actions in the Transfer to Messaging interaction accordingly. There are four flows/rules you must account for:</p>

<ul>
  <li><strong>Token Failure</strong>: Typically, this failure occurs if there is something wrong with the credentials. You might want to configure this rule so that it redirects the bot flow to a dialog that sends a message like, “Oops! Something went wrong. Try again at a later time.”</li>
  <li><strong>Eligibility Failure</strong>: This failure occurs if the consumer isn’t reachable via the messaging channel. You might want to configure this rule so that it redirects the bot flow to a dialog that sends a message like, “I’m sorry. The device tied to your phone number isn’t capable of receiving a message. Do you have an alternate number we can use?” The dialog would then perform the transfer using the alternate number.</li>
  <li><strong>Invite Success</strong>: This is the success flow for the voice conversation, where the message has been sent successfully to the consumer on the messaging channel. Remember that both the voice and messaging conversations can happen in parallel as two separate conversations. But this depends on your needs. You might want to redirect the bot flow to a dialog that simply sends a message like, “We’ve just sent you a message. We’ll close this voice call now and continue over messaging. Good-bye!” The dialog would then close the voice conversation. Overall, build out the success flow however you require.</li>
  <li><strong>Invite Failure</strong>: This failure occurs if there’s already a messaging conversation open on the given channel between the consumer and an agent. You might want to configure this rule so that it redirects the bot flow to a dialog that sends a message like, “I’m sorry. We can’t send you a message at this time. Try again later.” You’ll need to support this flow with some logging, so you can know to notify your agents to close the open conversations.</li>
</ul>
]]></description>
      <!-- <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Integration Basics</title>
      <link>https://developers.liveperson.com/conversation-builder-integrations-integration-basics.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-integrations-integration-basics.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>LivePerson Conversation Builder allows users to configure API integrations that are invoked when processing a dialog. Integrations are useful for sending or receiving necessary data from other systems.</p>

<p>The Conversation Builder <a href="conversation-builder-templates-overview.html">templates</a> include common integrations. For example, the <a href="conversation-builder-templates-simple-faq.html">Simple FAQ</a> template includes a Knowledge Base integration.</p>

<p class="attn-note">Want some practice with integrations? The <a href="tutorials-get-started-with-bot-building-messaging-integrations.html">Integrations tutorial</a> provides a walkthrough of adding one. You'll need to complete the Dialogs and Patterns tutorial and the Intents tutorial first, as they build on each other.</p>

<h3 id="integration-types">Integration types</h3>

<p>An integration can be one of the following types:</p>

<ul>
  <li><img class="inlineimage" style="width:30px" alt="Icon for API integration" src="img/ConvoBuilder/icon_integration_api.png" /> <strong>API</strong>: <a href="conversation-builder-integrations-api-integrations.html">API integrations</a> allow Conversation Builder to perform some action or access the features or data of an external service. For example, you might want to retrieve information on specific items in your product catalog, so you can use that information in interactions in a dialog.</li>
  <li><img class="inlineimage" style="width:30px" alt="Icon for Email integration" src="img/ConvoBuilder/icon_integration_email.png" /> <strong>Email</strong>: Use an <a href="conversation-builder-integrations-email-integrations.html">Email integration</a> when you want Conversation Builder to send an email as the result of a bot's dialog flow. For example, if the consumer completes a survey, you might want to send a thank you email to the consumer or send the survey results to a moderator or administrator for collection.</li>
  <li><img class="inlineimage" style="width:30px" alt="Icon for KnowledgeAI integration" src="img/ConvoBuilder/icon_integration_knowledgeai.png" /> <strong>KnowledgeAI</strong>: Use a <a href="conversation-builder-integrations-knowledgeai-integrations.html">KnowledgeAI integration</a> to search a knowledge base for articles. One use case for this type of integration is within a <a href="conversation-builder-dialogs-fallback-dialogs.html">fallback dialog</a>, to funnel user utterances into a knowledge base search. If an appropriate search result is found, it can be displayed. If no results are found, you might then display a "sorry" message or transfer the conversation to a human agent.</li>
  <li><img class="inlineimage" style="width:30px" alt="Icon for LivePerson Agent Escalation integration" src="img/ConvoBuilder/icon_integration_agenttransfer.png" /> <strong>LivePerson Agent Escalation</strong>: A <a href="conversation-builder-integrations-liveperson-agent-escalation-integrations.html">LivePerson Agent Escalation integration</a> transfers the conversation to a human agent or another bot.</li>
  <li><img class="inlineimage" style="width:30px" alt="Icon for File integration" src="img/ConvoBuilder/icon_integration_fileupload.png" /> <strong>File</strong>: Use a <a href="conversation-builder-integrations-file-integrations.html">File integration</a> to take a file that was uploaded by the consumer to Conversational Cloud via a <a href="conversation-builder-interactions-integrations.html#file-upload-interactions">File Upload interaction</a> and upload it to your external file share or system.</li>
  <li><img class="inlineimage" style="width:30px" alt="Icon for LivePerson Functions integration" src="img/ConvoBuilder/icon_integration_lpfunction.png" /> <strong>LivePerson Functions (FaaS)</strong>: Use a <a href="conversation-builder-integrations-liveperson-functions-integrations.html">LivePerson Functions integration</a> to invoke a function (<code class="language-html highlighter-rouge">lambda</code>) that is deployed to the <a href="liveperson-functions-overview.html">LivePerson Functions</a> platform. There are no constraints here; if there is some custom logic (a function) you want to invoke with a bot, you can do it with this integration.</li>
</ul>

<h3 id="retrieve-service-domains">Retrieve service domains</h3>

<p>Do you need to dynamically retrieve a domain for a given service in the bot? Don’t hard code it. Conversation Builder offers a scripting function named <a href="conversation-builder-scripting-functions-get-service-domains.html#get-liveperson-service-domain">getLPDomain</a>.</p>

<h3 id="check-the-api-response-status">Check the API response status</h3>

<p>You can obtain the HTTP status code of the API response using this special variable syntax:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">statusCode</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getBotVariable</span><span class="p">(</span><span class="dl">"</span><span class="s2">api_&lt;RESPONSE DATA VARIABLE NAME OF INTEGRATION&gt;Status</span><span class="dl">"</span><span class="p">);</span>
</code></pre></div></div>

<p>So, for an API Integration with the following settings:</p>
<ul>
  <li>Integration Name = <code class="language-html highlighter-rouge">RegisterNamespace</code></li>
  <li>Response Data Variable Name = <code class="language-html highlighter-rouge">RegisterNamespace</code></li>
</ul>

<p>You would get the response status code by using the following:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">statusCode</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getBotVariable</span><span class="p">(</span><span class="dl">"</span><span class="s2">api_RegisterNamespaceStatus</span><span class="dl">"</span><span class="p">);</span>

<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">&gt;&gt;&gt; api_RegisterNamespaceStatus statusCode:</span><span class="dl">"</span> <span class="o">+</span> <span class="nx">statusCode</span><span class="p">);</span>
</code></pre></div></div>

<p>You can then check if the value matches the desired HTTP response code for successful operation and then proceed to trigger the next desired message interaction within your dialog.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="k">if</span> <span class="p">(</span><span class="nx">statusCode</span> <span class="o">===</span> <span class="mi">204</span> <span class="o">||</span> <span class="nx">statusCode</span> <span class="o">===</span> <span class="mi">201</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">&gt;&gt;&gt; api_RegisterNamespaceStatus API success</span><span class="dl">"</span><span class="p">);</span>
    <span class="nx">botContext</span><span class="p">.</span><span class="nx">setTriggerNextMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">saveContext</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
    <span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">!!! api_RegisterNamespaceStatus API failure</span><span class="dl">"</span><span class="p">);</span>
    <span class="nx">botContext</span><span class="p">.</span><span class="nx">setTriggerNextMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">sdeSender_FAILED</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<p>Typically, this block of code is placed in the <em>Post-Process Code</em> section attached to calling an API integration within a dialog.</p>

<h3 id="process-api-results">Process API results</h3>

<p>When it comes to processing the results returned from an API call, there are two ways to accomplish this:</p>

<ul>
  <li><strong>Option 1</strong> - In the Integration interaction’s Post-Process Code</li>
  <li><strong>Option 2</strong> - Via custom data fields in the integration</li>
</ul>

<p>Both are viable options, but the first option has a few advantages:</p>

<ul>
  <li>It’s easier to find bot variables in the Post-Process Code. You work with them much closer to where they were first set up.</li>
  <li>Changes made to Post-Process Code are traceable because they show up in the bot’s Change History. If you change something in the integration’s Transform Result Script, it isn’t visible in the Change History.</li>
</ul>

<h4 id="option-1-process-api-results-with-post-process-code">Option 1: Process API results with post-process code</h4>

<p>In the Integration interaction’s <strong>Post-Process Code</strong>, use the following logic:</p>

<ol>
  <li>Validate all fields in the response, for example, check for missed fields.</li>
  <li>
    <p>If you need to save the response from the API call to help with debugging later on, use <a href="conversation-builder-scripting-functions-log-debug.html#log-custom-event">logCustomEvent</a>. In our example below, we’re using a <code class="language-html highlighter-rouge">logPostApi</code> function that uses a <code class="language-html highlighter-rouge">botContext.CustomEvent(user_message, event_name, event_details)</code> function to store the full response.</p>

    <p><img class="fancyimage" width="800" src="img/ConvoBuilder/integrations_save_response_code.png" alt="Example code in the Post-Process Code panel to save the full response" /></p>
  </li>
</ol>

<p class="attn-note">Need a function here? Define it in <a href="conversation-builder-global-functions.html">Global Functions</a> and call it from the <strong>Post-Process Code</strong>. This is a best practice that allows for code reuse.</p>

<h4 id="option-2-process-api-results-with-custom-data-fields">Option 2: Process API results with custom data fields</h4>

<p>Custom data fields allow you to use key/value pairs to capture data from an API response for later use in dialogs. API variables are named in the <strong>key</strong> field, with the path to the JSON value you are saving in the <strong>value</strong> field. For the value, use the following syntax: For an API named ‘GetContext’, <code class="language-html highlighter-rouge">$.api_GetContext</code> serves as the base for the JSON path:</p>

<p><code class="language-html highlighter-rouge">{$.api_GetContext.<span class="nt">&lt;JSON_PATH&gt;</span>}</code></p>

<p><img class="fancyimage" width="400" src="img/ConvoBuilder/integrations_processAPIResults1.png" alt="Some example custom data fields" /></p>

<p>Once you have created these variables, you have access to their values within the dialogs. To do so, use curly braces notation containing the integration name with the variable name you’ve created.</p>

<p><img class="fancyimage" width="550" src="img/ConvoBuilder/integrations_processAPIResults2.png" alt="Using the values of custom data fields in an interaction" /></p>

<p>These variables are also accessible in the pre-process or post-process code editors, should you need to use their values in your bot logic:</p>

<p><code class="language-html highlighter-rouge">var firstName = botContext.getBotVariable('GetContext.firstName');</code></p>

<h5 id="iterating-through-results">Iterating through results</h5>

<p>Occasionally, you might want to iterate through the JSON data to display multiple results from an API. This can be useful when using Structured Content (or List Picker and Time Picker for Apple Messages for Business) to display multiple instances of an item a user has searched for. With this in mind, Conversation Builder has provided a way to record an API result as having an iterable value for use within dialogs. To illustrate, assume you have an API that returns items for sale and is structured in the following JSON format:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span>
 <span class="dl">"</span><span class="s2">items</span><span class="dl">"</span><span class="p">:</span> <span class="p">[</span>
   <span class="p">{</span>
     <span class="dl">"</span><span class="s2">title</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">TITLE ONE</span><span class="dl">"</span><span class="p">,</span>
     <span class="dl">"</span><span class="s2">description</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">Description 1</span><span class="dl">"</span><span class="p">,</span>
     <span class="dl">"</span><span class="s2">image</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">https://www.beautyarmy.com/wp-content/uploads/2019/12/stack.jpg</span><span class="dl">"</span>
   <span class="p">},</span>
   <span class="p">{</span>
     <span class="dl">"</span><span class="s2">title</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">TITLE TWO</span><span class="dl">"</span><span class="p">,</span>
     <span class="dl">"</span><span class="s2">description</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">Description 2</span><span class="dl">"</span><span class="p">,</span>
     <span class="dl">"</span><span class="s2">image</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">https://www.salesbabu.com/wp-content/uploads/2014/02/stock.png</span><span class="dl">"</span> <span class="nx">alt</span><span class="o">=</span><span class="dl">""</span>
   <span class="p">},</span>
   <span class="p">{</span>
     <span class="dl">"</span><span class="s2">title</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">TITLE THREE</span><span class="dl">"</span><span class="p">,</span>
     <span class="dl">"</span><span class="s2">description</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">Description 3</span><span class="dl">"</span><span class="p">,</span>
     <span class="dl">"</span><span class="s2">image</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">https://3.imimg.com/data3/QJ/UW/MY-14248082/stock-inventory-management-system-with-pos-point-of-sale-500x500.jpg</span><span class="dl">"</span>
   <span class="p">}</span>
 <span class="p">]</span>
<span class="p">}</span>
</code></pre></div></div>

<p>To capture each value to reproduce in a dialog, you need to iterate through this “items” array and save each key as an API variable. Assuming that you have an API named 'GetContent', you would use the following syntax to properly capture this data:</p>

<p><code class="language-html highlighter-rouge">{$.api_GetContent.items[i].title}</code></p>

<p>Take care to include the bracketed i in your value, as this signifies that the program needs to iterate through the “items” array to save all of the “title” values.</p>

<p><img class="fancyimage" width="400" src="img/ConvoBuilder/integrations_processAPIResults3.png" alt="Some example cusstom data fields, showing the i notation to signify an array" /></p>

<p>With these variables now set, they can be used within Structured Content interactions to display each of the titles, descriptions, and images together. Add your API variables to the relevant areas of the Structured Content tile, referencing the variables in the same way that was done in the previous example. When saved, Conversation Builder will iterate through each of the variables to display the correct content together in the user's messaging window.</p>

<p><img class="fancyimage" width="400" src="img/ConvoBuilder/integrations_processAPIResults4.png" alt="Using the custom data fields in an interaction" /></p>

<p><img class="fancyimage" width="400" src="img/ConvoBuilder/integrations_processAPIResults5.gif" alt="How the interaction renders to the consumer, iterating over the items in carousel fashion" /></p>

<h5 id="transform-an-api-result">Transform an API result</h5>

<p>You can invoke non-LivePerson APIs from Conversation Builder. With JavaScript code, you can process the responses (typically in a JSON format) and use the information within the dialogs of your bot.</p>

<p>The following screen from the API integration setup shows that you must remember to use the "Response Data Variable Name" with the “api_” prefix when it comes to <strong><em>Transform Result Script</em></strong> (the place where you manipulate the API response as you want).</p>

<p><img class="fancyimage" width="550" src="img/ConvoBuilder/bestPractices/tips_integration_setup1.png" alt="The Response Data Variable Name in an example API integration" /></p>

<p><img class="fancyimage" width="550" src="img/ConvoBuilder/bestPractices/tips_integration_setup2.png" alt="Using the Response Data Variable Name with the api prefix in code" /></p>

<ol>
  <li>
    <p>Get the raw API response and save it in a variable:</p>

    <div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code> <span class="kd">var</span> <span class="nx">getContextData</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getBotVariable</span><span class="p">(</span><span class="dl">"</span><span class="s2">api_GetContext</span><span class="dl">"</span><span class="p">);</span>
</code></pre></div>    </div>
  </li>
  <li>
    <p>Turn this into a JavaScript object, so you can access the properties:</p>

    <div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code> <span class="kd">var</span> <span class="nx">getContextJsonResponse</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">getContextData</span><span class="p">.</span><span class="nx">jsonData</span><span class="p">);</span>
</code></pre></div>    </div>

    <p>If you were to debug log the <code class="language-html highlighter-rouge">getContextJsonResponse</code>, this would give you an object such as:</p>

    <div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="w"> </span><span class="p">{</span><span class="w">
     </span><span class="nl">"api_GetContext"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
         </span><span class="nl">"_id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"5d15f436966b92b943be9219"</span><span class="p">,</span><span class="w">
         </span><span class="nl">"index"</span><span class="p">:</span><span class="w"> </span><span class="mi">5</span><span class="p">,</span><span class="w">
         </span><span class="nl">"guid"</span><span class="p">:</span><span class="w"> </span><span class="s2">"4f60a28d-3eae-4f2d-abd2-184931b57c6e"</span><span class="p">,</span><span class="w">
         </span><span class="nl">"isActive"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
         </span><span class="nl">"balance"</span><span class="p">:</span><span class="w"> </span><span class="s2">"$1,023.36"</span><span class="p">,</span><span class="w">
         </span><span class="nl">"picture"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://placehold.it/32x32"</span><span class="p">,</span><span class="w">
         </span><span class="nl">"age"</span><span class="p">:</span><span class="w"> </span><span class="mi">23</span><span class="p">,</span><span class="w">
         </span><span class="nl">"eyeColor"</span><span class="p">:</span><span class="w"> </span><span class="s2">"blue"</span><span class="p">,</span><span class="w">
         </span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
             </span><span class="nl">"first"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Moon"</span><span class="p">,</span><span class="w">
             </span><span class="nl">"last"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Petty"</span><span class="w">
         </span><span class="p">},</span><span class="w">
         </span><span class="nl">"company"</span><span class="p">:</span><span class="w"> </span><span class="s2">"KONGENE"</span><span class="p">,</span><span class="w">
         </span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"moon.petty@kongene.ca"</span><span class="p">,</span><span class="w">
         </span><span class="nl">"phone"</span><span class="p">:</span><span class="w"> </span><span class="s2">"+1 (962) 489-3119"</span><span class="w">
     </span><span class="p">}</span><span class="w">
 </span><span class="p">}</span><span class="w">
</span></code></pre></div>    </div>

    <p class="attn-note">The first property of that object is named <code class="language-html highlighter-rouge">api_GetContext</code>, so adjust this with whatever the name you gave to your Bot Response Variable when defining the integration and append to the “<strong>api_</strong>” prefix.</p>
  </li>
  <li>
    <p>Clean the JSON.</p>

    <p>To access the actual JSON from your response, you would need to perform one more extraction like this to make it easier to reference:</p>

    <div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code> <span class="kd">var</span> <span class="nx">jsonResponse</span> <span class="o">=</span> <span class="nx">getContextJsonResponse</span><span class="p">.</span><span class="nx">api_GetContext</span><span class="p">;</span>
</code></pre></div>    </div>

    <p>Where <code class="language-html highlighter-rouge">jsonResponse</code> would now be:</p>

    <div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="w"> </span><span class="p">{</span><span class="w">
     </span><span class="nl">"_id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"5d15f436966b92b943be9219"</span><span class="p">,</span><span class="w">
     </span><span class="nl">"index"</span><span class="p">:</span><span class="w"> </span><span class="mi">5</span><span class="p">,</span><span class="w">
     </span><span class="nl">"guid"</span><span class="p">:</span><span class="w"> </span><span class="s2">"4f60a28d-3eae-4f2d-abd2-184931b57c6e"</span><span class="p">,</span><span class="w">
     </span><span class="nl">"isActive"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
     </span><span class="nl">"balance"</span><span class="p">:</span><span class="w"> </span><span class="s2">"$1,023.36"</span><span class="p">,</span><span class="w">
     </span><span class="nl">"picture"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://placehold.it/32x32"</span><span class="p">,</span><span class="w">
     </span><span class="nl">"age"</span><span class="p">:</span><span class="w"> </span><span class="mi">23</span><span class="p">,</span><span class="w">
     </span><span class="nl">"eyeColor"</span><span class="p">:</span><span class="w"> </span><span class="s2">"blue"</span><span class="p">,</span><span class="w">
     </span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
         </span><span class="nl">"first"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Moon"</span><span class="p">,</span><span class="w">
         </span><span class="nl">"last"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Petty"</span><span class="w">
     </span><span class="p">},</span><span class="w">
     </span><span class="nl">"company"</span><span class="p">:</span><span class="w"> </span><span class="s2">"KONGENE"</span><span class="p">,</span><span class="w">
     </span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"moon.petty@kongene.ca"</span><span class="p">,</span><span class="w">
     </span><span class="nl">"phone"</span><span class="p">:</span><span class="w"> </span><span class="s2">"+1 (962) 489-3119"</span><span class="w">
 </span><span class="p">}</span><span class="w">
</span></code></pre></div>    </div>
  </li>
  <li>
    <p>Extract the key/value pairs from the JSON-format response and create bot-level variables as required.</p>

    <p>This means you can now access the various properties directly via these lines of code:</p>

    <div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code> <span class="kd">var</span> <span class="nx">company</span> <span class="o">=</span> <span class="nx">jsonResponse</span><span class="p">.</span><span class="nx">company</span><span class="p">;</span>
 <span class="kd">var</span> <span class="nx">guid</span> <span class="o">=</span> <span class="nx">jsonResponse</span><span class="p">.</span><span class="nx">guid</span> <span class="o">||</span> <span class="kc">false</span><span class="p">;</span>
 <span class="kd">var</span> <span class="nx">age</span> <span class="o">=</span> <span class="nx">jsonResponse</span><span class="p">.</span><span class="nx">age</span> <span class="o">||</span> <span class="kc">false</span><span class="p">;</span>
 <span class="kd">var</span> <span class="nx">email</span> <span class="o">=</span> <span class="nx">jsonResponse</span><span class="p">.</span><span class="nx">email</span> <span class="o">||</span> <span class="kc">false</span><span class="p">;</span>
</code></pre></div>    </div>

    <p>The <code class="language-html highlighter-rouge">|| false</code> construction means if the requested value does not exist, we will return false. This allows us to easily check later on if this was populated. (You could also use <strong>null</strong> in place of false if you prefer, as that is a <strong>FALSE</strong> value within JavaScript when it comes to conditional comparisons.)</p>
  </li>
  <li>
    <p>Set bot-level variables using those values and output them within a text interaction:</p>
  </li>
</ol>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="dl">"</span><span class="s2">guid</span><span class="dl">"</span><span class="p">,</span> <span class="nx">guid</span><span class="p">,</span> <span class="kc">true</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="dl">"</span><span class="s2">age</span><span class="dl">"</span><span class="p">,</span> <span class="nx">age</span><span class="p">,</span> <span class="kc">true</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="dl">"</span><span class="s2">email</span><span class="dl">"</span><span class="p">,</span> <span class="nx">email</span><span class="p">,</span> <span class="kc">true</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">*** checking values were set: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">guid</span> <span class="o">+</span> <span class="nx">age</span> <span class="o">+</span> <span class="nx">email</span><span class="p">);</span>
</code></pre></div></div>

<p><img class="fancyimage" width="600" src="img/ConvoBuilder/bestPractices/tips_image_40.png" alt="Using the values of bot-level variables in a Statement interaction" /></p>

<h3 id="delete-an-integration">Delete an integration</h3>

<p>If the bot is no longer using a particular integration, you might want to delete the integration. Before doing so, make sure there are no integration interactions that reference the specific integration.</p>

<p>Deleting an integration affects only the bot for which it was added.</p>

<p><strong>To delete an integration</strong></p>

<ol>
  <li>Open the bot, and click <strong>Integrations</strong> in the upper-left corner.</li>
  <li>In the left panel, move your mouse over the integration name, and click the <img style="width:25px" src="img/ConvoBuilder/icon_ellipsis.png" alt="Three-dot icon" /> icon that appears.</li>
  <li>Click <strong>Delete Integration</strong>, and then click <strong>Yes</strong> in the confirmation dialog.</li>
</ol>
]]></description>
      <!-- <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Get Service Domains</title>
      <link>https://developers.liveperson.com/conversation-builder-scripting-functions-get-service-domains.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-scripting-functions-get-service-domains.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="get-liveperson-service-domain">Get LivePerson service domain</h3>

<p>Use the <code class="language-html highlighter-rouge">getLPDomain</code> function in a bot to dynamically retrieve the base URI for a given service.</p>

<p>Internally, this function makes a call to LivePerson’s <a href="domain-api.html">Domain API</a>. Within a bot, you can’t call that API directly, so we offer this scripting function. Take advantage of it to avoid hard coding domains.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">getLPDomain(serviceName)</code></td>
      <td><em>serviceName</em> - The name of the service. You can find service names in the relevant documentation for the API. Alternatively, retrieve the service name using the <a href="domain-api.html#domain-retrieval-tool">Domain Retrieval Tool</a>.</td>
      <td>String representing the base URI for the provided service</td>
    </tr>
  </tbody>
</table>

<h4 id="best-practices">Best practices</h4>

<ul>
  <li>Always check the output for null values and empty strings. While the call is retried, it’s still an external call that might fail.</li>
  <li>Never hard code a domain in your code; always retrieve it dynamically because the domains can change.</li>
</ul>

<h4 id="example">Example</h4>

<p>The following code example retrieves the base URI for the “msgHistory” service for your account.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">let</span> <span class="nx">msgHistoryDomain</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getLPDomain</span><span class="p">(</span><span class="dl">"</span><span class="s2">msgHistory</span><span class="dl">"</span><span class="p">);</span> <span class="c1">//Example result - va-a.msghist.liveperson.net </span>

<span class="k">if</span><span class="p">(</span><span class="nx">msgHistoryDomain</span><span class="p">){</span>   <span class="c1">//Ensures value is present, is not null and not emtpy string</span>
	<span class="c1">//Save it to bot variable or use it according to bot developer's use case</span>
	<span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="err">“</span><span class="nx">msgHistoryDomain</span><span class="err">”</span><span class="p">,</span> <span class="nx">msgHistoryDomain</span><span class="p">,</span> <span class="kc">true</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>
]]></description>
      <!-- <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Domain API</title>
      <link>https://developers.liveperson.com/domain-api.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/domain-api.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>A read-only API that returns the base domain of LivePerson and used in the LivePerson APIs.</p>

<h3 id="domain-retrieval-tool">Domain Retrieval Tool</h3>

<p>Instead of using the API below yourself, you can use the following tool to retrieve <strong>all</strong> service names and their respective base URIs. This is useful if you need those URIs as a point of reference or debugging. You should not hardcode any domains retrieved from this in your code, but should instead perform a lookup using the Domain API dynamically since these values may change.</p>

<p>To use the tool, simply input your account number below and hit the button.</p>

<p><input type="text" id="account" placeholder="Type your account number here" />
<input type="button" id="csds-button" value="Get Base URIs" /></p>
<table id="csds-result"></table>

<p class="attn-alert">The different service names can be found in the relevant documentation for the API you're looking to use. They can be found in each document's Overview page. Service names are <em>case-sensitive</em>. Please make sure to input serviceName as it is provided in each document's overview.</p>

<h3 id="request">Request</h3>

<p>The GET method used returns the base URI for the specified account ID and serviceName.</p>

<table>
  <thead>
    <tr>
      <th style="text-align: left">Method</th>
      <th style="text-align: left">URL</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left">GET</td>
      <td style="text-align: left">https://api.liveperson.net/api/account/{accountId}/service/{serviceName}/baseURI.json?version=1.0</td>
    </tr>
  </tbody>
</table>

<p><strong>URL Parameters</strong></p>

<table>
  <thead>
    <tr>
      <th style="text-align: left">Name</th>
      <th style="text-align: left">Description</th>
      <th style="text-align: left">Type/Value</th>
      <th style="text-align: left">Required</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left">account</td>
      <td style="text-align: left">LivePerson account ID</td>
      <td style="text-align: left">string</td>
      <td style="text-align: left">Required</td>
    </tr>
    <tr>
      <td style="text-align: left">service</td>
      <td style="text-align: left">Service name according to the relevant API</td>
      <td style="text-align: left">string</td>
      <td style="text-align: left">Required</td>
    </tr>
  </tbody>
</table>

<h3 id="response">Response</h3>

<p>JSON example:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"baseURIs"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
    </span><span class="p">{</span><span class="w">
      </span><span class="nl">"service"</span><span class="p">:</span><span class="w"> </span><span class="s2">"liveEngageUI"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"account"</span><span class="p">:</span><span class="w"> </span><span class="s2">"EXAMPLE123"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"baseURI"</span><span class="p">:</span><span class="w"> </span><span class="s2">"lo.le1.liveperson.net"</span><span class="w">
    </span><span class="p">},</span><span class="w">
    </span><span class="p">{</span><span class="w">
      </span><span class="nl">"service"</span><span class="p">:</span><span class="w"> </span><span class="s2">"visitorFeed"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"account"</span><span class="p">:</span><span class="w"> </span><span class="s2">"EXAMPLE123"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"baseURI"</span><span class="p">:</span><span class="w"> </span><span class="s2">"lo.v-feed.liveperson.net"</span><span class="w">
    </span><span class="p">},</span><span class="w">
    </span><span class="p">{</span><span class="w">
      </span><span class="nl">"service"</span><span class="p">:</span><span class="w"> </span><span class="s2">"etool"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"account"</span><span class="p">:</span><span class="w"> </span><span class="s2">"EXAMPLE123"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"baseURI"</span><span class="p">:</span><span class="w"> </span><span class="s2">"z2.etool.liveperson.net"</span><span class="w">
    </span><span class="p">}</span><span class="w">
  </span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="optional-response-status-codes">Optional response status codes</h4>

<table>
  <thead>
    <tr>
      <th style="text-align: left">Status</th>
      <th style="text-align: left">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left">200 OK</td>
      <td style="text-align: left">Successfully retrieved the data</td>
    </tr>
    <tr>
      <td style="text-align: left">400 Bad Request</td>
      <td style="text-align: left">Problem with body or query parameters</td>
    </tr>
    <tr>
      <td style="text-align: left">401 Unauthorized</td>
      <td style="text-align: left">Bad authentication (invalid site or agent)</td>
    </tr>
  </tbody>
</table>

<h3 id="retrieving-domains-in-liveperson-bots">Retrieving domains in LivePerson bots</h3>

<p>Are you building a LivePerson Conversation Builder bot? Do you need to dynamically retrieve a domain for a given service in the bot? Don’t hard code it. Conversation Builder offers a scripting function named <a href="conversation-builder-scripting-functions-get-service-domains.html#get-liveperson-service-domain">getLPDomain</a>.</p>
]]></description>
      <!-- <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>API Integrations</title>
      <link>https://developers.liveperson.com/conversation-builder-integrations-api-integrations.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-integrations-api-integrations.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>API Integrations allow LivePerson Conversation Builder to perform some action or access the features or data of an external service. For example, you might want to retrieve information on specific items in your product catalog, so you can use that information in interactions in a dialog.</p>

<p>For practice at using an API integration, try the <a href="tutorials-get-started-with-bot-building-messaging-integrations.html">Integrations tutorial</a>. (You’ll need to complete the Dialogs &amp; Patterns tutorial and the Intents tutorial first, as the tutorials build on each other.)</p>

<p class="attn-note">An API integration call times out in 20 seconds; within that time, the integration attempts 3 retries. This isn’t configurable.</p>

<h3 id="api-integrations-versus-liveperson-functions">API integrations versus LivePerson Functions</h3>

<p>Use the following as guidance for when to use an API integration or a <a href="liveperson-functions-overview.html">LivePerson function</a>.</p>

<p>Leverage Conversation Builder integrations for:</p>

<ul>
  <li>A single, straightforward API call</li>
  <li>A short sequence of simple API calls</li>
</ul>

<p>Leverage <a href="liveperson-functions-overview.html">LivePerson functions</a> for:</p>

<ul>
  <li>The same API request from multiple bots</li>
  <li>Multiple API requests that are needed simultaneously (Example: You need to retrieve five items (products, etc.) and show them to the consumer.)</li>
  <li>Multiple, consecutive API requests (Example: You need to get a JSON web token (JWT), then use the token to get the consumer's profile, and finally update the consumer's profile.)</li>
  <li>When you need to always have actual data (Example: JWT has a two-hour TTL. Instead of making an API call for JWT every time you need it, schedule a LivePerson function to update the JWT every two hours.)</li>
  <li>An action that is needed in response to an event (Example: React to an Idle event by closing the conversation.)</li>
</ul>

<h3 id="dependencies">Dependencies</h3>

<ul>
  <li>An integration requires a REST-based web service or API.</li>
  <li>An integration requires a response format that's XML/JSON-compliant.</li>
  <li>If you have <a href="https://community.liveperson.com/kb/articles/1321-ip-restriction">IP restrictions</a> in place, you'll need to do some <a href="conversation-builder-networking-security.html">whitelisting</a> before adding an API integration. This is so Conversation Builder can make calls to your brand's systems and vice versa.</li>
</ul>

<h3 id="best-practices">Best practices</h3>

<ul>
  <li>Define an integration only once in the bot. If it’s called from different places in the bot, handle this dynamically using bot variables (for example, pass a needed skill dynamically). This leads to a more streamlined bot with fewer integrations.</li>
  <li>Set the URL, headers, query parameters, the payload for POST and PUT API calls, etc. using <a href="conversation-builder-variables-slots-the-basics.html">variables</a> and <a href="conversation-builder-environment-variables.html">environment variables</a> that you’ve created.</li>
</ul>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/integrations_api_setwithvariables2.png" alt="Another example configuration where variables and environment variables are used to specify values" /></p>

<ul>
  <li>For optimal performance, store only access tokens that are 5 KB or smaller in variables. You can store larger tokens, but expect some latency in the API calls.</li>
  <li>Always perform a lookup of a LivePerson service domain using the <a href="domain-api.html">Domain API</a> dynamically. Then set the value in a variable or an environment variable, and reference the variable where needed (e.g., request URL). Don’t hard code the service domain. The value can change, although this happens infrequently.</li>
  <li>In the <strong>Data Sources &gt; API</strong> area of Conversational Cloud, add permissions for the bot token to make API calls to the external service.</li>
</ul>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/integrations_api_addpermissionsforbottoken.png" alt="Setting permissions for the bot token to make API calls to external service" /></p>

<h4 id="security-best-practices">Security best practices</h4>

<ul>
  <li><strong>URLs</strong> and <strong>URL parameters</strong>: HTTPS and HTTP are supported. Don’t send credentials or sensitive data in the parameters.</li>
  <li><strong>Credentials</strong>: Use a secure form of authentication and authorization. OAuth is recommended. <a href="conversation-builder-bot-accounts-credentials.html">Learn more about credentials.</a></li>
  <li><strong>API</strong>: Your brand’s API should be designed according to security standards. For example, at a minimum, use an authentication mechanism. Also provide support for other best practices, such as protecting the API from high volume and bursts in traffic.</li>
  <li><strong>API response handling</strong>: For security and privacy reasons, you must not log returned customer data using the JavaScript API or store the data in permanent variables.</li>
</ul>

<h3 id="retrieve-service-domains">Retrieve service domains</h3>

<p>Do you need to dynamically retrieve a domain for a given service in the bot? Don’t hard code it. Conversation Builder offers a scripting function named <a href="conversation-builder-scripting-functions-get-service-domains.html#get-liveperson-service-domain">getLPDomain</a>.</p>

<h3 id="add-an-api-integration">Add an API integration</h3>

<p class="attn-note">Before adding an API integration, review the <a href="conversation-builder-integrations-api-integrations.html#best-practices">best practices</a> above.</p>

<ol>
  <li>Open the bot, and click <strong>Integrations</strong> in the upper-left corner.</li>
  <li>Configure the integration settings (required fields are marked with asterisks):
    <ul>
      <li><strong>Integration Name</strong>: Enter the name of integration. Enter a name that's meaningful (it describes well the integration's purpose), concise, and follows a consistent pattern. This helps with organization, and it makes it easier for bot developers to work with the integration during bot development.</li>
      <li><strong>Response Data Variable Name</strong>: Enter the name of the variable that gets populated with the response from the API.</li>
      <li><strong>Integration Type</strong>: Select <strong>API</strong>.</li>
      <li><strong>Method</strong>: Select the type of HTTP request method.</li>
      <li><strong>URL</strong>: Enter the request target, the URL. You might want to pass variable values via the URL, like so:</li>
    </ul>

    <p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/integrations_api_url.png" alt="The URL field in the integration settings" /></p>

    <ul>
      <li><strong>Credential</strong>: Select the <a href="conversation-builder-bot-accounts-credentials.html">credential</a> to use for authentication if applicable. The bot will automatically enhance the request based on the credential's type and data.</li>
      <li><strong>Request Headers — Use default headers</strong>: When this toggle is on, the following request headers are included automatically in the API request:
        <ul>
          <li>Accept: application/json;charset=UTF-8</li>
          <li>Content-Type: application/json;charset=UTF-8</li>
        </ul>

        <p>Since these headers are commonly used, the toggle is on by default as a convenience. However, you can use different values if required by your API: Just turn off the toggle, and add the headers manually as key/value pairs.</p>
      </li>
      <li><strong>Request Headers — key/value pairs</strong>: Add any message headers to include in the request.</li>
      <li><strong>Request Parameters</strong>: Add the request parameters to pass in the URL’s query string. It's more common to pass variable values as key/value pairs added here:</li>
    </ul>

    <p><img class="fancyimage" style="width:500px" src="img/ConvoBuilder/integrations_api_request_parameters.png" alt="An example of specifying a request parameter" /></p>

    <ul>
      <li><strong>Post Body</strong>: Enter the payload to send. You can also pass variable values using the post body, by writing them in JSON here:</li>
    </ul>

    <p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/integrations_api_post_body.png" alt="An example of passing variable values using the post body" /></p>

    <p>Overall, the Post Body must be an object or bot variable that’s saved via JSON.stringify(payload).</p>

    <p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/integrations_api_post_body2.png" alt="Another example of passing variable values using the post body" /></p>

    <ul>
      <li><strong>Transform Result Script</strong>: If applicable, use this section to write JavaScript code that <a href="conversation-builder-integrations-integration-basics.html#process-api-results">transforms the raw result</a> (typically in JSON format), so you can use the information in the bot's dialog.</li>
      <li><strong>Custom Data Fields</strong>: Add <a href="conversation-builder-integrations-integration-basics.html#process-api-results-with-custom-data-fields">the fields</a> that will store the result data in key/value pairs. Users who are tasked with creating bots can use and display this data in interactions by referencing these fields.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="handling-api-responses">Handling API responses</h3>

<p>In the <a href="conversation-builder-interactions-integrations.html#integration-interactions">Integration interaction</a> that invokes the API, you can define custom rules based on the result of the API call, i.e., its success or failure. <a href="conversation-builder-interactions-integrations.html#defining-rules-based-on-the-result-of-the-api-integration">This is done using the "API Result" match type</a>.</p>

<p>In the case of a failure response (a returned status code other than 200 or 201), the bot sends a default error message of, "Sorry, I could not find anything for that." To override this message and send a different one, define a custom rule based on a failure result, as mentioned above.</p>

<p>Be aware that the API's response of success or failure only indicates whether the request was successfully received and processed. It doesn't indicate whether any results were returned. To determine this, you'll need to use JavaScript in the Post-Process Code of the Integration interaction to check for any results. You can then direct the conversation flow accordingly, for example:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">count</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getBotVariable</span><span class="p">(</span><span class="dl">"</span><span class="s2">FAQS.article.count</span><span class="dl">"</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="nx">count</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">){</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">setTriggerNextMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">No Articles Found</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span><span class="k">else</span><span class="p">{</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">setTriggerNextMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">Display Article</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<h3 id="disabling-the-predefined-request-header-fields-legacy">Disabling the predefined request header fields (legacy)</h3>

<p class="attn-deprecation">This section discusses a legacy approach to disabling the predefined request headers in an API integration. The approach requires a bit of JavaScript code. But there's a simpler way: In the API integration, simply disable the <strong>Use default headers</strong> toggle. For more on this toggle, see "Add an API integration" farther above.</p>

<p>As a convenience, the following request header fields are predefined for an API integration:</p>

<ul>
  <li>Accept: application/json;charset=UTF-8</li>
  <li>Content-Type: application/json;charset=UTF-8</li>
</ul>

<p>Since the values are predefined, they're always used regardless of how you've configured the integration. However, if desired, you can disable these predefined header fields in order to use different values. To disable them for only the current request, use the following Pre-Process Code in the Integration interaction:</p>

<p><code class="language-html highlighter-rouge">botContext.setBotVariable("__standardHeaders__", "off", false, false);</code></p>

<p>To disable them for the current session, use:</p>

<p><code class="language-html highlighter-rouge">botContext.setBotVariable("__standardHeaders__", "off", true, false);</code></p>

<h3 id="troubleshooting">Troubleshooting</h3>

<h4 id="messages-before-the-api-integration-interaction-arent-being-sent">Messages before the API integration interaction aren’t being sent</h4>

<p>Once a dialog is triggered, the execution of the interactions therein is almost simultaneous. To ensure each interaction is processed (in order) as expected, add a small message delay to each interaction. <a href="conversation-builder-interactions-configuration-settings.html#basic-settings">Learn more.</a></p>
]]></description>
      <!-- <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Alerting</title>
      <link>https://developers.liveperson.com/liveperson-functions-v2-features-alerting.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/liveperson-functions-v2-features-alerting.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>The LivePerson Functions Alerting feature helps you monitor your functions and improves visibility into the platform. It allows you to configure alerts based on metrics like the number of function errors or the average response time. When a configured threshold is crossed, the system sends an email to predefined recipients.</p>

<h3 id="creating-an-alert">Creating an alert</h3>

<p>You can manage alerts from the <strong>Alerting</strong> tab within your function's detail view. To begin, click <strong>Create an alert</strong>.</p>

<p><img class="fancyimage" alt="Functions: Creating a new alert" src="img/functions/functions_v2_alerting_create_alert.png" /></p>

<p>On the "Create a new Alert" page, you first select a function to monitor. Once selected, you can configure the specific metrics and conditions for the alert.</p>

<h3 id="alert-configuration-properties">Alert configuration properties</h3>

<table>
  <thead>
    <tr>
      <th style="text-align: left">Property</th>
      <th style="text-align: left">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left"><strong>Alert Name</strong></td>
      <td style="text-align: left">A descriptive name for your alert to distinguish it from others.</td>
    </tr>
    <tr>
      <td style="text-align: left"><strong>Metric to be monitored</strong></td>
      <td style="text-align: left">The metric that will be evaluated. See the "Types of Metrics" section below for more details.</td>
    </tr>
    <tr>
      <td style="text-align: left"><strong>Operator</strong></td>
      <td style="text-align: left">The comparison operator — for example, <code class="language-html highlighter-rouge">Greater than or equal</code> or <code class="language-html highlighter-rouge">Less than</code> — used to evaluate the metric against the threshold.</td>
    </tr>
    <tr>
      <td style="text-align: left"><strong>Error Threshold</strong></td>
      <td style="text-align: left">The value that the metric is compared against. For a <strong>Function Response Delay</strong> alert, this value must be between 1 and 30. For all other metrics, it must be between 1 and 999.</td>
    </tr>
    <tr>
      <td style="text-align: left"><strong>Error Timeframe (minutes)</strong></td>
      <td style="text-align: left">The time window in which the metric is measured. This can be between 10 and 60 minutes.</td>
    </tr>
    <tr>
      <td style="text-align: left"><strong>Alert Recipients</strong></td>
      <td style="text-align: left">A list of email addresses that will receive a notification when the alert is triggered.</td>
    </tr>
  </tbody>
</table>

<h3 id="types-of-metrics">Types of metrics</h3>

<table>
  <thead>
    <tr>
      <th style="text-align: left">Metric</th>
      <th style="text-align: left">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left"><strong>Function Error</strong></td>
      <td style="text-align: left">Triggers based on the number of failed invocations where the function's code returned an error. This does not include timeout errors.</td>
    </tr>
    <tr>
      <td style="text-align: left"><strong>Function Timeout Error</strong></td>
      <td style="text-align: left">Triggers based on the number of function timeout errors.</td>
    </tr>
    <tr>
      <td style="text-align: left"><strong>Function Response Delay</strong></td>
      <td style="text-align: left">Triggers based on the average response time of successful invocations. Functions that time out are not included in this metric.</td>
    </tr>
  </tbody>
</table>

<h3 id="evaluation">Evaluation</h3>

<p>Configured alerts are evaluated periodically. An alert is triggered if the evaluation determines that the metric has crossed the configured threshold within the specified timeframe — for example, if the number of errors is greater than the threshold in the last 10 minutes. Each time an alert is triggered, an email is sent to the predefined recipients.</p>

<p class="attn-alert">If there are no invocations for the function, or if the number of errors is 0, an alert will not be triggered. For example, an alert configured to fire when errors are <code class="language-html highlighter-rouge">Less than 5</code> will not fire if there are no errors at all.</p>

<h3 id="alert-history">Alert history</h3>

<p>You can find the history of triggered alerts on the <strong>Alerting</strong> tab by clicking on a configured alert's name.</p>

<h3 id="limitations">Limitations</h3>

<ul>
  <li>You can configure a maximum of 3 alerts per function.</li>
  <li>You can create a maximum of 50 alerts in total for your account.</li>
</ul>
]]></description>
      <!-- <pubDate>Thu, 08 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Intents</title>
      <link>https://developers.liveperson.com/intent-manager-build-intents.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/intent-manager-build-intents.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="whats-an-intent">What's an intent?</h3>

<p>An <a href="(intent-manager-key-terms-concepts.html#intents)">intent</a> is a consumer request for action or information from your brand.</p>

<p class="attn-note">For some practice with intents, complete the <a href="tutorials-get-started-with-bot-building-messaging-intents.html">Getting Started with Bot Building</a> tutorial series.</p>

<h3 id="import-a-batch-of-intents">Import a batch of intents</h3>

<p>You can <a href="intent-manager-build-domains.html#add-a-domain-manually-or-using-an-import-file">create a domain using an import file</a> that contains a set of intents.</p>

<h3 id="add-an-intent">Add an intent</h3>

<ol>
  <li><a href="intent-manager-overview.html#access-intent-manager">Access Intent Manager</a>.</li>
  <li>Locate the domain list in the Intent Manager dashboard.</li>
  <li>Select the name of the relevant domain, and then select <strong>Build</strong> from the menu that appears.</li>
  <li>On the <strong>Intents</strong> page, click <strong>Add Intent</strong> in the upper-right corner.</li>
  <li>
    <p>Specify the following:</p>

    <ul>
      <li><strong>Intent Name</strong>: Enter the intent name. To name an intent, use a short phrase that describes the intent. Typically, an intent name has both a verb and a noun (e.g., "report login problem"). A domain can have dozens of intents, so using a standard naming convention is important for being able to easily sort and find intents.</li>
      <li><strong>Intent Display Name</strong>: Enter the display name.</li>
      <li><strong>Description</strong>: Enter a short phrase or a few sentences describing the intent. While this field is optional, it's often useful. Many intent names can be technical. A description adds clarity and is particularly helpful to a person not familiar with the domain.</li>
      <li><strong>Intent Type</strong>: Select either "Intent" or "<a href="(intent-manager-key-terms-concepts.html#meta-intents)">Meta Intent</a>."</li>
      <li><strong>Training</strong>: Enter as many training phrases as possible, keeping in mind <a href="intent-manager-best-practices.html#training-phrases">these best practices</a>. The NLU engine uses the training phrases in order to match a user's utterance with an intent. The more training phrases you include, the more likely it is that the NLU engine will accurately match the user's intent. Generally speaking, the phrases should be complete sentences (not long paragraphs, and not keywords). As an example, assume you have a "Check bill" intent. You might add the following training phrases, among others:
        <ul>
          <li>I want to check the status of my bill</li>
          <li>Tell me what my bill is</li>
          <li>I need to look into what's going with my bill</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
  <li>Train the domain so that the addition is reflected in a new model version.</li>
</ol>

<h3 id="generate-training-phrases-via-generative-ai">Generate training phrases via Generative AI</h3>

<p>Adding training phrases to an intent can sometimes be a challenge, so Intent Manager includes an AI-powered tool to help with this. Within an intent, describe the subject of the training phrases as the input, and the tool automatically generates additional phrases using <a href="https://community.liveperson.com/kb/articles/1501-trustworthy-generative-ai-for-the-enterprise">Generative AI</a>.</p>

<h4 id="use-cases">Use cases</h4>

<ul>
  <li>You’ve mined your Production data for consumer messages that can be used as training phrases for an intent, but you only found a few that are suitable. So, you’re looking for more ways that a consumer could express the same intent.</li>
  <li>You’re building out a LivePerson or third-party NLU domain that you’ve created from scratch.</li>
  <li>You’ve <a href="intent-manager-natural-language-understanding-liveperson-nlu-engine.html#convert-a-liveperson-legacy-domain-to-liveperson">converted a LivePerson (Legacy) NLU domain to the LivePerson engine</a>, and now you need to increase the number of training phrases to meet the minimum requirements.</li>
</ul>

<h4 id="important-notes">Important notes</h4>

<p>This LLM-powered feature is only available for <strong>English-language domains</strong>.</p>

<h4 id="before-you-begin">Before you begin</h4>

<ol>
  <li>You must <a href="https://community.liveperson.com/kb/articles/1502-get-started-with-our-solution#activate-the-generative-ai-features">activate this Generative AI feature</a>.</li>
  <li>If the intent already has some existing training phrases, we recommend you review them before you generate phrases with our AI-powered tool. As per our <a href="intent-manager-best-practices.html#training-phrases">best practices</a>, ensure they don’t include sensitive info like consumer names or other identifiers. This is because existing training phrases are sent to the LLM (which exists outside of LivePerson’s servers) as examples.</li>
</ol>

<h4 id="watch-the-1-minute-video">Watch the 1-minute video</h4>

<iframe src="https://player.vimeo.com/video/1077413720?h=8c977d2c21" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<h4 id="generate-training-phrases-with-ai">Generate training phrases with AI</h4>

<ol>
  <li><a href="intent-manager-overview.html#access-intent-manager">Access Intent Manager.</a></li>
  <li>Locate the domain list in the Intent Manager dashboard.</li>
  <li>Select the name of the relevant domain, and then select <strong>Build</strong> from the menu that appears.</li>
  <li>On the <strong>Intents</strong> page, select the intent.</li>
  <li>
    <p>Above the existing training phrases, click <strong>Generate</strong>.</p>

    <p><img style="width:400px" src="img/ConvoBuilder/genai_genphrases1.png" alt="The Generate button in the UI" /></p>
  </li>
  <li>
    <p>Enter the following info:</p>

    <p><img style="width:700px" src="img/ConvoBuilder/genai_genphrases2.png" alt="The Generate phrases with AI dialog in which you enter info" /></p>

    <p><strong>Topic</strong>: Required. The topic describes the subject of the training phrases (max 375 words). It helps the model understand what type of response is expected and guides its decision-making process. Remember to write the topic from the perspective of the consumer, not the agent.</p>

    <p>If the intent already has a description, we will use the intent description and trim it to generate a topic for you for the first time. You can also edit the topic. We’ll save the topic for reuse.</p>

    <p>Here are a few examples of good topics:</p>

    <table>
      <thead>
        <tr>
          <th>Industry</th>
          <th>Intent</th>
          <th>Example topic</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Airline</td>
          <td>Cancel flight</td>
          <td>Any request or intention to cancel a previously scheduled flight reservation. This can be due to a change in travel plans or unforeseen circumstances that make the trip impossible or impractical.</td>
        </tr>
        <tr>
          <td>Retail</td>
          <td>Check order status</td>
          <td>A consumer inquiry into an order that has already been purchased. Status updates may include the status of replacements, tracking a shipment, or questions concerning the delivery date.</td>
        </tr>
        <tr>
          <td>Telco</td>
          <td>Activate device</td>
          <td>A consumer request to activate their phone, modem, or any other electronic device that requires activation.</td>
        </tr>
        <tr>
          <td>Finance</td>
          <td>Check balance</td>
          <td>Any consumer request for information related to their account balance or credit card balance.</td>
        </tr>
      </tbody>
    </table>

    <p><strong>Guidance</strong>: Optional. Guidance is additional instructions to use when generating phrases (max 375 words). Add details that aren’t present in the topic, e.g., your brand’s name, product or service descriptions, phrases to include or exclude (examples: “don’t start with a greeting,” “reason for booking is a family emergency”), suggestions on tone (examples: “be polite,” “express frustration”), etc. Remember to write the guidance from the perspective of the consumer, not the agent.</p>

    <p>Here are a few examples of good guidance:</p>

    <table>
      <thead>
        <tr>
          <th>Industry</th>
          <th>Intent</th>
          <th>Example guidance</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Airline</td>
          <td>Cancel flight</td>
          <td>Canceling a flight due to family emergency or work obligation. Customer is apologetic.</td>
        </tr>
        <tr>
          <td>Retail</td>
          <td>Check order status</td>
          <td>The company is Acme Hardware. Departments in the business include gardening, lighting, and paint. Customer is impatient but kind.</td>
        </tr>
        <tr>
          <td>Telco</td>
          <td>Activate device</td>
          <td>Don’t start with a greeting. Customer can activate any of these devices: iPhone 13, iPhone 14, ABC Router model 100, DEF Router model 200.</td>
        </tr>
        <tr>
          <td>Finance</td>
          <td>Check balance</td>
          <td>Customer is confused as to why their current balance is what it is. Customer’s tone is urgent.</td>
        </tr>
      </tbody>
    </table>
  </li>
  <li>Click <strong>Generate</strong> to generate up to 30 phrases using AI.</li>
  <li>
    <p>Review the generated phrases, and select the ones you want to add to the intent. Click <strong>Add to intent</strong> to add the phrases to the intent.</p>

    <p><img style="width:700px" src="img/ConvoBuilder/genai_genphrases3.png" alt="The Generate phrases with AI dialog in which you select the phrases to add to the intent" /></p>
  </li>
  <li>
    <p>Back on the <strong>Intent Details</strong> page, you might want to edit the phrases to best fit the intent. Then click <strong>Save</strong>.</p>

    <p><img style="width:700px" src="img/ConvoBuilder/genai_genphrases4.png" alt="The Intent Details page where you save the changes that you made to the intent" /></p>
  </li>
  <li>Retrain the model.</li>
</ol>

<h4 id="troubleshooting-flows">Troubleshooting flows</h4>

<p>If the AI is unable to generate enough phrases, the issues might be due to several reasons:</p>

<ul>
  <li>An unclear topic</li>
  <li>A topic that conflicts with the guidance or an example phrase</li>
  <li>And so on</li>
</ul>

<p>To remedy, start small and gradually introduce more info:</p>

<ol>
  <li>Remove the guidance. Tune the topic and retry.</li>
  <li>
    <p>Add the guidance and retry.</p>

    <p><img style="width:700px" src="img/ConvoBuilder/genai_genphrases5.png" alt="The Generate phrases with AI dialog showing an error where the tool was unable to generate phrases" /></p>

    <p>If the AI is unable to generate enough phrases and you don’t have any existing training phrases for the intent, the system will prompt you to input 3 training phrases as examples. These help the UI to further understand what kind of responses are expected and therefore improve the results.</p>

    <p><img style="width:700px" src="img/ConvoBuilder/genai_genphrases6.png" alt="The Generate phrases with AI dialog showing three fields at the bottom for entering example phrases" /></p>

    <p class="attn-note">The training phrase examples are automatically added back to the intent, together with the AI-generated training phrases that you manually select, once you click <strong>Add to intent</strong>.</p>

    <p>Here are a few examples of good training phrases:</p>

    <table>
      <thead>
        <tr>
          <th>Industry</th>
          <th>Intent</th>
          <th>Example training phrases</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Airline</td>
          <td>Cancel flight</td>
          <td>- I'm really sorry, but I need to cancel my flight reservation due to an unexpected family emergency.<br />- Unfortunately, I won't be able to make it for my flight as I have a sudden work obligation that cannot be avoided. I apologize for the inconvenience.<br />- I'm really sorry for the inconvenience, but I need to cancel my flight reservation as there has been a change in my travel plans.<br />- I regret to inform you that I won't be able to proceed with my flight reservation due to unforeseen circumstances. I apologize for any inconvenience caused.<br />- I apologize for any inconvenience caused, but I need to cancel my flight due to a personal situation that makes it impossible for me to travel.</td>
        </tr>
        <tr>
          <td>Retail</td>
          <td>Check order status</td>
          <td>- I recently placed an order for gardening supplies with Acme Hardware. Can you please provide me with an update on the status of my shipment? I'm eager to start my project.<br />- I'm following up on my order from Acme Hardware for lighting fixtures. I was wondering if you could give me an update on the replacement item that was supposed to be shipped. I appreciate your assistance.<br />- I'm inquiring about my recent paint order with Acme Hardware. I'm really excited to start my project, so I was wondering if you could provide me with the estimated delivery date. Thank you!<br />- I purchased some gardening tools from Acme Hardware and I'm curious to know if the replacement for the damaged item has been shipped. Any updates would be greatly appreciated.<br />- I'm getting a bit anxious about my order for lighting fixtures with Acme Hardware. Could you please check on the status of the shipment and let me know when I can expect it? Thanks for your help!</td>
        </tr>
        <tr>
          <td>Telco</td>
          <td>Activate device</td>
          <td>- I need assistance activating my new iPhone 13. Can you guide me through the activation process?<br />- I just received my iPhone 14 and I'm not sure how to activate it. Could you provide instructions on activating the device?<br />- Hi, I'm having trouble activating my ABC Router model 100. Can you help me with the activation process?<br />- I recently purchased a DEF Router model 200 and I'm unable to activate it. Is there any guidance you can provide to help me with the activation?<br />- Can you assist me with activating my new device, the iPhone 13? I'm not familiar with the activation steps and could use some guidance.</td>
        </tr>
        <tr>
          <td>Finance</td>
          <td>Check balance</td>
          <td>- I'm really confused about my account balance. Can you please explain why my current balance is higher than expected? I need clarification urgently.<br />- I just checked my credit card balance and it seems unusually high. Could you provide me with a breakdown of the charges or transactions contributing to this balance? I need to understand it urgently.<br />- I need immediate assistance regarding my account balance. I'm seeing some discrepancies and I'm not sure why my balance is showing a negative amount. Can you please help me resolve this?<br />- I'm puzzled by my current account balance. It's significantly lower than I anticipated. Can you shed some light on what might have caused this sudden decrease?<br />- I'm reaching out with an urgent concern about my credit card balance. I'm unable to comprehend why my balance has doubled since last month. Could you please provide me with a detailed explanation?</td>
        </tr>
      </tbody>
    </table>
  </li>
</ol>

<h4 id="faqs">FAQs</h4>

<h5 id="which-llm-model-are-you-using">Which LLM model are you using?</h5>

<p>LivePerson is using one of the best and latest versions of OpenAI’s models. Advances in this area are happening quickly, so we’re continually evaluating the model we’re using to ensure it’s the best choice possible.</p>

<p>Currently, it’s not possible for you to select a particular model to use.</p>

<h5 id="will-the-llm-model-generate-inappropriate-content-is-it-safe">Will the LLM model generate inappropriate content? Is it safe?</h5>

<p>With a well-defined topic, the model should generate appropriate content most of the time. Additionally, the guidance can help steer the content toward or away from certain types of phrasings. However, it is possible that the LLM will return something overtly or subtly inappropriate.</p>

<p>You always have an opportunity to review the generated phrases before adding them to your intent. This is an important step to ensure you only add to the model what you want.</p>

<h5 id="can-the-model-generate-more-than-30-phrases-at-a-time">Can the model generate more than 30 phrases at a time?</h5>

<p>Our testing has found that the LLM consistently returns the best results with around 30 results at a time, so that number cannot be changed. However, you can repeat the process as many times as you like to get more training phrases.</p>

<h5 id="is-my-conversation-data-sent-to-openai-or-microsoft-azure">Is my conversation data sent to OpenAI or Microsoft Azure?</h5>

<p>No. We send example phrases taken from the intent’s existing training data, but we never send conversation data. As a <a href="intent-manager-best-practices.html#training-phrases">best practice</a>, avoid putting sensitive info like consumer names or other identifiers in your training data.</p>

<h3 id="find-similar-training-phrases-in-your-consumer-messages">Find similar training phrases in your consumer messages</h3>

<p>Adding training phrases to an intent can sometimes be a challenge, so Intent Manager includes a tool to help with this. Within an intent, provide just a single training phrase as the input, and the tool automatically finds additional phrases that are similar in meaning. The suggestions are based on actual utterances by your users.</p>

<h4 id="use-cases-1">Use cases</h4>

<ul>
  <li>You’re building out a LivePerson or third-party NLU domain that you’ve created from scratch.</li>
  <li>You’ve <a href="intent-manager-natural-language-understanding-liveperson-nlu-engine.html#convert-a-liveperson-legacy-domain-to-liveperson">converted a LivePerson (Legacy) NLU domain to the LivePerson engine</a>, and now you need to increase the number of training phrases to meet the minimum requirements.</li>
</ul>

<h4 id="important-notes-1">Important notes</h4>

<ul>
  <li>This feature is only available 1) for <strong>English-language domains</strong>, and 2) if you log into Intent Manager through Conversational Cloud.</li>
  <li>Expect the tool’s results to improve over time as more data is captured.</li>
  <li>If you're a new customer, expect no results until suggestions can be offered based on utterances by your users. And here again, expect the tool's results to improve over time.</li>
</ul>

<h4 id="find-similar-training-phrases">Find similar training phrases</h4>

<ol>
  <li><a href="intent-manager-overview.html#access-intent-manager">Access Intent Manager</a>.</li>
  <li>Locate the domain list in the Intent Manager dashboard.</li>
  <li>Select the name of the relevant domain, and then select <strong>Build</strong> from the menu that appears.</li>
  <li>On the <strong>Intents</strong> page, select the intent.</li>
  <li>
    <p>Beside an existing training phrase (you’ll need to add at least one to the intent), click <img class="inlineimage" style="width:25px" src="img/ConvoBuilder/icon_knn.png" alt="Generate training phrases icon" />.</p>

    <p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/ib_knn1.png" alt="Example training phrase, with the Generate training phrases icon beside it" /></p>
  </li>
  <li>
    <p>Review the phrases that were found, and select the ones you want to add to the domain. You might also want to refine the spelling or punctuation. The phrases are based on actual consumer utterances, so they might contain misspellings or poor grammar. (See the <a href="intent-manager-faqs.html">FAQ</a> regarding typos and misspellings.)</p>

    <p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/ib_knn2.png" alt="Find Similar Phrases window" /></p>
  </li>
  <li>Click <strong>Add</strong>.</li>
  <li>Back on the Intents page, click <strong>Save</strong> to save the change.</li>
  <li>Retrain the domain.</li>
</ol>

<h3 id="add-or-update-training-phrases-in-bulk">Add or update training phrases in bulk</h3>

<p>Use the <strong>Bulk Add</strong> or <strong>Bulk Edit</strong> features, respectively, to add or edit a set of training phrases in bulk.</p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/im_intents_bulkedit1.png" alt="Bulk Edit link on the Intent Details page" /></p>

<p>When you click the link, all of the training phrases are placed into a single field. This means you can make changes to all or some of them in bulk. For example, you can:</p>

<ul>
  <li>Insert a number of additional phrases at the top or bottom. This is handy if you have the phrases in a separate file. You can quickly copy them and paste them in.</li>
  <li>Select a number of phrases and delete them all at once. This is faster than doing so one by one.</li>
</ul>

<p><img style="width:700px" src="img/ConvoBuilder/im_intents_bulkedit2.png" alt="Example of all training phrases in a single field" /></p>

<p class="attn-note">To save your changes, click the <strong>Update Intent</strong> button. Once you save the changes, they can’t be reverted. To cancel, navigate away from the page without saving the changes.</p>

<p>Take care when using this feature to avoid making unintended changes:</p>

<ul>
  <li>To replace what exists, paste over it.</li>
  <li>To add to what exists, paste the additions into (not over) the list.</li>
  <li>Ensure that each phrase is on a different line.</li>
</ul>

<h3 id="delete-an-intent">Delete an intent</h3>

<p>Deleting an intent is a non-recoverable action, so be certain about doing so before taking this action.</p>

<p class="attn-note">Ensure the intent isn't being used by any bots or knowledge bases before you delete it.</p>

<p><strong>To delete an intent</strong></p>

<ol>
  <li><a href="intent-manager-overview.html#access-intent-manager">Access Intent Manager</a>.</li>
  <li>Locate the domain list in the Intent Manager dashboard.</li>
  <li>Select the name of the relevant domain, and then select <strong>Build</strong> from the menu that appears.</li>
  <li>On the <strong>Intents</strong> page, select the intent.</li>
  <li>Click <img style="width:25px" src="img/ConvoBuilder/icon_ellipsis_vertical.png" alt="Three-dot icon" /> (3-dot icon), and select <strong>Delete</strong>.</li>
  <li>In the confirmation dialog, click <strong>Yes</strong>.</li>
  <li>Train the domain so that the deletion is reflected in a new model version.</li>
</ol>
]]></description>
      <!-- <pubDate>Tue, 06 Jan 2026 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Overview</title>
      <link>https://developers.liveperson.com/conversation-builder-overview.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-overview.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>Use LivePerson Conversation Builder to design and scale with AI-powered bots. Our intuitive, point-and-click interface makes it easy to build bots and automate conversations.</p>

<iframe src="https://player.vimeo.com/video/1068155383?h=407fb46df4" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<h3 id="bot-building-made-easy">Bot building made easy</h3>

<p>Even non-technical staff can build and optimize AI-powered chatbots. Conversation Builder offers a <a href="conversation-builder-bot-workspace.html">point-and-click interface</a> with a guided assistant that walks users through the creation of automated conversations. And with a library of prebuilt conversation templates for a variety of use cases across multiple industries, you don’t have to start from scratch.</p>

<h3 id="a-flexible-bot-management-tool">A flexible bot management tool</h3>

<p>Build automated conversation flows once, and run them on every messaging channel. Easily integrate into any back-end system including CRM, scheduling tools, order and inventory management systems, payment platforms, and more.</p>

<h3 id="identify-and-resolve-bot-failure-points-with-macs">Identify and resolve bot failure points with MACS</h3>

<p>Our <a href="https://community.liveperson.com/kb/articles/1352-meaningful-automated-conversation-score-macs">Meaningful Automated Conversation Score</a> (MACS) is the first measurement of how much friction consumers experience in automated conversations. This built-in analysis assesses how well bots are helping with customer queries, highlights common points of failure like poor routing, and helps you quickly move to bot tuning in Conversation Builder.</p>

<h3 id="automate-answers-enriched-via-generative-ai">Automate answers enriched via Generative AI</h3>

<p>If you’re using Conversation Builder bots to automate answers to consumers, you can send answers that are enriched by KnowledgeAI's LLM-powered answer enrichment service. The resulting answers, formulated via Generative AI, are accurate, contextually aware, and natural-sounding. <a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html">Learn more.</a></p>

<h3 id="access-conversation-builder">Access Conversation Builder</h3>

<ol>
  <li>Log into Conversational Cloud.</li>
  <li>
    <p>Open the menu on the left side of the page, and select <strong>Automate</strong> &gt; <strong>Conversation Builder</strong>.</p>

    <p><img class="fancyimage" alt="The Automate menu with the Conversation Builder menu option highlighted" style="width:300px" src="img/ConvoBuilder/automate_cb.png" /></p>
  </li>
</ol>

<h3 id="try-the-tutorial">Try the tutorial</h3>

<p>If you're just beginning with Conversation Builder, we recommend the <a href="tutorials-get-started-with-bot-building-messaging-overview.html">Getting Started tutorial series</a>.</p>
]]></description>
      <!-- <pubDate>Tue, 16 Dec 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Videos</title>
      <link>https://developers.liveperson.com/videos.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/videos.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="pii-masking-via-our-llm-gateway">PII Masking via our LLM Gateway</h3>

<iframe src="https://player.vimeo.com/video/1138190283?h=092e96d2ba" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li><a href="trustworthy-generative-ai-llm-gateway-pii-masking.html">PII Masking</a></li>
</ul>

<h3 id="knowledgeai">KnowledgeAI™</h3>

<h4 id="answers-enriched-via-generative-ai">Answers enriched via Generative AI</h4>

<iframe src="https://player.vimeo.com/video/1077413798?h=a4971f4dba" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li>KnowledgeAI: <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Enriched answers via Generative AI</a></li>
  <li>Conversation Assist: <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">Offer enriched answers via Generative AI</a></li>
  <li>Conversation Builder: <a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html">Automate enriched answers via Generative AI</a></li>
</ul>

<h4 id="integrate-a-kms-or-cms">Integrate a KMS or CMS</h4>

<iframe src="https://player.vimeo.com/video/1077413879?h=f4307ad246" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li>KnowledgeAI: <a href="knowledgeai-internal-knowledge-bases-integrate-a-kms-or-cms.html">Integrate a KMS or CMS</a></li>
</ul>

<h3 id="conversation-assist">Conversation Assist</h3>

<h4 id="overview">Overview</h4>

<iframe src="https://player.vimeo.com/video/1094174369?h=c044c195bd" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li>Conversation Assist: <a href="conversation-assist-overview.html">Overview</a></li>
  <li>Try the tutorial: <a href="tutorials-use-conversation-assist-overview.html">Using Conversation Assist</a></li>
</ul>

<h4 id="process-the-users-query-for-better-search">Process the user's query for better search</h4>

<iframe src="https://player.vimeo.com/video/1094174430?h=a57daff6d2" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li><a href="conversation-assist-key-terms-concepts-answer-recommendations.html">Key concepts about answer recommendations</a></li>
</ul>

<h4 id="process-the-answers-for-better-results">Process the answers for better results</h4>

<iframe src="https://player.vimeo.com/video/1094174404?h=eb3ca37301" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li><a href="conversation-assist-key-terms-concepts-answer-recommendations.html">Key concepts about answer recommendations</a></li>
</ul>

<h3 id="conversation-builder">Conversation Builder</h3>

<h4 id="conversation-builder-overview">Conversation Builder overview</h4>

<iframe src="https://player.vimeo.com/video/1068155383?h=407fb46df4" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li>Conversation Builder: <a href="conversation-builder-overview.html">Overview</a></li>
  <li>Conversation Builder: <a href="conversation-builder-bot-workspace.html">Bot workspace</a></li>
  <li>Conversation Builder: <a href="conversation-builder-bots-messaging-bots.html">Messaging bots</a></li>
  <li>Conversation Builder: <a href="conversation-builder-bots-voice-bots.html">Voice bots</a></li>
  <li>Conversation Builder: <a href="conversation-builder-bots-post-conversation-survey-bots.html">Post-conversation surveys</a></li>
  <li>Conversation Builder: <a href="conversation-builder-bots-manager-bots.html">Manager bots</a></li>
  <li>Conversation Builder: <a href="conversation-builder-bots-bot-to-bot-transfers.html">Automatic transfers via bot groups</a></li>
  <li>Conversation Builder: <a href="conversation-builder-best-practices-introduction.html">Best practices</a></li>
  <li>Conversational AI: <a href="tutorials-introduction.html">Tutorials</a></li>
</ul>

<h4 id="getting-started-with-voicebots">Getting started with voicebots</h4>

<iframe src="https://player.vimeo.com/video/1077413178?h=2a9e2a26b6" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li>Conversation Builder: <a href="conversation-builder-bots-voice-bots.html">Voice Bots</a></li>
  <li>Try the tutorial: <a href="tutorials-get-started-with-bot-building-voice-overview.html">Getting Started with Bot Building - Voice</a></li>
</ul>

<h4 id="deploying-a-messaging-bot">Deploying a Messaging bot</h4>

<iframe src="https://player.vimeo.com/video/1077413504?h=763f03f3f2" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li>Conversation Builder: <a href="conversation-builder-testing-deployment-deploy-the-bot.html">Deploying to Conversational Cloud</a></li>
  <li>Try the tutorial: <a href="tutorials-get-started-with-bot-building-messaging-deploy-the-bot.html">Deploy the Bot</a></li>
</ul>

<h4 id="automating-answers">Automating answers</h4>

<iframe src="https://player.vimeo.com/video/1077413832?h=1bd835e9fe" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li>Conversation Builder: <a href="conversation-builder-interactions-integrations.html#knowledge-ai">KnowledgeAI interactions</a></li>
  <li>Try the tutorial: <a href="tutorials-bot-groups-other-techniques-meta-intents-knowledge-bases.html">Meta Intents &amp; Knowledge Bases</a></li>
</ul>

<h3 id="intent-manager">Intent Manager</h3>

<h4 id="generating-training-phrases-using-generative-ai">Generating training phrases using Generative AI</h4>

<iframe src="https://player.vimeo.com/video/1077413720?h=8c977d2c21" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li>Intent Manager: <a href="intent-manager-build-intents.html#generate-training-phrases-via-generative-ai">Generate training phrases via Generative AI</a></li>
</ul>

<h3 id="bot-analytics">Bot Analytics</h3>

<h4 id="meaningful-automated-conversation-score-macs">Meaningful Automated Conversation Score (MACS)</h4>

<iframe src="https://player.vimeo.com/video/1077413145?h=412078ef7e" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p>Get started here:</p>

<ul>
  <li>Bot Analytics: <a href="bot-analytics-macs.html">MACS</a></li>
</ul>
]]></description>
      <!-- <pubDate>Thu, 04 Dec 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>PII Masking</title>
      <link>https://developers.liveperson.com/trustworthy-generative-ai-llm-gateway-pii-masking.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/trustworthy-generative-ai-llm-gateway-pii-masking.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="ea-release">EA release</h3>

<p>PII Masking is in <strong>Early Access (EA) release</strong>.</p>

<h3 id="watch-the-video">Watch the video</h3>

<iframe src="https://player.vimeo.com/video/1138190283?h=092e96d2ba" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<h3 id="introduction">Introduction</h3>

<p>In an era where data breaches are a constant threat and regulatory compliance is paramount, protecting Personally Identifiable Information (PII) is a critical challenge for organizations.</p>

<p>If your Conversational Cloud solution uses Generative AI, it therefore uses a Large Language Model (LLM) provided by a third-party provider. So, it’s likely that you need to mask sensitive customer data (PII) before sending it to the external LLM. This protects consumers’ privacy and complies with potential data protection regulations during LLM processing.</p>

<p>LivePerson's reversible PII masking strikes a balance between privacy and usability. Conversational Cloud masks PII before sending data to an LLM, ensuring sensitive details aren't exposed during LLM processing (like rewriting agent responses or summarizing conversations). Once the LLM returns its output, Conversational Cloud then unmasks the PII, so you retain it for legitimate uses within your solution.</p>

<p>This article provides information on how to enable and configure PII masking for your solution.</p>

<h3 id="key-terms-and-concepts">Key terms and concepts</h3>

<h4 id="pii">PII</h4>

<p>PII stands for Personally Identifiable Information. It refers to any data that can be used to identify, contact, or locate a single person, or can be directly linked to a person. In simpler terms, if a piece of information can be used to figure out who someone is, it's PII. The following are examples:</p>

<ul>
  <li>Full name (first and last name)</li>
  <li>Driver's license number</li>
  <li>Passport number</li>
  <li>Credit card number</li>
  <li>Email address</li>
  <li>Home address</li>
  <li>Telephone number</li>
</ul>

<h4 id="pii-masking">PII masking</h4>

<p>PII masking is a data protection technique that involves hiding or obscuring Personally Identifiable Information (PII) to prevent unauthorized access or disclosure.</p>

<p>LivePerson’s PII masking replaces sensitive information with non-identifiable values.</p>

<h4 id="reversible-pii-masking">Reversible PII masking</h4>

<p>Unlike irreversible masking (where the original data is permanently altered or replaced), LivePerson’s PII masking is reversible. The PII is obscured or transformed in a way that allows it to be restored to its original state by an authorized resource (Conversational Cloud) with the proper key or mechanism.</p>

<p>Reversible masking is crucial, as it lets you protect PII when it is shared with external systems but retains it for use within your trusted contact center solution.</p>

<h4 id="pii-masking-works-via-llm-gateway">PII masking works via LLM Gateway</h4>

<p>PII masking works exclusively through LivePerson’s LLM Gateway. It is the LLM Gateway that masks the PII in a request sent to an LLM via a Generative AI feature in Conversational Cloud. It is also the LLM Gateway that unmasks the response that is received from the LLM.</p>

<p><img style="width:800px" src="img/piimasking/pii_masking.png" alt="A flow diagram showing how PII Masking works through LLM Gateway" /></p>

<h4 id="pii-masking-is-off-by-default">PII masking is off by default</h4>

<p>PII masking is off by default. You must opt in at your discretion. Use the info in this article to guide you through setup.</p>

<h4 id="pii-masking-is-strong-not-absolute-protection">PII masking is strong, not absolute protection</h4>

<p>LivePerson’s reversible PII masking is designed to greatly mitigate the risk of PII exposure by proactively identifying and obfuscating sensitive data points before they reach the LLM. While this feature offers a strong layer of protection and may dramatically reduce the likelihood of PII leakage, it's important to acknowledge that no automated system is entirely foolproof. Due to the dynamic and nuanced nature of language, there may be isolated instances where certain PII elements could still slip through the masking process, necessitating ongoing monitoring and refinement to address such residual risks.</p>

<h4 id="pci-versus-pii-masking">PCI versus PII masking</h4>
<p>PCI (credit and debit card) data is always masked first; PII masking per your configuration follows.</p>

<h3 id="language-support">Language support</h3>

<p>LivePerson has fully tested and validated PII masking for English. For all other languages, rigorous testing of your specific use case is required to ensure quality.</p>

<h3 id="get-started">Get started</h3>

<p>In the Management Console, the <strong>PII masking</strong> section of the <strong>Generative AI Management</strong> page is visible to all brands. However, the feature must be explicitly enabled by LivePerson to work.</p>

<h4 id="to-enable-pii-masking">To enable PII masking</h4>

<ol>
  <li>If you haven’t already done so, use the <strong>Generative AI Management</strong> page in the Management Console to <a href="https://community.liveperson.com/kb/articles/1502-get-started-with-our-solution">activate our Generative AI features</a>. This involves reviewing and accepting our terms of use for Generative AI features, and also providing some info about your brand.</li>
  <li>To have PII Masking turned on for your account, submit your request via <a href="https://forms.gle/2NbztqGhS21gduDW9">this form</a>.</li>
</ol>

<h3 id="best-practices">Best practices</h3>

<ul>
  <li>To protect users’ sensitive info and to help you to meet global privacy standards, use PII masking. It’s off by default, so you can opt in at your discretion. But we recommend that you turn it on.</li>
  <li>Be inclusive about what you mask. You can omit data types based on your testing.</li>
</ul>

<h3 id="faqs">FAQs</h3>

<h4 id="what-about-pci-masking">What about PCI masking?</h4>

<p>PCI (credit/debit card) data is always masked first and is not reversible. PII masking per your configuration follows PCI masking.</p>

<h4 id="does-enabling-pii-masking-change-the-behavior-of-my-llm-solutions">Does enabling PII Masking change the behavior of my LLM solutions?</h4>

<p>LivePerson’s reversible PII masking detects and replaces PII with tokens, for example “John Smith” with “[NAME_1]” in the prompt sent to the LLM. Our testing shows this performs well with existing prompts, but we recommend that you test your prompts with PII masking enabled to ensure that the results work well for you.</p>

<h4 id="do-liveperson-prompt-templates-enable-pii-masking-by-default">Do LivePerson prompt templates enable PII masking by default?</h4>

<p>Currently, LivePerson's prompt templates retain their default configuraton: PII Masking isn't enabled. As we progress through the Early Access program, if we find that we need to optimize specific prompts for PII Masking, we'll issue optimized versions where it is on by default.</p>

<h4 id="can-i-change-the-regular-expressions-that-are-used-to-mask-specific-data-types-or-add-custom-ones">Can I change the Regular Expressions that are used to mask specific data types, or add custom ones?</h4>

<p>No, this isn’t possible.</p>

<h4 id="is-there-a-way-to-know-at-a-glance-if-my-prompt-has-pii-masking-turned-on">Is there a way to know at a glance if my prompt has PII masking turned on?</h4>

<p>Yes, in the Prompt Library, you’ll see the following icon in the prompt list:</p>

<p><img style="width:600px" src="img/piimasking/pii_masking_indicator.png" alt="A flow diagram showing how PII Masking works through LLM Gateway" /></p>

<h4 id="do-you-have-any-more-technical-info-on-how-the-pii-masking-works-especially-how-it-handles-conflict-resolution">Do you have any more technical info on how the PII masking works, especially how it handles conflict resolution?</h4>

<p>This system is designed to find and obscure PII like names, addresses, and ID numbers in text. It uses a combination of simple rule-based patterns and smarter, context-aware AI tools.</p>

<h5 id="step-1-finding-the-pii-detection-priority">Step 1: Finding the PII (detection priority)</h5>

<p>The system doesn't search for everything at once; it follows a strict order, prioritizing the most certain types of PII first:</p>

<ul>
  <li><strong>Structural patterns</strong>: This is the fastest method, using fixed rules (RegEx) to find standard formats like a phone number, United States SSN, or national ID number (e.g., Mexican CURP).</li>
  <li><strong>AI (SpaCy NER)</strong>: This uses a more sophisticated AI model to find things based on context, like a PERSON name, which is then split into a FIRST_NAME and LAST_NAME.</li>
  <li><strong>Contextual patterns</strong>: We only use these “capture everything” rules for a handful of very strong clues. Right now that means some Indonesian banking prompts and the official CURP wording. When one of those clues appears (for example, the text says “Nama rekening Anda: Budi Santoso 9876”), the system tags “Budi Santoso” as sensitive and automatically hides that same name everywhere else in the message.</li>
</ul>

<h5 id="step-2-deciding-what-wins-conflict-resolution">Step 2: Deciding what wins (conflict resolution)</h5>

<p>When the system finds multiple overlapping detections (e.g., one rule finds a phone number, and another finds an ID pattern within that phone number), it uses smart rules to choose the best result:</p>

<ul>
  <li><strong>Rule 1: Priority wins</strong>: Entities processed earlier (like a specific ID number) always override lower-priority entities (like a generic phone number).</li>
  <li><strong>Rule 2: Longer match wins</strong>: For things like addresses or names, the system prefers the longer detection. For example, a rule finding "123 Main St, Toronto, ON" as an address is preferred over a rule only finding "123 Main St."</li>
  <li><strong>Rule 3: Context overrides names</strong>: If a contextual pattern is active, it can overrule the AI's name detection to prevent false alarms.</li>
  <li><strong>Rule 4: Address overrides name</strong>: If a detected name is completely contained within a larger address detection, the name is removed, keeping only the address.</li>
</ul>

<h5 id="step-3-making-it-accurate-refinement">Step 3: Making it accurate (refinement)</h5>

<p>The system uses extra "refinement functions" to clean up the boundaries of detections:</p>

<ul>
  <li><strong>URL refinement</strong>: It automatically removes trailing punctuation (like a period or comma) from a URL so that “https://example.com.” becomes just “https://example.com”. (Note the trailing dot in the first URL but not in the second.)</li>
  <li><strong>Address refinement</strong>: It prevents leading narrative text from being included in an address. For example, "My address is 123 Main St" is corrected to only detect "123 Main St."</li>
</ul>

<h3 id="pii-masking-regular-expressions">PII masking regular expressions</h3>

<h4 id="alphanumeric">Alphanumeric</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">[</span><span class="err">\</span><span class="nx">w</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">(</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="o">|</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">)[</span><span class="err">\</span><span class="nx">w</span><span class="o">-</span><span class="p">]</span><span class="o">*</span>
</code></pre></div></div>

<h4 id="clave-única-de-registro-de-población-mexico">Clave Única de Registro de Población (Mexico)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]{</span><span class="mi">4</span><span class="p">}</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">6</span><span class="p">}[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]{</span><span class="mi">6</span><span class="p">}[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]{</span><span class="mi">2</span><span class="p">}</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="nx">clave</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">única</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">de</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">registro</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">de</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">población</span><span class="p">)</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="nx">clave</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">unica</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">de</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">registro</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">de</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">poblacion</span><span class="p">)</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="nx">única</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">de</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">registro</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">de</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">población</span><span class="p">)</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="nx">unica</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">de</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">registro</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">de</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">poblacion</span><span class="p">)</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="nx">u</span><span class="err">\</span><span class="p">.?</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="nx">p</span><span class="err">\</span><span class="p">.?)</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="nx">curp</span><span class="p">)</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="nx">clave</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">curp</span><span class="p">)</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="nx">curp</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">clave</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">registro</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">de</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">poblacion</span><span class="p">)</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="nx">clave</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">unica</span><span class="p">)</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="nx">unica</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">clave</span>
</code></pre></div></div>

<h4 id="date">Date</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">}[</span><span class="err">\</span><span class="o">/-</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">}[</span><span class="err">\</span><span class="o">/-</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">})</span><span class="o">|</span><span class="p">(</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">}[</span><span class="err">\</span><span class="o">/-</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">}[</span><span class="err">\</span><span class="o">/-</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">})</span>
</code></pre></div></div>

<h4 id="digits">Digits</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="err">\</span><span class="o">-</span><span class="p">.,</span><span class="nx">_</span><span class="o">/</span><span class="err">\</span><span class="nx">s</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">3</span><span class="p">,}</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="err">\</span><span class="o">-</span><span class="p">.,</span><span class="nx">_</span><span class="o">/</span><span class="p">]</span><span class="o">*</span>
</code></pre></div></div>

<h4 id="documento-nacional-de-identidad-spain">Documento Nacional de Identidad (Spain)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">8</span><span class="p">}[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span>
</code></pre></div></div>

<h4 id="email-address">Email address</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z0</span><span class="o">-</span><span class="mi">9</span><span class="nx">_</span><span class="err">\</span><span class="o">-</span><span class="p">.</span><span class="o">+</span><span class="p">]</span><span class="o">+</span><span class="p">)@[</span><span class="err">\</span><span class="nx">w</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="p">.</span><span class="err">\</span><span class="nx">w</span><span class="o">+</span><span class="p">)</span><span class="o">*</span>
</code></pre></div></div>

<h4 id="ip-address">IP address</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">}(</span><span class="err">\</span><span class="p">.</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">}){</span><span class="mi">3</span><span class="p">}</span><span class="o">|</span><span class="p">([</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Fa</span><span class="o">-</span><span class="nx">f</span><span class="p">]{</span><span class="mi">1</span><span class="p">,</span><span class="mi">4</span><span class="p">}:){</span><span class="mi">7</span><span class="p">}[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Fa</span><span class="o">-</span><span class="nx">f</span><span class="p">]{</span><span class="mi">1</span><span class="p">,</span><span class="mi">4</span><span class="p">}</span><span class="o">|</span><span class="p">([</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Fa</span><span class="o">-</span><span class="nx">f</span><span class="p">]{</span><span class="mi">1</span><span class="p">,</span><span class="mi">4</span><span class="p">}:){</span><span class="mi">1</span><span class="p">,</span><span class="mi">7</span><span class="p">}:</span><span class="o">|</span><span class="p">:[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Fa</span><span class="o">-</span><span class="nx">f</span><span class="p">]{</span><span class="mi">1</span><span class="p">,</span><span class="mi">4</span><span class="p">}(:[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Fa</span><span class="o">-</span><span class="nx">f</span><span class="p">]{</span><span class="mi">1</span><span class="p">,</span><span class="mi">4</span><span class="p">}){</span><span class="mi">1</span><span class="p">,</span><span class="mi">6</span><span class="p">}</span><span class="o">|</span><span class="p">::)</span>
</code></pre></div></div>

<h4 id="mention-of-password">Mention of password</h4>

<p>This expression checks for mention of “password” and some string of characters.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(?</span><span class="nx">i</span><span class="p">:</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">pass</span><span class="p">(</span><span class="nx">word</span><span class="o">|</span><span class="nx">wd</span><span class="p">)?</span><span class="o">|</span><span class="nx">pwd</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(</span><span class="err">\</span><span class="nx">bis</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">:</span><span class="o">|</span><span class="p">:</span><span class="o">|</span><span class="err">\</span><span class="nx">bis</span><span class="err">\</span><span class="nx">b</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">zA</span><span class="o">-</span><span class="nx">Z</span><span class="p">]</span><span class="o">*</span><span class="p">[</span><span class="o">^</span><span class="nx">a</span><span class="o">-</span><span class="nx">zA</span><span class="o">-</span><span class="nx">Z</span><span class="err">\</span><span class="nx">s</span><span class="p">][</span><span class="o">^</span><span class="err">\</span><span class="nx">s</span><span class="p">]</span><span class="o">*</span>
</code></pre></div></div>

<h4 id="name">Name</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">Nama</span><span class="p">.{</span><span class="mi">0</span><span class="p">,</span><span class="mi">50</span><span class="p">}</span><span class="nx">Anda</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">:</span> <span class="p">((</span><span class="err">\</span><span class="nx">w</span><span class="o">+</span><span class="p">[,</span><span class="err">\</span><span class="p">.]</span><span class="o">*</span> <span class="p">){</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">})</span><span class="err">\</span><span class="nx">d</span>
</code></pre></div></div>

<p>Or</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">Nama</span><span class="p">.{</span><span class="mi">0</span><span class="p">,</span><span class="mi">50</span><span class="p">}</span><span class="nx">rekening</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">:</span> <span class="p">((</span><span class="err">\</span><span class="nx">w</span><span class="o">+</span><span class="p">[,</span><span class="err">\</span><span class="p">.]</span><span class="o">*</span> <span class="p">){</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">})(?:</span><span class="nx">terdaftar</span><span class="o">|</span><span class="nx">nomor</span><span class="p">)</span>
</code></pre></div></div>

<h4 id="phone-number">Phone number</h4>

<p>Due to the number and variety of phone number formats, this expression doesn't match all possible formats. So, in some cases, numbers are only partially masked, e.g., +972-[PHONE_NUMBER_1].</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="err">\</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">}[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">3</span><span class="p">}[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">3</span><span class="p">}[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">})</span><span class="o">|</span><span class="p">(</span><span class="err">\</span><span class="p">(?</span><span class="err">\</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">}</span><span class="err">\</span><span class="p">)?[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?)(</span><span class="err">\</span><span class="p">(?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="p">)?</span><span class="o">|</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">})[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?(</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">3</span><span class="p">,</span><span class="mi">5</span><span class="p">}[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">3</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z0</span><span class="o">-</span><span class="mi">9</span><span class="p">]{</span><span class="mi">7</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="p">]{</span><span class="mi">8</span><span class="p">,})</span><span class="o">|</span><span class="p">(</span><span class="mi">1</span><span class="p">[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?)(</span><span class="err">\</span><span class="p">(?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="p">)?</span><span class="o">|</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">})[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?(</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">3</span><span class="p">,</span><span class="mi">5</span><span class="p">}[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z0</span><span class="o">-</span><span class="mi">9</span><span class="p">]{</span><span class="mi">7</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="p">]{</span><span class="mi">8</span><span class="p">,})</span><span class="o">|</span><span class="p">(</span><span class="err">\</span><span class="p">(?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="p">)?</span><span class="o">|</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">})[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?(</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">3</span><span class="p">,</span><span class="mi">5</span><span class="p">}[</span><span class="o">-</span><span class="p">.</span> <span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z0</span><span class="o">-</span><span class="mi">9</span><span class="p">]{</span><span class="mi">7</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="p">]{</span><span class="mi">8</span><span class="p">,})</span>
</code></pre></div></div>

<h4 id="social-insurance-number-canada">Social Insurance Number (Canada)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="err">\</span><span class="nx">b</span><span class="p">[</span><span class="mi">1</span><span class="o">-</span><span class="mi">9</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">2</span><span class="p">}[</span> <span class="o">-</span><span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">3</span><span class="p">}[</span> <span class="o">-</span><span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span>
</code></pre></div></div>

<h4 id="social-security-number-united-states">Social Security Number (United States)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">3</span><span class="p">}[</span> <span class="o">-</span><span class="p">.]?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">2</span><span class="p">}[</span> <span class="o">-</span><span class="p">.]?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span>
</code></pre></div></div>

<h4 id="street-address-canada">Street address (Canada)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]?(</span><span class="o">-</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">)?</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">st</span><span class="o">|</span><span class="nx">rd</span><span class="o">|</span><span class="nx">dr</span><span class="o">|</span><span class="nx">ln</span><span class="o">|</span><span class="nx">ct</span><span class="o">|</span><span class="nx">pl</span><span class="o">|</span><span class="nx">sq</span><span class="o">|</span><span class="nx">cl</span><span class="o">|</span><span class="nx">gt</span><span class="o">|</span><span class="nx">gl</span><span class="o">|</span><span class="nx">ave</span><span class="o">|</span><span class="nx">avenue</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">cir</span><span class="o">|</span><span class="nx">circle</span><span class="o">|</span><span class="nx">plz</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">trl</span><span class="o">|</span><span class="nx">trail</span><span class="o">|</span><span class="nx">ter</span><span class="o">|</span><span class="nx">terrace</span><span class="o">|</span><span class="nx">cres</span><span class="o">|</span><span class="nx">crescent</span><span class="o">|</span><span class="nx">centre</span><span class="o">|</span><span class="nx">center</span><span class="o">|</span><span class="nx">street</span><span class="o">|</span><span class="nx">road</span><span class="o">|</span><span class="nx">drive</span><span class="o">|</span><span class="nx">blvd</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">lane</span><span class="o">|</span><span class="nx">court</span><span class="o">|</span><span class="nx">way</span><span class="o">|</span><span class="nx">pkwy</span><span class="o">|</span><span class="nx">parkway</span><span class="o">|</span><span class="nx">hwy</span><span class="o">|</span><span class="nx">highway</span><span class="o">|</span><span class="nx">square</span><span class="o">|</span><span class="nx">loop</span><span class="o">|</span><span class="nx">close</span><span class="o">|</span><span class="nx">gate</span><span class="o">|</span><span class="nx">glen</span><span class="o">|</span><span class="nx">heights</span><span class="o">|</span><span class="nx">hts</span><span class="o">|</span><span class="nx">ctr</span><span class="o">|</span><span class="nx">broadway</span><span class="p">)</span><span class="err">\</span><span class="p">.?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:(?:</span><span class="nx">n</span><span class="o">|</span><span class="nx">s</span><span class="o">|</span><span class="nx">e</span><span class="o">|</span><span class="nx">w</span><span class="o">|</span><span class="nx">ne</span><span class="o">|</span><span class="nx">nw</span><span class="o">|</span><span class="nx">se</span><span class="o">|</span><span class="nx">sw</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="p">(?:</span><span class="nx">north</span><span class="o">|</span><span class="nx">south</span><span class="o">|</span><span class="nx">east</span><span class="o">|</span><span class="nx">west</span><span class="o">|</span><span class="nx">north</span><span class="p">(?:</span> <span class="p">?(?:</span><span class="nx">east</span><span class="o">|</span><span class="nx">west</span><span class="p">))</span><span class="o">|</span><span class="nx">south</span><span class="p">(?:</span> <span class="p">?(?:</span><span class="nx">east</span><span class="o">|</span><span class="nx">west</span><span class="p">)))</span><span class="o">|</span><span class="p">(?:</span><span class="nx">nord</span><span class="o">|</span><span class="nx">sud</span><span class="o">|</span><span class="nx">est</span><span class="o">|</span><span class="nx">ouest</span><span class="o">|</span><span class="nx">nord</span><span class="p">(?:[</span><span class="o">-</span> <span class="p">]?(?:</span><span class="nx">est</span><span class="o">|</span><span class="nx">ouest</span><span class="p">))</span><span class="o">|</span><span class="nx">sud</span><span class="p">(?:[</span><span class="o">-</span> <span class="p">]?(?:</span><span class="nx">est</span><span class="o">|</span><span class="nx">ouest</span><span class="p">)))))?</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">st</span><span class="o">|</span><span class="nx">rd</span><span class="o">|</span><span class="nx">dr</span><span class="o">|</span><span class="nx">ln</span><span class="o">|</span><span class="nx">ct</span><span class="o">|</span><span class="nx">pl</span><span class="o">|</span><span class="nx">sq</span><span class="o">|</span><span class="nx">cl</span><span class="o">|</span><span class="nx">gt</span><span class="o">|</span><span class="nx">gl</span><span class="o">|</span><span class="nx">ave</span><span class="o">|</span><span class="nx">avenue</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">cir</span><span class="o">|</span><span class="nx">circle</span><span class="o">|</span><span class="nx">plz</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">trl</span><span class="o">|</span><span class="nx">trail</span><span class="o">|</span><span class="nx">ter</span><span class="o">|</span><span class="nx">terrace</span><span class="o">|</span><span class="nx">cres</span><span class="o">|</span><span class="nx">crescent</span><span class="o">|</span><span class="nx">centre</span><span class="o">|</span><span class="nx">center</span><span class="o">|</span><span class="nx">street</span><span class="o">|</span><span class="nx">road</span><span class="o">|</span><span class="nx">drive</span><span class="o">|</span><span class="nx">blvd</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">lane</span><span class="o">|</span><span class="nx">court</span><span class="o">|</span><span class="nx">way</span><span class="o">|</span><span class="nx">pkwy</span><span class="o">|</span><span class="nx">parkway</span><span class="o">|</span><span class="nx">hwy</span><span class="o">|</span><span class="nx">highway</span><span class="o">|</span><span class="nx">square</span><span class="o">|</span><span class="nx">loop</span><span class="o">|</span><span class="nx">close</span><span class="o">|</span><span class="nx">gate</span><span class="o">|</span><span class="nx">glen</span><span class="o">|</span><span class="nx">heights</span><span class="o">|</span><span class="nx">hts</span><span class="o">|</span><span class="nx">ctr</span><span class="o">|</span><span class="nx">broadway</span><span class="p">)</span><span class="err">\</span><span class="p">.?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:(?:</span><span class="nx">n</span><span class="o">|</span><span class="nx">s</span><span class="o">|</span><span class="nx">e</span><span class="o">|</span><span class="nx">w</span><span class="o">|</span><span class="nx">ne</span><span class="o">|</span><span class="nx">nw</span><span class="o">|</span><span class="nx">se</span><span class="o">|</span><span class="nx">sw</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="p">(?:</span><span class="nx">north</span><span class="o">|</span><span class="nx">south</span><span class="o">|</span><span class="nx">east</span><span class="o">|</span><span class="nx">west</span><span class="o">|</span><span class="nx">north</span><span class="p">(?:</span> <span class="p">?(?:</span><span class="nx">east</span><span class="o">|</span><span class="nx">west</span><span class="p">))</span><span class="o">|</span><span class="nx">south</span><span class="p">(?:</span> <span class="p">?(?:</span><span class="nx">east</span><span class="o">|</span><span class="nx">west</span><span class="p">)))</span><span class="o">|</span><span class="p">(?:</span><span class="nx">nord</span><span class="o">|</span><span class="nx">sud</span><span class="o">|</span><span class="nx">est</span><span class="o">|</span><span class="nx">ouest</span><span class="o">|</span><span class="nx">nord</span><span class="p">(?:[</span><span class="o">-</span> <span class="p">]?(?:</span><span class="nx">est</span><span class="o">|</span><span class="nx">ouest</span><span class="p">))</span><span class="o">|</span><span class="nx">sud</span><span class="p">(?:[</span><span class="o">-</span> <span class="p">]?(?:</span><span class="nx">est</span><span class="o">|</span><span class="nx">ouest</span><span class="p">)))))?</span><span class="o">|</span><span class="p">(?:</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">rural</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">route</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">box</span><span class="o">|</span><span class="nx">comp</span><span class="o">|</span><span class="nx">site</span><span class="o">|</span><span class="nx">lot</span><span class="o">|</span><span class="nx">concession</span><span class="o">|</span><span class="nx">range</span><span class="o">|</span><span class="nx">line</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]?){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">})(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(</span><span class="nx">apt</span><span class="o">|</span><span class="nx">apartment</span><span class="o">|</span><span class="nx">unit</span><span class="o">|</span><span class="nx">suite</span><span class="o">|</span><span class="nx">ste</span><span class="o">|</span><span class="nx">fl</span><span class="o">|</span><span class="nx">floor</span><span class="o">|</span><span class="nx">rm</span><span class="o">|</span><span class="nx">room</span><span class="o">|</span><span class="nx">bldg</span><span class="o">|</span><span class="nx">building</span><span class="o">|</span><span class="nx">dept</span><span class="o">|</span><span class="nx">lot</span><span class="o">|</span><span class="nx">pier</span><span class="o">|</span><span class="nx">slip</span><span class="o">|</span><span class="nx">trlr</span><span class="o">|</span><span class="err">#</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z0</span><span class="o">-</span><span class="mi">9</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">)?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(</span><span class="se">\</span><span class="s1">s+(?:[a-z][a-z.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*|</span><span class="p">(?:</span><span class="nx">de</span><span class="o">|</span><span class="nx">du</span><span class="o">|</span><span class="nx">des</span><span class="o">|</span><span class="nx">la</span><span class="o">|</span><span class="nx">le</span><span class="o">|</span><span class="nx">les</span><span class="o">|</span><span class="k">of</span><span class="o">|</span><span class="nx">and</span><span class="p">))){</span><span class="mi">0</span><span class="p">,</span><span class="mi">4</span><span class="p">}(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*|</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)(?:</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">ab</span><span class="o">|</span><span class="nx">bc</span><span class="o">|</span><span class="nx">mb</span><span class="o">|</span><span class="nx">nb</span><span class="o">|</span><span class="nx">nl</span><span class="o">|</span><span class="nx">ns</span><span class="o">|</span><span class="nx">nt</span><span class="o">|</span><span class="nx">nu</span><span class="o">|</span><span class="nx">on</span><span class="o">|</span><span class="nx">pe</span><span class="o">|</span><span class="nx">qc</span><span class="o">|</span><span class="nx">sk</span><span class="o">|</span><span class="nx">yt</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">balberta</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bbritish</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">columbia</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bmanitoba</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnew</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">brunswick</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnewfoundland</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">and</span><span class="o">|&amp;</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">labrador</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnova</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">scotia</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnorthwest</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">territories</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnunavut</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bontario</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bprince</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">edward</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">island</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bquebec</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bsaskatchewan</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">byukon</span><span class="err">\</span><span class="nx">b</span><span class="p">))(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span> <span class="o">-</span><span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="err">\</span><span class="nx">b</span><span class="p">)?</span><span class="o">|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">ab</span><span class="o">|</span><span class="nx">bc</span><span class="o">|</span><span class="nx">mb</span><span class="o">|</span><span class="nx">nb</span><span class="o">|</span><span class="nx">nl</span><span class="o">|</span><span class="nx">ns</span><span class="o">|</span><span class="nx">nt</span><span class="o">|</span><span class="nx">nu</span><span class="o">|</span><span class="nx">on</span><span class="o">|</span><span class="nx">pe</span><span class="o">|</span><span class="nx">qc</span><span class="o">|</span><span class="nx">sk</span><span class="o">|</span><span class="nx">yt</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">balberta</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bbritish</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">columbia</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bmanitoba</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnew</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">brunswick</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnewfoundland</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">and</span><span class="o">|&amp;</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">labrador</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnova</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">scotia</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnorthwest</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">territories</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnunavut</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bontario</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bprince</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">edward</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">island</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bquebec</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bsaskatchewan</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">byukon</span><span class="err">\</span><span class="nx">b</span><span class="p">))(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span> <span class="o">-</span><span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="err">\</span><span class="nx">b</span><span class="p">)?)(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(</span><span class="nx">apt</span><span class="o">|</span><span class="nx">apartment</span><span class="o">|</span><span class="nx">unit</span><span class="o">|</span><span class="nx">suite</span><span class="o">|</span><span class="nx">ste</span><span class="o">|</span><span class="nx">fl</span><span class="o">|</span><span class="nx">floor</span><span class="o">|</span><span class="nx">rm</span><span class="o">|</span><span class="nx">room</span><span class="o">|</span><span class="nx">bldg</span><span class="o">|</span><span class="nx">building</span><span class="o">|</span><span class="nx">dept</span><span class="o">|</span><span class="nx">lot</span><span class="o">|</span><span class="nx">pier</span><span class="o">|</span><span class="nx">slip</span><span class="o">|</span><span class="nx">trlr</span><span class="o">|</span><span class="err">#</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z0</span><span class="o">-</span><span class="mi">9</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">)?</span><span class="o">|</span><span class="p">((</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]?(</span><span class="o">-</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">)?</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">st</span><span class="o">|</span><span class="nx">rd</span><span class="o">|</span><span class="nx">dr</span><span class="o">|</span><span class="nx">ln</span><span class="o">|</span><span class="nx">ct</span><span class="o">|</span><span class="nx">pl</span><span class="o">|</span><span class="nx">sq</span><span class="o">|</span><span class="nx">cl</span><span class="o">|</span><span class="nx">gt</span><span class="o">|</span><span class="nx">gl</span><span class="o">|</span><span class="nx">ave</span><span class="o">|</span><span class="nx">avenue</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">cir</span><span class="o">|</span><span class="nx">circle</span><span class="o">|</span><span class="nx">plz</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">trl</span><span class="o">|</span><span class="nx">trail</span><span class="o">|</span><span class="nx">ter</span><span class="o">|</span><span class="nx">terrace</span><span class="o">|</span><span class="nx">cres</span><span class="o">|</span><span class="nx">crescent</span><span class="o">|</span><span class="nx">centre</span><span class="o">|</span><span class="nx">center</span><span class="o">|</span><span class="nx">street</span><span class="o">|</span><span class="nx">road</span><span class="o">|</span><span class="nx">drive</span><span class="o">|</span><span class="nx">blvd</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">lane</span><span class="o">|</span><span class="nx">court</span><span class="o">|</span><span class="nx">way</span><span class="o">|</span><span class="nx">pkwy</span><span class="o">|</span><span class="nx">parkway</span><span class="o">|</span><span class="nx">hwy</span><span class="o">|</span><span class="nx">highway</span><span class="o">|</span><span class="nx">square</span><span class="o">|</span><span class="nx">loop</span><span class="o">|</span><span class="nx">close</span><span class="o">|</span><span class="nx">gate</span><span class="o">|</span><span class="nx">glen</span><span class="o">|</span><span class="nx">heights</span><span class="o">|</span><span class="nx">hts</span><span class="o">|</span><span class="nx">ctr</span><span class="o">|</span><span class="nx">broadway</span><span class="p">)</span><span class="err">\</span><span class="p">.?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:(?:</span><span class="nx">n</span><span class="o">|</span><span class="nx">s</span><span class="o">|</span><span class="nx">e</span><span class="o">|</span><span class="nx">w</span><span class="o">|</span><span class="nx">ne</span><span class="o">|</span><span class="nx">nw</span><span class="o">|</span><span class="nx">se</span><span class="o">|</span><span class="nx">sw</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="p">(?:</span><span class="nx">north</span><span class="o">|</span><span class="nx">south</span><span class="o">|</span><span class="nx">east</span><span class="o">|</span><span class="nx">west</span><span class="o">|</span><span class="nx">north</span><span class="p">(?:</span> <span class="p">?(?:</span><span class="nx">east</span><span class="o">|</span><span class="nx">west</span><span class="p">))</span><span class="o">|</span><span class="nx">south</span><span class="p">(?:</span> <span class="p">?(?:</span><span class="nx">east</span><span class="o">|</span><span class="nx">west</span><span class="p">)))</span><span class="o">|</span><span class="p">(?:</span><span class="nx">nord</span><span class="o">|</span><span class="nx">sud</span><span class="o">|</span><span class="nx">est</span><span class="o">|</span><span class="nx">ouest</span><span class="o">|</span><span class="nx">nord</span><span class="p">(?:[</span><span class="o">-</span> <span class="p">]?(?:</span><span class="nx">est</span><span class="o">|</span><span class="nx">ouest</span><span class="p">))</span><span class="o">|</span><span class="nx">sud</span><span class="p">(?:[</span><span class="o">-</span> <span class="p">]?(?:</span><span class="nx">est</span><span class="o">|</span><span class="nx">ouest</span><span class="p">)))))?</span><span class="o">|</span><span class="p">(?:</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">rural</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">route</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">box</span><span class="o">|</span><span class="nx">comp</span><span class="o">|</span><span class="nx">site</span><span class="o">|</span><span class="nx">lot</span><span class="o">|</span><span class="nx">concession</span><span class="o">|</span><span class="nx">range</span><span class="o">|</span><span class="nx">line</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]?){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">})(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(</span><span class="nx">apt</span><span class="o">|</span><span class="nx">apartment</span><span class="o">|</span><span class="nx">unit</span><span class="o">|</span><span class="nx">suite</span><span class="o">|</span><span class="nx">ste</span><span class="o">|</span><span class="nx">fl</span><span class="o">|</span><span class="nx">floor</span><span class="o">|</span><span class="nx">rm</span><span class="o">|</span><span class="nx">room</span><span class="o">|</span><span class="nx">bldg</span><span class="o">|</span><span class="nx">building</span><span class="o">|</span><span class="nx">dept</span><span class="o">|</span><span class="nx">lot</span><span class="o">|</span><span class="nx">pier</span><span class="o">|</span><span class="nx">slip</span><span class="o">|</span><span class="nx">trlr</span><span class="o">|</span><span class="err">#</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z0</span><span class="o">-</span><span class="mi">9</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">)?)([</span><span class="o">^</span><span class="err">\</span><span class="nx">w</span><span class="p">]</span><span class="o">|</span><span class="nx">$</span><span class="p">)</span><span class="o">|</span><span class="err">\</span><span class="nx">bp</span><span class="err">\</span><span class="p">.?</span> <span class="p">?</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span> <span class="o">*</span><span class="nx">box</span> <span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(</span><span class="se">\</span><span class="s1">s+(?:[a-z][a-z.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*|</span><span class="p">(?:</span><span class="nx">de</span><span class="o">|</span><span class="nx">du</span><span class="o">|</span><span class="nx">des</span><span class="o">|</span><span class="nx">la</span><span class="o">|</span><span class="nx">le</span><span class="o">|</span><span class="nx">les</span><span class="o">|</span><span class="k">of</span><span class="o">|</span><span class="nx">and</span><span class="p">))){</span><span class="mi">0</span><span class="p">,</span><span class="mi">4</span><span class="p">})?(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*|</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)(?:</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">ab</span><span class="o">|</span><span class="nx">bc</span><span class="o">|</span><span class="nx">mb</span><span class="o">|</span><span class="nx">nb</span><span class="o">|</span><span class="nx">nl</span><span class="o">|</span><span class="nx">ns</span><span class="o">|</span><span class="nx">nt</span><span class="o">|</span><span class="nx">nu</span><span class="o">|</span><span class="nx">on</span><span class="o">|</span><span class="nx">pe</span><span class="o">|</span><span class="nx">qc</span><span class="o">|</span><span class="nx">sk</span><span class="o">|</span><span class="nx">yt</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">balberta</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bbritish</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">columbia</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bmanitoba</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnew</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">brunswick</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnewfoundland</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">and</span><span class="o">|&amp;</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">labrador</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnova</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">scotia</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnorthwest</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">territories</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnunavut</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bontario</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bprince</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">edward</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">island</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bquebec</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bsaskatchewan</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">byukon</span><span class="err">\</span><span class="nx">b</span><span class="p">))(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span> <span class="o">-</span><span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="err">\</span><span class="nx">b</span><span class="p">)?</span><span class="o">|</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(</span><span class="se">\</span><span class="s1">s+(?:[a-z][a-z.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*|</span><span class="p">(?:</span><span class="nx">de</span><span class="o">|</span><span class="nx">du</span><span class="o">|</span><span class="nx">des</span><span class="o">|</span><span class="nx">la</span><span class="o">|</span><span class="nx">le</span><span class="o">|</span><span class="nx">les</span><span class="o">|</span><span class="k">of</span><span class="o">|</span><span class="nx">and</span><span class="p">))){</span><span class="mi">0</span><span class="p">,</span><span class="mi">4</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">ab</span><span class="o">|</span><span class="nx">bc</span><span class="o">|</span><span class="nx">mb</span><span class="o">|</span><span class="nx">nb</span><span class="o">|</span><span class="nx">nl</span><span class="o">|</span><span class="nx">ns</span><span class="o">|</span><span class="nx">nt</span><span class="o">|</span><span class="nx">nu</span><span class="o">|</span><span class="nx">on</span><span class="o">|</span><span class="nx">pe</span><span class="o">|</span><span class="nx">qc</span><span class="o">|</span><span class="nx">sk</span><span class="o">|</span><span class="nx">yt</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">balberta</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bbritish</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">columbia</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bmanitoba</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnew</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">brunswick</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnewfoundland</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">and</span><span class="o">|&amp;</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">labrador</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnova</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">scotia</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnorthwest</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">territories</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bnunavut</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bontario</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bprince</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">edward</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">island</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bquebec</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bsaskatchewan</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">byukon</span><span class="err">\</span><span class="nx">b</span><span class="p">))(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span> <span class="o">-</span><span class="p">]?</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="err">\</span><span class="nx">b</span><span class="p">)?</span><span class="o">|</span><span class="err">\</span><span class="nx">bp</span><span class="err">\</span><span class="p">.?</span> <span class="p">?</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span> <span class="o">*</span><span class="nx">box</span> <span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span>
</code></pre></div></div>

<h4 id="street-address-france">Street address (France)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">((?:</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">ap</span><span class="p">(?:</span><span class="nx">t</span><span class="o">|</span><span class="nx">part</span><span class="o">|</span><span class="nx">artment</span><span class="o">|</span><span class="nx">partement</span><span class="p">)</span><span class="o">|</span><span class="nx">batiment</span><span class="o">|</span><span class="nx">bureau</span><span class="o">|</span><span class="nx">bâtiment</span><span class="o">|</span><span class="nx">ste</span><span class="o">|</span><span class="nx">suite</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="err">#</span><span class="o">/-</span><span class="p">]</span><span class="o">+</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">)?</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">,?</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">av</span><span class="o">|</span><span class="nx">bd</span><span class="o">|</span><span class="nx">allee</span><span class="o">|</span><span class="nx">allée</span><span class="o">|</span><span class="nx">ave</span><span class="o">|</span><span class="nx">avenue</span><span class="o">|</span><span class="nx">lieudit</span><span class="o">|</span><span class="nx">lieu</span><span class="o">-</span><span class="nx">dit</span><span class="o">|</span><span class="nx">rue</span><span class="o">|</span><span class="nx">ruechemin</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">carre</span><span class="o">|</span><span class="nx">cercle</span><span class="o">|</span><span class="nx">chemain</span><span class="o">|</span><span class="nx">court</span><span class="o">|</span><span class="nx">croissant</span><span class="o">|</span><span class="nx">descente</span><span class="o">|</span><span class="nx">impasse</span><span class="o">|</span><span class="nx">montee</span><span class="o">|</span><span class="nx">promenade</span><span class="o">|</span><span class="nx">quai</span><span class="o">|</span><span class="nx">rang</span><span class="o">|</span><span class="nx">route</span><span class="o">|</span><span class="nx">terrasse</span><span class="o">|</span><span class="nx">voie</span><span class="p">)(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">bde</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bdes</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bdu</span><span class="err">\</span><span class="nx">b</span><span class="p">))?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">bla</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">ble</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bles</span><span class="err">\</span><span class="nx">b</span><span class="p">))?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-0-9]+){0,3}(?:</span><span class="se">\</span><span class="s1">s*,?</span><span class="se">\</span><span class="s1">s*(nord|sud|est|ouest))?(?:(?:</span><span class="se">\</span><span class="s1">s*,</span><span class="se">\</span><span class="s1">s*(?:(boîte postale|b</span><span class="se">\</span><span class="s1">.?p</span><span class="se">\</span><span class="s1">.?)</span><span class="se">\</span><span class="s1">s+</span><span class="se">\</span><span class="s1">d+|(?:</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">d{5}</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">s+)?(?:(le|la|les)</span><span class="se">\</span><span class="s1">s+)?[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">))</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="nx">france</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:(</span><span class="nx">boîte</span> <span class="nx">postale</span><span class="o">|</span><span class="nx">b</span><span class="err">\</span><span class="p">.?</span><span class="nx">p</span><span class="err">\</span><span class="p">.?)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="o">+|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)?(?:(</span><span class="nx">le</span><span class="o">|</span><span class="nx">la</span><span class="o">|</span><span class="nx">les</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)?[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*))+|</span><span class="se">\</span><span class="s1">b(lieu-dit)(</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="p">]</span><span class="o">+</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}(?:(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:(</span><span class="nx">boîte</span> <span class="nx">postale</span><span class="o">|</span><span class="nx">b</span><span class="err">\</span><span class="p">.?</span><span class="nx">p</span><span class="err">\</span><span class="p">.?)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="o">+|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)?(?:(</span><span class="nx">le</span><span class="o">|</span><span class="nx">la</span><span class="o">|</span><span class="nx">les</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)?[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*))*</span><span class="se">\</span><span class="s1">s*,</span><span class="se">\</span><span class="s1">s*france</span><span class="se">\</span><span class="s1">b|(?:</span><span class="se">\</span><span class="s1">s*,</span><span class="se">\</span><span class="s1">s*(?:(boîte postale|b</span><span class="se">\</span><span class="s1">.?p</span><span class="se">\</span><span class="s1">.?)</span><span class="se">\</span><span class="s1">s+</span><span class="se">\</span><span class="s1">d+|(?:</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">d{5}</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">s+)?(?:(le|la|les)</span><span class="se">\</span><span class="s1">s+)?[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">))</span><span class="o">+</span><span class="p">)</span><span class="o">|</span><span class="p">(</span><span class="nx">boîte</span> <span class="nx">postale</span><span class="o">|</span><span class="nx">b</span><span class="err">\</span><span class="p">.?</span><span class="nx">p</span><span class="err">\</span><span class="p">.?)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">(?:(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:(</span><span class="nx">boîte</span> <span class="nx">postale</span><span class="o">|</span><span class="nx">b</span><span class="err">\</span><span class="p">.?</span><span class="nx">p</span><span class="err">\</span><span class="p">.?)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="o">+|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)?(?:(</span><span class="nx">le</span><span class="o">|</span><span class="nx">la</span><span class="o">|</span><span class="nx">les</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)?[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*))*</span><span class="se">\</span><span class="s1">s*,</span><span class="se">\</span><span class="s1">s*france</span><span class="se">\</span><span class="s1">b|(?:</span><span class="se">\</span><span class="s1">s*,</span><span class="se">\</span><span class="s1">s*(?:(boîte postale|b</span><span class="se">\</span><span class="s1">.?p</span><span class="se">\</span><span class="s1">.?)</span><span class="se">\</span><span class="s1">s+</span><span class="se">\</span><span class="s1">d+|(?:</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">d{5}</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">s+)?(?:(le|la|les)</span><span class="se">\</span><span class="s1">s+)?[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">))</span><span class="o">+</span><span class="p">)</span><span class="o">|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">ap</span><span class="p">(?:</span><span class="nx">t</span><span class="o">|</span><span class="nx">part</span><span class="o">|</span><span class="nx">artment</span><span class="o">|</span><span class="nx">partement</span><span class="p">)</span><span class="o">|</span><span class="nx">batiment</span><span class="o">|</span><span class="nx">bureau</span><span class="o">|</span><span class="nx">bâtiment</span><span class="o">|</span><span class="nx">ste</span><span class="o">|</span><span class="nx">suite</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="err">#</span><span class="o">/-</span><span class="p">]</span><span class="o">+</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">)?</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">,?</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">av</span><span class="o">|</span><span class="nx">bd</span><span class="o">|</span><span class="nx">allee</span><span class="o">|</span><span class="nx">allée</span><span class="o">|</span><span class="nx">ave</span><span class="o">|</span><span class="nx">avenue</span><span class="o">|</span><span class="nx">lieudit</span><span class="o">|</span><span class="nx">lieu</span><span class="o">-</span><span class="nx">dit</span><span class="o">|</span><span class="nx">rue</span><span class="o">|</span><span class="nx">ruechemin</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">carre</span><span class="o">|</span><span class="nx">cercle</span><span class="o">|</span><span class="nx">chemain</span><span class="o">|</span><span class="nx">court</span><span class="o">|</span><span class="nx">croissant</span><span class="o">|</span><span class="nx">descente</span><span class="o">|</span><span class="nx">impasse</span><span class="o">|</span><span class="nx">montee</span><span class="o">|</span><span class="nx">promenade</span><span class="o">|</span><span class="nx">quai</span><span class="o">|</span><span class="nx">rang</span><span class="o">|</span><span class="nx">route</span><span class="o">|</span><span class="nx">terrasse</span><span class="o">|</span><span class="nx">voie</span><span class="p">)(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">bde</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bdes</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bdu</span><span class="err">\</span><span class="nx">b</span><span class="p">))?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">bla</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">ble</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">bles</span><span class="err">\</span><span class="nx">b</span><span class="p">))?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-0-9]+){0,3}(?:</span><span class="se">\</span><span class="s1">s*,?</span><span class="se">\</span><span class="s1">s*(nord|sud|est|ouest))?|(boîte postale|b</span><span class="se">\</span><span class="s1">.?p</span><span class="se">\</span><span class="s1">.?)</span><span class="se">\</span><span class="s1">s+</span><span class="se">\</span><span class="s1">d+)
</span></code></pre></div></div>

<h4 id="street-address-germany">Street address (Germany)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">((?</span><span class="nx">i</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="p">((?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">ZÄÖÜ</span><span class="p">])(?</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]</span><span class="o">*</span><span class="p">)</span> <span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]([</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]</span><span class="o">|-</span><span class="p">)</span><span class="o">+</span> <span class="p">(</span><span class="nx">allee</span><span class="o">|</span><span class="nx">bleiche</span><span class="o">|</span><span class="nx">berg</span><span class="o">|</span><span class="nx">bruck</span><span class="o">|</span><span class="nx">brucke</span><span class="o">|</span><span class="nx">gang</span><span class="o">|</span><span class="nx">gasse</span><span class="o">|</span><span class="nx">gaße</span><span class="o">|</span><span class="nx">heide</span><span class="o">|</span><span class="nx">hof</span><span class="o">|</span><span class="nx">hofen</span><span class="o">|</span><span class="nx">kai</span><span class="o">|</span><span class="nx">kamp</span><span class="o">|</span><span class="nx">lande</span><span class="o">|</span><span class="nx">linden</span><span class="o">|</span><span class="nx">park</span><span class="o">|</span><span class="nx">plan</span><span class="o">|</span><span class="nx">platz</span><span class="o">|</span><span class="nx">ring</span><span class="o">|</span><span class="nx">steg</span><span class="o">|</span><span class="nx">steig</span><span class="o">|</span><span class="nx">str</span><span class="o">|</span><span class="nx">str</span><span class="p">.</span><span class="o">|</span><span class="nx">strasse</span><span class="o">|</span><span class="nx">straße</span><span class="o">|</span><span class="nx">weg</span><span class="o">|</span><span class="nx">wieke</span><span class="o">|</span><span class="nx">zeile</span><span class="o">|</span><span class="nx">zufahrt</span><span class="p">)</span><span class="o">|</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]([</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]</span><span class="o">|-</span><span class="p">)</span><span class="o">+</span> <span class="p">(</span><span class="nx">allee</span><span class="o">|</span><span class="nx">bleiche</span><span class="o">|</span><span class="nx">berg</span><span class="o">|</span><span class="nx">bruck</span><span class="o">|</span><span class="nx">brucke</span><span class="o">|</span><span class="nx">gang</span><span class="o">|</span><span class="nx">gasse</span><span class="o">|</span><span class="nx">gaße</span><span class="o">|</span><span class="nx">heide</span><span class="o">|</span><span class="nx">hof</span><span class="o">|</span><span class="nx">hofen</span><span class="o">|</span><span class="nx">kai</span><span class="o">|</span><span class="nx">kamp</span><span class="o">|</span><span class="nx">lande</span><span class="o">|</span><span class="nx">linden</span><span class="o">|</span><span class="nx">park</span><span class="o">|</span><span class="nx">plan</span><span class="o">|</span><span class="nx">platz</span><span class="o">|</span><span class="nx">ring</span><span class="o">|</span><span class="nx">steg</span><span class="o">|</span><span class="nx">steig</span><span class="o">|</span><span class="nx">str</span><span class="o">|</span><span class="nx">str</span><span class="p">.</span><span class="o">|</span><span class="nx">strasse</span><span class="o">|</span><span class="nx">straße</span><span class="o">|</span><span class="nx">weg</span><span class="o">|</span><span class="nx">wieke</span><span class="o">|</span><span class="nx">zeile</span><span class="o">|</span><span class="nx">zufahrt</span><span class="p">)</span><span class="o">|</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]([</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]</span><span class="o">|-</span><span class="p">)</span><span class="o">+</span><span class="p">(</span><span class="nx">allee</span><span class="o">|</span><span class="nx">bleiche</span><span class="o">|</span><span class="nx">berg</span><span class="o">|</span><span class="nx">bruck</span><span class="o">|</span><span class="nx">brucke</span><span class="o">|</span><span class="nx">gang</span><span class="o">|</span><span class="nx">gasse</span><span class="o">|</span><span class="nx">gaße</span><span class="o">|</span><span class="nx">heide</span><span class="o">|</span><span class="nx">hof</span><span class="o">|</span><span class="nx">hofen</span><span class="o">|</span><span class="nx">kai</span><span class="o">|</span><span class="nx">kamp</span><span class="o">|</span><span class="nx">lande</span><span class="o">|</span><span class="nx">linden</span><span class="o">|</span><span class="nx">park</span><span class="o">|</span><span class="nx">plan</span><span class="o">|</span><span class="nx">platz</span><span class="o">|</span><span class="nx">ring</span><span class="o">|</span><span class="nx">steg</span><span class="o">|</span><span class="nx">steig</span><span class="o">|</span><span class="nx">str</span><span class="o">|</span><span class="nx">str</span><span class="p">.</span><span class="o">|</span><span class="nx">strasse</span><span class="o">|</span><span class="nx">straße</span><span class="o">|</span><span class="nx">weg</span><span class="o">|</span><span class="nx">wieke</span><span class="o">|</span><span class="nx">zeile</span><span class="o">|</span><span class="nx">zufahrt</span><span class="p">))</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">[,;]?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="mi">1</span><span class="p">?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">}[</span><span class="nx">a</span><span class="o">-</span><span class="nx">eA</span><span class="o">-</span><span class="nx">E</span><span class="p">]?</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">([,;]</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">)?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]([</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]</span><span class="o">|-</span><span class="p">)</span><span class="o">+</span><span class="p">(</span> <span class="nx">am</span> <span class="p">(</span><span class="nx">main</span><span class="o">|</span><span class="nx">rhein</span><span class="o">|</span><span class="nx">donau</span><span class="o">|</span><span class="nx">elbe</span><span class="o">|</span><span class="nx">weser</span><span class="o">|</span><span class="nx">neckar</span><span class="o">|</span><span class="nx">tauber</span><span class="o">|</span><span class="nx">oder</span><span class="o">|</span><span class="nx">pfalz</span><span class="p">))?)?)</span><span class="o">|</span><span class="p">((</span><span class="nx">Postfach</span><span class="o">|</span><span class="nx">PF</span><span class="p">)</span> <span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span> <span class="err">\</span><span class="nx">d</span><span class="p">]</span><span class="o">+</span><span class="p">)(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">([,;]</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">)?</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]([</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zäöüÄÖß</span><span class="p">]</span><span class="o">|-</span><span class="p">)</span><span class="o">+</span><span class="p">(</span> <span class="nx">am</span> <span class="p">(</span><span class="nx">main</span><span class="o">|</span><span class="nx">rhein</span><span class="o">|</span><span class="nx">donau</span><span class="o">|</span><span class="nx">elbe</span><span class="o">|</span><span class="nx">weser</span><span class="o">|</span><span class="nx">neckar</span><span class="o">|</span><span class="nx">tauber</span><span class="o">|</span><span class="nx">oder</span><span class="o">|</span><span class="nx">pfalz</span><span class="p">))?)?</span>
</code></pre></div></div>

<h4 id="street-address-indonesia">Street address (Indonesia)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">jl</span><span class="o">|</span><span class="nx">kp</span><span class="o">|</span><span class="nx">residence</span><span class="o">|</span><span class="nx">residance</span><span class="o">|</span><span class="nx">jalan</span><span class="o">|</span><span class="nx">jln</span><span class="o">|</span><span class="nx">cluster</span><span class="o">|</span><span class="nx">kompl</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="o">+</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">10</span><span class="p">}(?:(?:</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="err">#</span><span class="p">]</span><span class="o">*</span><span class="p">(?:</span><span class="o">-</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="o">+</span><span class="p">)?</span><span class="o">|</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">z</span><span class="err">#</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">z</span><span class="err">#</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">)(?:</span><span class="sr">/</span><span class="se">[\d</span><span class="sr">a-z#-</span><span class="se">]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[^\s\/</span><span class="sr">,</span><span class="se">]</span><span class="sr">+</span><span class="se">\/[^\s\/</span><span class="sr">,</span><span class="se">]</span><span class="sr">+</span><span class="se">(\/[^\s\/</span><span class="sr">,</span><span class="se">]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">)(?:\s</span><span class="sr">+no</span><span class="se">\.?\s</span><span class="sr">*</span><span class="se">(?:(?:\d</span><span class="sr">+</span><span class="se">[</span><span class="sr">a-z#</span><span class="se">]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[\d</span><span class="sr">a-z</span><span class="se">]</span><span class="sr">+</span><span class="se">)?</span><span class="sr">|</span><span class="se">[\d</span><span class="sr">a-z#-</span><span class="se">]</span><span class="sr">*</span><span class="se">\d[\d</span><span class="sr">a-z#-</span><span class="se">]</span><span class="sr">*</span><span class="se">)(?:</span><span class="sr">/</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">z</span><span class="err">#</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">)</span><span class="o">*|</span><span class="p">[</span><span class="o">^</span><span class="err">\</span><span class="nx">s</span><span class="err">\</span><span class="o">/</span><span class="p">,]</span><span class="o">+</span><span class="err">\</span><span class="o">/</span><span class="p">[</span><span class="o">^</span><span class="err">\</span><span class="nx">s</span><span class="err">\</span><span class="o">/</span><span class="p">,]</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="o">/</span><span class="p">[</span><span class="o">^</span><span class="err">\</span><span class="nx">s</span><span class="err">\</span><span class="o">/</span><span class="p">,]</span><span class="o">+</span><span class="p">)</span><span class="o">*</span><span class="p">))</span><span class="o">*</span><span class="p">((</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(</span><span class="nx">bl</span><span class="o">|</span><span class="nx">rt</span><span class="o">|</span><span class="nx">rw</span><span class="o">|</span><span class="nx">blk</span><span class="o">|</span><span class="nx">blok</span><span class="p">))((?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+|</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">)((?:</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="err">#</span><span class="p">]</span><span class="o">*</span><span class="p">(?:</span><span class="o">-</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="o">+</span><span class="p">)?</span><span class="o">|</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">z</span><span class="err">#</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">z</span><span class="err">#</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">)(?:</span><span class="sr">/</span><span class="se">[\d</span><span class="sr">a-z#-</span><span class="se">]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[^\s\/</span><span class="sr">,</span><span class="se">]</span><span class="sr">+</span><span class="se">\/[^\s\/</span><span class="sr">,</span><span class="se">]</span><span class="sr">+</span><span class="se">(\/[^\s\/</span><span class="sr">,</span><span class="se">]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">)</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">(\s</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">rt|rw</span><span class="se">)(?:\.?\s</span><span class="sr">*|</span><span class="se">\s</span><span class="sr">+</span><span class="se">)((?:\d</span><span class="sr">+</span><span class="se">[</span><span class="sr">a-z#</span><span class="se">]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[\d</span><span class="sr">a-z</span><span class="se">]</span><span class="sr">+</span><span class="se">)?</span><span class="sr">|</span><span class="se">[\d</span><span class="sr">a-z#-</span><span class="se">]</span><span class="sr">*</span><span class="se">\d[\d</span><span class="sr">a-z#-</span><span class="se">]</span><span class="sr">*</span><span class="se">)(?:</span><span class="sr">/</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">z</span><span class="err">#</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">)</span><span class="o">*|</span><span class="p">[</span><span class="o">^</span><span class="err">\</span><span class="nx">s</span><span class="err">\</span><span class="o">/</span><span class="p">,]</span><span class="o">+</span><span class="err">\</span><span class="o">/</span><span class="p">[</span><span class="o">^</span><span class="err">\</span><span class="nx">s</span><span class="err">\</span><span class="o">/</span><span class="p">,]</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="o">/</span><span class="p">[</span><span class="o">^</span><span class="err">\</span><span class="nx">s</span><span class="err">\</span><span class="o">/</span><span class="p">,]</span><span class="o">+</span><span class="p">)</span><span class="o">*</span><span class="p">)</span><span class="o">+</span><span class="p">)?)?(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:</span><span class="nx">Kecamatan</span><span class="o">|</span><span class="nx">Kelurahan</span><span class="o">|</span><span class="nx">Kota</span><span class="o">|</span><span class="nx">Kabupaten</span><span class="o">|</span><span class="nx">Provinsi</span><span class="o">|</span><span class="nx">Desa</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="o">*</span><span class="p">(?:[</span> <span class="o">-</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="o">+</span><span class="p">)</span><span class="o">*</span><span class="p">)(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:</span><span class="nx">Kecamatan</span><span class="o">|</span><span class="nx">Kelurahan</span><span class="o">|</span><span class="nx">Kota</span><span class="o">|</span><span class="nx">Kabupaten</span><span class="o">|</span><span class="nx">Provinsi</span><span class="o">|</span><span class="nx">Desa</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="o">*</span><span class="p">(?:[</span> <span class="o">-</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="o">+</span><span class="p">)</span><span class="o">*</span><span class="p">))</span><span class="o">*</span><span class="p">(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="o">*</span><span class="p">(?:[</span> <span class="o">-</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="o">+</span><span class="p">)</span><span class="o">*</span><span class="p">))</span><span class="o">*</span><span class="p">(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="p">)?)?</span>
</code></pre></div></div>

<h4 id="street-address-italy">Street address (Italy)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">((?:</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">app</span><span class="o">|</span><span class="nx">appartamento</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="err">#</span><span class="o">/-</span><span class="p">]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">)?</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">sp</span><span class="o">|</span><span class="nx">al</span><span class="p">(?:</span><span class="nx">lea</span><span class="o">|</span><span class="nx">lee</span><span class="o">|</span><span class="nx">lée</span><span class="o">|</span><span class="nx">inea</span><span class="o">|</span><span class="nx">zaia</span><span class="p">)</span><span class="o">|</span><span class="nx">androna</span><span class="o">|</span><span class="nx">angiporto</span><span class="o">|</span><span class="nx">arco</span><span class="o">|</span><span class="nx">archivolto</span><span class="o">|</span><span class="nx">ar</span><span class="p">(?:</span><span class="nx">co</span><span class="o">|</span><span class="nx">ena</span><span class="o">|</span><span class="nx">gine</span><span class="o">|</span><span class="nx">chivolto</span><span class="p">)</span><span class="o">|</span><span class="nx">ba</span><span class="p">(?:</span><span class="nx">cino</span><span class="o">|</span><span class="nx">nchi</span><span class="o">|</span><span class="nx">luardo</span><span class="o">|</span><span class="nx">nchina</span><span class="o">|</span><span class="nx">stione</span><span class="o">|</span><span class="nx">stioni</span><span class="p">)</span><span class="o">|</span><span class="nx">bor</span><span class="p">(?:</span><span class="nx">go</span><span class="o">|</span><span class="nx">gata</span><span class="o">|</span><span class="nx">goloco</span><span class="p">)</span><span class="o">|</span><span class="nx">cal</span><span class="p">(?:</span><span class="nx">le</span><span class="o">|</span><span class="nx">ata</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">campo</span><span class="o">|</span><span class="nx">campiello</span><span class="o">|</span><span class="nx">canale</span><span class="o">|</span><span class="nx">cantone</span><span class="o">|</span><span class="nx">car</span><span class="p">(?:</span><span class="nx">ro</span><span class="o">|</span><span class="nx">raia</span><span class="o">|</span><span class="nx">rara</span><span class="o">|</span><span class="nx">rarone</span><span class="p">)</span><span class="o">|</span><span class="nx">ca</span><span class="p">(?:</span><span class="nx">l</span><span class="o">|</span><span class="nx">lle</span><span class="o">|</span><span class="nx">mpo</span><span class="o">|</span><span class="nx">rro</span><span class="o">|</span><span class="nx">lata</span><span class="o">|</span><span class="nx">nale</span><span class="o">|</span><span class="nx">vone</span><span class="o">|</span><span class="nx">ntone</span><span class="o">|</span><span class="nx">rraia</span><span class="o">|</span><span class="nx">rrara</span><span class="o">|</span><span class="nx">scina</span><span class="o">|</span><span class="nx">mpiello</span><span class="o">|</span><span class="nx">rrarone</span><span class="o">|</span><span class="nx">valcavia</span><span class="p">)</span><span class="o">|</span><span class="nx">chi</span><span class="p">(?:</span><span class="nx">asso</span><span class="o">|</span><span class="nx">assetto</span><span class="o">|</span><span class="nx">assuola</span><span class="p">)</span><span class="o">|</span><span class="nx">circonvallazione</span><span class="o">|</span><span class="nx">circumvallazione</span><span class="o">|</span><span class="nx">clivo</span><span class="o">|</span><span class="nx">clivio</span><span class="o">|</span><span class="nx">claustro</span><span class="o">|</span><span class="nx">co</span><span class="p">(?:</span><span class="nx">rso</span><span class="o">|</span><span class="nx">rte</span><span class="o">|</span><span class="nx">sta</span><span class="o">|</span><span class="nx">rsia</span><span class="o">|</span><span class="nx">rtile</span><span class="o">|</span><span class="nx">ntrada</span><span class="o">|</span><span class="nx">rsetto</span><span class="o">|</span><span class="nx">rtesela</span><span class="o">|</span><span class="nx">mplanare</span><span class="o">|</span><span class="nx">rticella</span><span class="p">)</span><span class="o">|</span><span class="nx">crosa</span><span class="o">|</span><span class="nx">crocicchio</span><span class="o">|</span><span class="nx">discesa</span><span class="o">|</span><span class="nx">distacco</span><span class="o">|</span><span class="nx">diramazione</span><span class="o">|</span><span class="nx">fon</span><span class="p">(?:</span><span class="k">do</span><span class="o">|</span><span class="nx">daco</span><span class="o">|</span><span class="nx">damenta</span><span class="p">)</span><span class="o">|</span><span class="nx">fossa</span><span class="o">|</span><span class="nx">fossato</span><span class="o">|</span><span class="nx">gra</span><span class="p">(?:</span><span class="nx">dini</span><span class="o">|</span><span class="nx">doni</span><span class="o">|</span><span class="nx">dinata</span><span class="o">|</span><span class="nx">nviale</span><span class="p">)</span><span class="o">|</span><span class="nx">largo</span><span class="o">|</span><span class="nx">larghetto</span><span class="o">|</span><span class="nx">largo</span><span class="o">|</span><span class="nx">laterale</span><span class="o">|</span><span class="nx">larghetto</span><span class="o">|</span><span class="nx">lido</span><span class="o">|</span><span class="nx">lista</span><span class="o">|</span><span class="nx">litoranea</span><span class="o">|</span><span class="nx">lun</span><span class="p">(?:</span><span class="nx">go</span><span class="o">|</span><span class="nx">garno</span><span class="o">|</span><span class="nx">gadige</span><span class="o">|</span><span class="nx">goadda</span><span class="o">|</span><span class="nx">godora</span><span class="o">|</span><span class="nx">golago</span><span class="o">|</span><span class="nx">goliri</span><span class="o">|</span><span class="nx">gomare</span><span class="o">|</span><span class="nx">gomolo</span><span class="o">|</span><span class="nx">gonera</span><span class="o">|</span><span class="nx">gosile</span><span class="o">|</span><span class="nx">gocrati</span><span class="o">|</span><span class="nx">gofiume</span><span class="o">|</span><span class="nx">gogesso</span><span class="o">|</span><span class="nx">golario</span><span class="o">|</span><span class="nx">golinea</span><span class="o">|</span><span class="nx">goparco</span><span class="o">|</span><span class="nx">goporto</span><span class="o">|</span><span class="nx">gosonao</span><span class="o">|</span><span class="nx">gostura</span><span class="o">|</span><span class="nx">gocalore</span><span class="o">|</span><span class="nx">gocanale</span><span class="o">|</span><span class="nx">gocurone</span><span class="o">|</span><span class="nx">gofoglia</span><span class="o">|</span><span class="nx">goisarco</span><span class="o">|</span><span class="nx">gomazaro</span><span class="o">|</span><span class="nx">gosabato</span><span class="o">|</span><span class="nx">gotanaro</span><span class="o">|</span><span class="nx">gotevere</span><span class="o">|</span><span class="nx">goticino</span><span class="o">|</span><span class="nx">gotronto</span><span class="o">|</span><span class="nx">govelino</span><span class="o">|</span><span class="nx">gobisagno</span><span class="o">|</span><span class="nx">gobusento</span><span class="o">|</span><span class="nx">gotalvera</span><span class="o">|</span><span class="nx">gotorrente</span><span class="p">)</span><span class="o">|</span><span class="nx">pa</span><span class="p">(?:</span><span class="nx">sso</span><span class="o">|</span><span class="nx">rallela</span><span class="o">|</span><span class="nx">ssaggio</span><span class="o">|</span><span class="nx">sseggio</span><span class="o">|</span><span class="nx">sseggiata</span><span class="p">)</span><span class="o">|</span><span class="nx">pen</span><span class="p">(?:</span><span class="nx">dio</span><span class="o">|</span><span class="nx">dice</span><span class="o">|</span><span class="nx">dino</span><span class="o">|</span><span class="nx">ninata</span><span class="p">)</span><span class="o">|</span><span class="nx">pia</span><span class="p">(?:</span><span class="nx">zza</span><span class="o">|</span><span class="nx">ggia</span><span class="o">|</span><span class="nx">zzale</span><span class="o">|</span><span class="nx">zzetta</span><span class="p">)</span><span class="o">|</span><span class="nx">pi</span><span class="p">(?:</span><span class="nx">azza</span><span class="o">|</span><span class="nx">aggia</span><span class="o">|</span><span class="nx">scina</span><span class="o">|</span><span class="nx">azzale</span><span class="o">|</span><span class="nx">azzetta</span><span class="p">)</span><span class="o">|</span><span class="nx">ponte</span><span class="o">|</span><span class="nx">porto</span><span class="o">|</span><span class="nx">portico</span><span class="o">|</span><span class="nx">prato</span><span class="o">|</span><span class="nx">prolungamento</span><span class="o">|</span><span class="nx">ra</span><span class="p">(?:</span><span class="nx">mo</span><span class="o">|</span><span class="nx">mpa</span><span class="o">|</span><span class="nx">mpe</span><span class="o">|</span><span class="nx">tto</span><span class="o">|</span><span class="nx">ggio</span><span class="o">|</span><span class="nx">mpari</span><span class="p">)</span><span class="o">|</span><span class="nx">re</span><span class="p">(?:</span><span class="nx">cinto</span><span class="o">|</span><span class="nx">gaste</span><span class="o">|</span><span class="nx">gione</span><span class="o">|</span><span class="nx">ttifilo</span><span class="p">)</span><span class="o">|</span><span class="nx">ri</span><span class="p">(?:</span><span class="nx">o</span><span class="o">|</span><span class="nx">pa</span><span class="o">|</span><span class="nx">va</span><span class="o">|</span><span class="nx">one</span><span class="o">|</span><span class="nx">ello</span><span class="o">|</span><span class="nx">viera</span><span class="p">)</span><span class="o">|</span><span class="nx">rua</span><span class="o">|</span><span class="nx">ruga</span><span class="o">|</span><span class="nx">rugheta</span><span class="o">|</span><span class="nx">sa</span><span class="p">(?:</span><span class="nx">ia</span><span class="o">|</span><span class="nx">cca</span><span class="o">|</span><span class="nx">lita</span><span class="o">|</span><span class="nx">grato</span><span class="o">|</span><span class="nx">lizada</span><span class="p">)</span><span class="o">|</span><span class="nx">sca</span><span class="p">(?:</span><span class="nx">lea</span><span class="o">|</span><span class="nx">lone</span><span class="o">|</span><span class="nx">lette</span><span class="o">|</span><span class="nx">linata</span><span class="p">)</span><span class="o">|</span><span class="nx">sc</span><span class="p">(?:</span><span class="nx">esa</span><span class="o">|</span><span class="nx">alea</span><span class="o">|</span><span class="nx">alone</span><span class="o">|</span><span class="nx">alette</span><span class="o">|</span><span class="nx">alinata</span><span class="p">)</span><span class="o">|</span><span class="nx">selciato</span><span class="o">|</span><span class="nx">sentiero</span><span class="o">|</span><span class="nx">sopportico</span><span class="o">|</span><span class="nx">sotoportego</span><span class="o">|</span><span class="nx">sottoportico</span><span class="o">|</span><span class="nx">sp</span><span class="p">(?:</span><span class="nx">alto</span><span class="o">|</span><span class="nx">iazzo</span><span class="o">|</span><span class="nx">iaggia</span><span class="o">|</span><span class="nx">ianata</span><span class="p">)</span><span class="o">|</span><span class="nx">str</span><span class="p">(?:</span><span class="nx">ada</span><span class="o">|</span><span class="nx">etta</span><span class="o">|</span><span class="nx">etto</span><span class="o">|</span><span class="nx">adale</span><span class="o">|</span><span class="nx">adone</span><span class="o">|</span><span class="nx">adella</span><span class="o">|</span><span class="nx">adello</span><span class="o">|</span><span class="nx">adetta</span><span class="o">|</span><span class="nx">ettoia</span><span class="o">|</span><span class="nx">ettola</span><span class="o">|</span><span class="nx">adoncello</span><span class="p">)</span><span class="o">|</span><span class="nx">tra</span><span class="p">(?:</span><span class="nx">tturo</span><span class="o">|</span><span class="nx">versa</span><span class="o">|</span><span class="nx">zzera</span><span class="o">|</span><span class="nx">versale</span><span class="o">|</span><span class="nx">sversale</span><span class="p">)</span><span class="o">|</span><span class="nx">tr</span><span class="p">(?:</span><span class="nx">onco</span><span class="o">|</span><span class="nx">atturo</span><span class="o">|</span><span class="nx">aversa</span><span class="o">|</span><span class="nx">azzera</span><span class="o">|</span><span class="nx">esanda</span><span class="o">|</span><span class="nx">aversale</span><span class="o">|</span><span class="nx">asversale</span><span class="p">)</span><span class="o">|</span><span class="nx">vallone</span><span class="o">|</span><span class="nx">vanella</span><span class="o">|</span><span class="nx">via</span><span class="p">(?:</span><span class="nx">l</span><span class="o">|</span><span class="nx">le</span><span class="o">|</span><span class="nx">lone</span><span class="o">|</span><span class="nx">letto</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">vic</span><span class="p">(?:</span><span class="nx">o</span><span class="o">|</span><span class="nx">olo</span><span class="o">|</span><span class="nx">inale</span><span class="o">|</span><span class="nx">oletto</span><span class="p">)</span><span class="o">|</span><span class="nx">viella</span><span class="o">|</span><span class="nx">vietta</span><span class="o">|</span><span class="nx">vi</span><span class="p">(?:</span><span class="nx">a</span><span class="o">|</span><span class="nx">al</span><span class="o">|</span><span class="nx">co</span><span class="o">|</span><span class="nx">ale</span><span class="o">|</span><span class="nx">colo</span><span class="o">|</span><span class="nx">ella</span><span class="o">|</span><span class="nx">etta</span><span class="o">|</span><span class="nx">uzza</span><span class="o">|</span><span class="nx">uzzo</span><span class="o">|</span><span class="nx">alone</span><span class="o">|</span><span class="nx">aletto</span><span class="o">|</span><span class="nx">cinale</span><span class="o">|</span><span class="nx">ottolo</span><span class="o">|</span><span class="nx">coletto</span><span class="o">|</span><span class="nx">llaggio</span><span class="p">)</span><span class="o">|</span><span class="nx">volti</span><span class="o">|</span><span class="nx">voltone</span><span class="o">|</span><span class="nx">vocabolo</span><span class="o">|</span><span class="nx">accesso</span><span class="o">|</span><span class="nx">belvedere</span><span class="o">|</span><span class="nx">bivio</span><span class="o">|</span><span class="nx">cupa</span><span class="o">|</span><span class="nx">emiciclo</span><span class="o">|</span><span class="nx">erta</span><span class="o">|</span><span class="nx">estramurale</span><span class="o">|</span><span class="nx">frazione</span><span class="o">|</span><span class="nx">galleria</span><span class="o">|</span><span class="nx">isola</span><span class="o">|</span><span class="nx">masseria</span><span class="o">|</span><span class="nx">merceria</span><span class="o">|</span><span class="nx">molo</span><span class="o">|</span><span class="nx">mura</span><span class="o">|</span><span class="nx">quadrato</span><span class="o">|</span><span class="nx">rotonda</span><span class="o">|</span><span class="nx">sdrucciolo</span><span class="o">|</span><span class="nx">slargo</span><span class="o">|</span><span class="nx">supportico</span><span class="o">|</span><span class="nx">svoto</span><span class="o">|</span><span class="nx">terrazza</span><span class="o">|</span><span class="nx">tondo</span><span class="p">)</span><span class="err">\</span><span class="p">.?(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*){0,4}(?:[,</span><span class="se">\</span><span class="s1">.]?</span><span class="se">\</span><span class="s1">s+)</span><span class="se">\</span><span class="s1">d[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ#/-]*</span><span class="se">\</span><span class="s1">.?(?:</span><span class="se">\</span><span class="s1">s*,</span><span class="se">\</span><span class="s1">s*</span><span class="se">\</span><span class="s1">b(app|appartamento)</span><span class="se">\</span><span class="s1">.?</span><span class="se">\</span><span class="s1">s+</span><span class="se">\</span><span class="s1">d[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ#/-]*)?(?:</span><span class="se">\</span><span class="s1">s*,</span><span class="se">\</span><span class="s1">s*(?:</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">d{5}</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*){0,1}</span><span class="se">\</span><span class="s1">s+</span><span class="se">\</span><span class="s1">b(AG|AL|AN|AO|AP|AQ|AR|AT|AV|BA|BG|BI|BL|BN|BO|BR|BS|BT|BZ|CA|CB|CE|CH|CI|CL|CN|CO|CR|CS|CT|CZ|EN|FC|FE|FG|FI|FM|FR|GE|GO|GR|IM|IS|KR|LC|LE|LI|LO|LT|LU|MB|MC|ME|MI|MN|MO|MS|MT|NA|NO|NU|OG|OR|OT|PA|PC|PD|PE|PG|PI|PN|PO|PR|PT|PU|PV|PZ|RA|RC|RE|RG|RI|RM|RN|RO|SA|SI|SO|SP|SR|SS|SU|SV|TA|TE|TN|TO|TP|TR|TS|TV|UD|VA|VB|VC|VE|VI|VR|VS|VT|VV)</span><span class="se">\</span><span class="s1">b|</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">d{5}</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*){0,2}))+(?:</span><span class="se">\</span><span class="s1">s*,</span><span class="se">\</span><span class="s1">s*(?:italy|italia))?|(?:</span><span class="se">\</span><span class="s1">b(app|appartamento)</span><span class="se">\</span><span class="s1">.?</span><span class="se">\</span><span class="s1">s+</span><span class="se">\</span><span class="s1">d[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ#/-]*</span><span class="se">\</span><span class="s1">s*,</span><span class="se">\</span><span class="s1">s*)?</span><span class="se">\</span><span class="s1">b(sp|al(?:lea|lee|lée|inea|zaia)|androna|angiporto|arco|archivolto|ar(?:co|ena|gine|chivolto)|ba(?:cino|nchi|luardo|nchina|stione|stioni)|bor(?:go|gata|goloco)|cal(?:le|ata|)|campo|campiello|canale|cantone|car(?:ro|raia|rara|rarone)|ca(?:l|lle|mpo|rro|lata|nale|vone|ntone|rraia|rrara|scina|mpiello|rrarone|valcavia)|chi(?:asso|assetto|assuola)|circonvallazione|circumvallazione|clivo|clivio|claustro|co(?:rso|rte|sta|rsia|rtile|ntrada|rsetto|rtesela|mplanare|rticella)|crosa|crocicchio|discesa|distacco|diramazione|fon(?:do|daco|damenta)|fossa|fossato|gra(?:dini|doni|dinata|nviale)|largo|larghetto|largo|laterale|larghetto|lido|lista|litoranea|lun(?:go|garno|gadige|goadda|godora|golago|goliri|gomare|gomolo|gonera|gosile|gocrati|gofiume|gogesso|golario|golinea|goparco|goporto|gosonao|gostura|gocalore|gocanale|gocurone|gofoglia|goisarco|gomazaro|gosabato|gotanaro|gotevere|goticino|gotronto|govelino|gobisagno|gobusento|gotalvera|gotorrente)|pa(?:sso|rallela|ssaggio|sseggio|sseggiata)|pen(?:dio|dice|dino|ninata)|pia(?:zza|ggia|zzale|zzetta)|pi(?:azza|aggia|scina|azzale|azzetta)|ponte|porto|portico|prato|prolungamento|ra(?:mo|mpa|mpe|tto|ggio|mpari)|re(?:cinto|gaste|gione|ttifilo)|ri(?:o|pa|va|one|ello|viera)|rua|ruga|rugheta|sa(?:ia|cca|lita|grato|lizada)|sca(?:lea|lone|lette|linata)|sc(?:esa|alea|alone|alette|alinata)|selciato|sentiero|sopportico|sotoportego|sottoportico|sp(?:alto|iazzo|iaggia|ianata)|str(?:ada|etta|etto|adale|adone|adella|adello|adetta|ettoia|ettola|adoncello)|tra(?:tturo|versa|zzera|versale|sversale)|tr(?:onco|atturo|aversa|azzera|esanda|aversale|asversale)|vallone|vanella|via(?:l|le|lone|letto|)|vic(?:o|olo|inale|oletto)|viella|vietta|vi(?:a|al|co|ale|colo|ella|etta|uzza|uzzo|alone|aletto|cinale|ottolo|coletto|llaggio)|volti|voltone|vocabolo|accesso|belvedere|bivio|cupa|emiciclo|erta|estramurale|frazione|galleria|isola|masseria|merceria|molo|mura|quadrato|rotonda|sdrucciolo|slargo|supportico|svoto|terrazza|tondo)</span><span class="se">\</span><span class="s1">.?(?:</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">4</span><span class="p">}(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">app</span><span class="o">|</span><span class="nx">appartamento</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="err">#</span><span class="o">/-</span><span class="p">]</span><span class="o">*</span><span class="p">)?(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(?:</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">AG</span><span class="o">|</span><span class="nx">AL</span><span class="o">|</span><span class="nx">AN</span><span class="o">|</span><span class="nx">AO</span><span class="o">|</span><span class="nx">AP</span><span class="o">|</span><span class="nx">AQ</span><span class="o">|</span><span class="nx">AR</span><span class="o">|</span><span class="nx">AT</span><span class="o">|</span><span class="nx">AV</span><span class="o">|</span><span class="nx">BA</span><span class="o">|</span><span class="nx">BG</span><span class="o">|</span><span class="nx">BI</span><span class="o">|</span><span class="nx">BL</span><span class="o">|</span><span class="nx">BN</span><span class="o">|</span><span class="nx">BO</span><span class="o">|</span><span class="nx">BR</span><span class="o">|</span><span class="nx">BS</span><span class="o">|</span><span class="nx">BT</span><span class="o">|</span><span class="nx">BZ</span><span class="o">|</span><span class="nx">CA</span><span class="o">|</span><span class="nx">CB</span><span class="o">|</span><span class="nx">CE</span><span class="o">|</span><span class="nx">CH</span><span class="o">|</span><span class="nx">CI</span><span class="o">|</span><span class="nx">CL</span><span class="o">|</span><span class="nx">CN</span><span class="o">|</span><span class="nx">CO</span><span class="o">|</span><span class="nx">CR</span><span class="o">|</span><span class="nx">CS</span><span class="o">|</span><span class="nx">CT</span><span class="o">|</span><span class="nx">CZ</span><span class="o">|</span><span class="nx">EN</span><span class="o">|</span><span class="nx">FC</span><span class="o">|</span><span class="nx">FE</span><span class="o">|</span><span class="nx">FG</span><span class="o">|</span><span class="nx">FI</span><span class="o">|</span><span class="nx">FM</span><span class="o">|</span><span class="nx">FR</span><span class="o">|</span><span class="nx">GE</span><span class="o">|</span><span class="nx">GO</span><span class="o">|</span><span class="nx">GR</span><span class="o">|</span><span class="nx">IM</span><span class="o">|</span><span class="nx">IS</span><span class="o">|</span><span class="nx">KR</span><span class="o">|</span><span class="nx">LC</span><span class="o">|</span><span class="nx">LE</span><span class="o">|</span><span class="nx">LI</span><span class="o">|</span><span class="nx">LO</span><span class="o">|</span><span class="nx">LT</span><span class="o">|</span><span class="nx">LU</span><span class="o">|</span><span class="nx">MB</span><span class="o">|</span><span class="nx">MC</span><span class="o">|</span><span class="nx">ME</span><span class="o">|</span><span class="nx">MI</span><span class="o">|</span><span class="nx">MN</span><span class="o">|</span><span class="nx">MO</span><span class="o">|</span><span class="nx">MS</span><span class="o">|</span><span class="nx">MT</span><span class="o">|</span><span class="nx">NA</span><span class="o">|</span><span class="nx">NO</span><span class="o">|</span><span class="nx">NU</span><span class="o">|</span><span class="nx">OG</span><span class="o">|</span><span class="nx">OR</span><span class="o">|</span><span class="nx">OT</span><span class="o">|</span><span class="nx">PA</span><span class="o">|</span><span class="nx">PC</span><span class="o">|</span><span class="nx">PD</span><span class="o">|</span><span class="nx">PE</span><span class="o">|</span><span class="nx">PG</span><span class="o">|</span><span class="nx">PI</span><span class="o">|</span><span class="nx">PN</span><span class="o">|</span><span class="nx">PO</span><span class="o">|</span><span class="nx">PR</span><span class="o">|</span><span class="nx">PT</span><span class="o">|</span><span class="nx">PU</span><span class="o">|</span><span class="nx">PV</span><span class="o">|</span><span class="nx">PZ</span><span class="o">|</span><span class="nx">RA</span><span class="o">|</span><span class="nx">RC</span><span class="o">|</span><span class="nx">RE</span><span class="o">|</span><span class="nx">RG</span><span class="o">|</span><span class="nx">RI</span><span class="o">|</span><span class="nx">RM</span><span class="o">|</span><span class="nx">RN</span><span class="o">|</span><span class="nx">RO</span><span class="o">|</span><span class="nx">SA</span><span class="o">|</span><span class="nx">SI</span><span class="o">|</span><span class="nx">SO</span><span class="o">|</span><span class="nx">SP</span><span class="o">|</span><span class="nx">SR</span><span class="o">|</span><span class="nx">SS</span><span class="o">|</span><span class="nx">SU</span><span class="o">|</span><span class="nx">SV</span><span class="o">|</span><span class="nx">TA</span><span class="o">|</span><span class="nx">TE</span><span class="o">|</span><span class="nx">TN</span><span class="o">|</span><span class="nx">TO</span><span class="o">|</span><span class="nx">TP</span><span class="o">|</span><span class="nx">TR</span><span class="o">|</span><span class="nx">TS</span><span class="o">|</span><span class="nx">TV</span><span class="o">|</span><span class="nx">UD</span><span class="o">|</span><span class="nx">VA</span><span class="o">|</span><span class="nx">VB</span><span class="o">|</span><span class="nx">VC</span><span class="o">|</span><span class="nx">VE</span><span class="o">|</span><span class="nx">VI</span><span class="o">|</span><span class="nx">VR</span><span class="o">|</span><span class="nx">VS</span><span class="o">|</span><span class="nx">VT</span><span class="o">|</span><span class="nx">VV</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">}))</span><span class="o">+</span><span class="p">(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:</span><span class="nx">italy</span><span class="o">|</span><span class="nx">italia</span><span class="p">))?</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">app</span><span class="o">|</span><span class="nx">appartamento</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="err">#</span><span class="o">/-</span><span class="p">]</span><span class="o">*</span><span class="p">(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(?:</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">AG</span><span class="o">|</span><span class="nx">AL</span><span class="o">|</span><span class="nx">AN</span><span class="o">|</span><span class="nx">AO</span><span class="o">|</span><span class="nx">AP</span><span class="o">|</span><span class="nx">AQ</span><span class="o">|</span><span class="nx">AR</span><span class="o">|</span><span class="nx">AT</span><span class="o">|</span><span class="nx">AV</span><span class="o">|</span><span class="nx">BA</span><span class="o">|</span><span class="nx">BG</span><span class="o">|</span><span class="nx">BI</span><span class="o">|</span><span class="nx">BL</span><span class="o">|</span><span class="nx">BN</span><span class="o">|</span><span class="nx">BO</span><span class="o">|</span><span class="nx">BR</span><span class="o">|</span><span class="nx">BS</span><span class="o">|</span><span class="nx">BT</span><span class="o">|</span><span class="nx">BZ</span><span class="o">|</span><span class="nx">CA</span><span class="o">|</span><span class="nx">CB</span><span class="o">|</span><span class="nx">CE</span><span class="o">|</span><span class="nx">CH</span><span class="o">|</span><span class="nx">CI</span><span class="o">|</span><span class="nx">CL</span><span class="o">|</span><span class="nx">CN</span><span class="o">|</span><span class="nx">CO</span><span class="o">|</span><span class="nx">CR</span><span class="o">|</span><span class="nx">CS</span><span class="o">|</span><span class="nx">CT</span><span class="o">|</span><span class="nx">CZ</span><span class="o">|</span><span class="nx">EN</span><span class="o">|</span><span class="nx">FC</span><span class="o">|</span><span class="nx">FE</span><span class="o">|</span><span class="nx">FG</span><span class="o">|</span><span class="nx">FI</span><span class="o">|</span><span class="nx">FM</span><span class="o">|</span><span class="nx">FR</span><span class="o">|</span><span class="nx">GE</span><span class="o">|</span><span class="nx">GO</span><span class="o">|</span><span class="nx">GR</span><span class="o">|</span><span class="nx">IM</span><span class="o">|</span><span class="nx">IS</span><span class="o">|</span><span class="nx">KR</span><span class="o">|</span><span class="nx">LC</span><span class="o">|</span><span class="nx">LE</span><span class="o">|</span><span class="nx">LI</span><span class="o">|</span><span class="nx">LO</span><span class="o">|</span><span class="nx">LT</span><span class="o">|</span><span class="nx">LU</span><span class="o">|</span><span class="nx">MB</span><span class="o">|</span><span class="nx">MC</span><span class="o">|</span><span class="nx">ME</span><span class="o">|</span><span class="nx">MI</span><span class="o">|</span><span class="nx">MN</span><span class="o">|</span><span class="nx">MO</span><span class="o">|</span><span class="nx">MS</span><span class="o">|</span><span class="nx">MT</span><span class="o">|</span><span class="nx">NA</span><span class="o">|</span><span class="nx">NO</span><span class="o">|</span><span class="nx">NU</span><span class="o">|</span><span class="nx">OG</span><span class="o">|</span><span class="nx">OR</span><span class="o">|</span><span class="nx">OT</span><span class="o">|</span><span class="nx">PA</span><span class="o">|</span><span class="nx">PC</span><span class="o">|</span><span class="nx">PD</span><span class="o">|</span><span class="nx">PE</span><span class="o">|</span><span class="nx">PG</span><span class="o">|</span><span class="nx">PI</span><span class="o">|</span><span class="nx">PN</span><span class="o">|</span><span class="nx">PO</span><span class="o">|</span><span class="nx">PR</span><span class="o">|</span><span class="nx">PT</span><span class="o">|</span><span class="nx">PU</span><span class="o">|</span><span class="nx">PV</span><span class="o">|</span><span class="nx">PZ</span><span class="o">|</span><span class="nx">RA</span><span class="o">|</span><span class="nx">RC</span><span class="o">|</span><span class="nx">RE</span><span class="o">|</span><span class="nx">RG</span><span class="o">|</span><span class="nx">RI</span><span class="o">|</span><span class="nx">RM</span><span class="o">|</span><span class="nx">RN</span><span class="o">|</span><span class="nx">RO</span><span class="o">|</span><span class="nx">SA</span><span class="o">|</span><span class="nx">SI</span><span class="o">|</span><span class="nx">SO</span><span class="o">|</span><span class="nx">SP</span><span class="o">|</span><span class="nx">SR</span><span class="o">|</span><span class="nx">SS</span><span class="o">|</span><span class="nx">SU</span><span class="o">|</span><span class="nx">SV</span><span class="o">|</span><span class="nx">TA</span><span class="o">|</span><span class="nx">TE</span><span class="o">|</span><span class="nx">TN</span><span class="o">|</span><span class="nx">TO</span><span class="o">|</span><span class="nx">TP</span><span class="o">|</span><span class="nx">TR</span><span class="o">|</span><span class="nx">TS</span><span class="o">|</span><span class="nx">TV</span><span class="o">|</span><span class="nx">UD</span><span class="o">|</span><span class="nx">VA</span><span class="o">|</span><span class="nx">VB</span><span class="o">|</span><span class="nx">VC</span><span class="o">|</span><span class="nx">VE</span><span class="o">|</span><span class="nx">VI</span><span class="o">|</span><span class="nx">VR</span><span class="o">|</span><span class="nx">VS</span><span class="o">|</span><span class="nx">VT</span><span class="o">|</span><span class="nx">VV</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">}))</span><span class="o">+</span><span class="p">(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:</span><span class="nx">italy</span><span class="o">|</span><span class="nx">italia</span><span class="p">))?</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">app</span><span class="o">|</span><span class="nx">appartamento</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="err">#</span><span class="o">/-</span><span class="p">]</span><span class="o">*|</span><span class="p">(</span><span class="nx">casella</span> <span class="nx">postale</span><span class="o">|</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="nx">p</span><span class="err">\</span><span class="p">.?)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(?:</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">AG</span><span class="o">|</span><span class="nx">AL</span><span class="o">|</span><span class="nx">AN</span><span class="o">|</span><span class="nx">AO</span><span class="o">|</span><span class="nx">AP</span><span class="o">|</span><span class="nx">AQ</span><span class="o">|</span><span class="nx">AR</span><span class="o">|</span><span class="nx">AT</span><span class="o">|</span><span class="nx">AV</span><span class="o">|</span><span class="nx">BA</span><span class="o">|</span><span class="nx">BG</span><span class="o">|</span><span class="nx">BI</span><span class="o">|</span><span class="nx">BL</span><span class="o">|</span><span class="nx">BN</span><span class="o">|</span><span class="nx">BO</span><span class="o">|</span><span class="nx">BR</span><span class="o">|</span><span class="nx">BS</span><span class="o">|</span><span class="nx">BT</span><span class="o">|</span><span class="nx">BZ</span><span class="o">|</span><span class="nx">CA</span><span class="o">|</span><span class="nx">CB</span><span class="o">|</span><span class="nx">CE</span><span class="o">|</span><span class="nx">CH</span><span class="o">|</span><span class="nx">CI</span><span class="o">|</span><span class="nx">CL</span><span class="o">|</span><span class="nx">CN</span><span class="o">|</span><span class="nx">CO</span><span class="o">|</span><span class="nx">CR</span><span class="o">|</span><span class="nx">CS</span><span class="o">|</span><span class="nx">CT</span><span class="o">|</span><span class="nx">CZ</span><span class="o">|</span><span class="nx">EN</span><span class="o">|</span><span class="nx">FC</span><span class="o">|</span><span class="nx">FE</span><span class="o">|</span><span class="nx">FG</span><span class="o">|</span><span class="nx">FI</span><span class="o">|</span><span class="nx">FM</span><span class="o">|</span><span class="nx">FR</span><span class="o">|</span><span class="nx">GE</span><span class="o">|</span><span class="nx">GO</span><span class="o">|</span><span class="nx">GR</span><span class="o">|</span><span class="nx">IM</span><span class="o">|</span><span class="nx">IS</span><span class="o">|</span><span class="nx">KR</span><span class="o">|</span><span class="nx">LC</span><span class="o">|</span><span class="nx">LE</span><span class="o">|</span><span class="nx">LI</span><span class="o">|</span><span class="nx">LO</span><span class="o">|</span><span class="nx">LT</span><span class="o">|</span><span class="nx">LU</span><span class="o">|</span><span class="nx">MB</span><span class="o">|</span><span class="nx">MC</span><span class="o">|</span><span class="nx">ME</span><span class="o">|</span><span class="nx">MI</span><span class="o">|</span><span class="nx">MN</span><span class="o">|</span><span class="nx">MO</span><span class="o">|</span><span class="nx">MS</span><span class="o">|</span><span class="nx">MT</span><span class="o">|</span><span class="nx">NA</span><span class="o">|</span><span class="nx">NO</span><span class="o">|</span><span class="nx">NU</span><span class="o">|</span><span class="nx">OG</span><span class="o">|</span><span class="nx">OR</span><span class="o">|</span><span class="nx">OT</span><span class="o">|</span><span class="nx">PA</span><span class="o">|</span><span class="nx">PC</span><span class="o">|</span><span class="nx">PD</span><span class="o">|</span><span class="nx">PE</span><span class="o">|</span><span class="nx">PG</span><span class="o">|</span><span class="nx">PI</span><span class="o">|</span><span class="nx">PN</span><span class="o">|</span><span class="nx">PO</span><span class="o">|</span><span class="nx">PR</span><span class="o">|</span><span class="nx">PT</span><span class="o">|</span><span class="nx">PU</span><span class="o">|</span><span class="nx">PV</span><span class="o">|</span><span class="nx">PZ</span><span class="o">|</span><span class="nx">RA</span><span class="o">|</span><span class="nx">RC</span><span class="o">|</span><span class="nx">RE</span><span class="o">|</span><span class="nx">RG</span><span class="o">|</span><span class="nx">RI</span><span class="o">|</span><span class="nx">RM</span><span class="o">|</span><span class="nx">RN</span><span class="o">|</span><span class="nx">RO</span><span class="o">|</span><span class="nx">SA</span><span class="o">|</span><span class="nx">SI</span><span class="o">|</span><span class="nx">SO</span><span class="o">|</span><span class="nx">SP</span><span class="o">|</span><span class="nx">SR</span><span class="o">|</span><span class="nx">SS</span><span class="o">|</span><span class="nx">SU</span><span class="o">|</span><span class="nx">SV</span><span class="o">|</span><span class="nx">TA</span><span class="o">|</span><span class="nx">TE</span><span class="o">|</span><span class="nx">TN</span><span class="o">|</span><span class="nx">TO</span><span class="o">|</span><span class="nx">TP</span><span class="o">|</span><span class="nx">TR</span><span class="o">|</span><span class="nx">TS</span><span class="o">|</span><span class="nx">TV</span><span class="o">|</span><span class="nx">UD</span><span class="o">|</span><span class="nx">VA</span><span class="o">|</span><span class="nx">VB</span><span class="o">|</span><span class="nx">VC</span><span class="o">|</span><span class="nx">VE</span><span class="o">|</span><span class="nx">VI</span><span class="o">|</span><span class="nx">VR</span><span class="o">|</span><span class="nx">VS</span><span class="o">|</span><span class="nx">VT</span><span class="o">|</span><span class="nx">VV</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*(</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">}))</span><span class="o">+</span><span class="p">(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:</span><span class="nx">italy</span><span class="o">|</span><span class="nx">italia</span><span class="p">))?</span><span class="o">|</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">app</span><span class="o">|</span><span class="nx">appartamento</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="err">#</span><span class="o">/-</span><span class="p">]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">)?</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">sp</span><span class="o">|</span><span class="nx">al</span><span class="p">(?:</span><span class="nx">lea</span><span class="o">|</span><span class="nx">lee</span><span class="o">|</span><span class="nx">lée</span><span class="o">|</span><span class="nx">inea</span><span class="o">|</span><span class="nx">zaia</span><span class="p">)</span><span class="o">|</span><span class="nx">androna</span><span class="o">|</span><span class="nx">angiporto</span><span class="o">|</span><span class="nx">arco</span><span class="o">|</span><span class="nx">archivolto</span><span class="o">|</span><span class="nx">ar</span><span class="p">(?:</span><span class="nx">co</span><span class="o">|</span><span class="nx">ena</span><span class="o">|</span><span class="nx">gine</span><span class="o">|</span><span class="nx">chivolto</span><span class="p">)</span><span class="o">|</span><span class="nx">ba</span><span class="p">(?:</span><span class="nx">cino</span><span class="o">|</span><span class="nx">nchi</span><span class="o">|</span><span class="nx">luardo</span><span class="o">|</span><span class="nx">nchina</span><span class="o">|</span><span class="nx">stione</span><span class="o">|</span><span class="nx">stioni</span><span class="p">)</span><span class="o">|</span><span class="nx">bor</span><span class="p">(?:</span><span class="nx">go</span><span class="o">|</span><span class="nx">gata</span><span class="o">|</span><span class="nx">goloco</span><span class="p">)</span><span class="o">|</span><span class="nx">cal</span><span class="p">(?:</span><span class="nx">le</span><span class="o">|</span><span class="nx">ata</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">campo</span><span class="o">|</span><span class="nx">campiello</span><span class="o">|</span><span class="nx">canale</span><span class="o">|</span><span class="nx">cantone</span><span class="o">|</span><span class="nx">car</span><span class="p">(?:</span><span class="nx">ro</span><span class="o">|</span><span class="nx">raia</span><span class="o">|</span><span class="nx">rara</span><span class="o">|</span><span class="nx">rarone</span><span class="p">)</span><span class="o">|</span><span class="nx">ca</span><span class="p">(?:</span><span class="nx">l</span><span class="o">|</span><span class="nx">lle</span><span class="o">|</span><span class="nx">mpo</span><span class="o">|</span><span class="nx">rro</span><span class="o">|</span><span class="nx">lata</span><span class="o">|</span><span class="nx">nale</span><span class="o">|</span><span class="nx">vone</span><span class="o">|</span><span class="nx">ntone</span><span class="o">|</span><span class="nx">rraia</span><span class="o">|</span><span class="nx">rrara</span><span class="o">|</span><span class="nx">scina</span><span class="o">|</span><span class="nx">mpiello</span><span class="o">|</span><span class="nx">rrarone</span><span class="o">|</span><span class="nx">valcavia</span><span class="p">)</span><span class="o">|</span><span class="nx">chi</span><span class="p">(?:</span><span class="nx">asso</span><span class="o">|</span><span class="nx">assetto</span><span class="o">|</span><span class="nx">assuola</span><span class="p">)</span><span class="o">|</span><span class="nx">circonvallazione</span><span class="o">|</span><span class="nx">circumvallazione</span><span class="o">|</span><span class="nx">clivo</span><span class="o">|</span><span class="nx">clivio</span><span class="o">|</span><span class="nx">claustro</span><span class="o">|</span><span class="nx">co</span><span class="p">(?:</span><span class="nx">rso</span><span class="o">|</span><span class="nx">rte</span><span class="o">|</span><span class="nx">sta</span><span class="o">|</span><span class="nx">rsia</span><span class="o">|</span><span class="nx">rtile</span><span class="o">|</span><span class="nx">ntrada</span><span class="o">|</span><span class="nx">rsetto</span><span class="o">|</span><span class="nx">rtesela</span><span class="o">|</span><span class="nx">mplanare</span><span class="o">|</span><span class="nx">rticella</span><span class="p">)</span><span class="o">|</span><span class="nx">crosa</span><span class="o">|</span><span class="nx">crocicchio</span><span class="o">|</span><span class="nx">discesa</span><span class="o">|</span><span class="nx">distacco</span><span class="o">|</span><span class="nx">diramazione</span><span class="o">|</span><span class="nx">fon</span><span class="p">(?:</span><span class="k">do</span><span class="o">|</span><span class="nx">daco</span><span class="o">|</span><span class="nx">damenta</span><span class="p">)</span><span class="o">|</span><span class="nx">fossa</span><span class="o">|</span><span class="nx">fossato</span><span class="o">|</span><span class="nx">gra</span><span class="p">(?:</span><span class="nx">dini</span><span class="o">|</span><span class="nx">doni</span><span class="o">|</span><span class="nx">dinata</span><span class="o">|</span><span class="nx">nviale</span><span class="p">)</span><span class="o">|</span><span class="nx">largo</span><span class="o">|</span><span class="nx">larghetto</span><span class="o">|</span><span class="nx">largo</span><span class="o">|</span><span class="nx">laterale</span><span class="o">|</span><span class="nx">larghetto</span><span class="o">|</span><span class="nx">lido</span><span class="o">|</span><span class="nx">lista</span><span class="o">|</span><span class="nx">litoranea</span><span class="o">|</span><span class="nx">lun</span><span class="p">(?:</span><span class="nx">go</span><span class="o">|</span><span class="nx">garno</span><span class="o">|</span><span class="nx">gadige</span><span class="o">|</span><span class="nx">goadda</span><span class="o">|</span><span class="nx">godora</span><span class="o">|</span><span class="nx">golago</span><span class="o">|</span><span class="nx">goliri</span><span class="o">|</span><span class="nx">gomare</span><span class="o">|</span><span class="nx">gomolo</span><span class="o">|</span><span class="nx">gonera</span><span class="o">|</span><span class="nx">gosile</span><span class="o">|</span><span class="nx">gocrati</span><span class="o">|</span><span class="nx">gofiume</span><span class="o">|</span><span class="nx">gogesso</span><span class="o">|</span><span class="nx">golario</span><span class="o">|</span><span class="nx">golinea</span><span class="o">|</span><span class="nx">goparco</span><span class="o">|</span><span class="nx">goporto</span><span class="o">|</span><span class="nx">gosonao</span><span class="o">|</span><span class="nx">gostura</span><span class="o">|</span><span class="nx">gocalore</span><span class="o">|</span><span class="nx">gocanale</span><span class="o">|</span><span class="nx">gocurone</span><span class="o">|</span><span class="nx">gofoglia</span><span class="o">|</span><span class="nx">goisarco</span><span class="o">|</span><span class="nx">gomazaro</span><span class="o">|</span><span class="nx">gosabato</span><span class="o">|</span><span class="nx">gotanaro</span><span class="o">|</span><span class="nx">gotevere</span><span class="o">|</span><span class="nx">goticino</span><span class="o">|</span><span class="nx">gotronto</span><span class="o">|</span><span class="nx">govelino</span><span class="o">|</span><span class="nx">gobisagno</span><span class="o">|</span><span class="nx">gobusento</span><span class="o">|</span><span class="nx">gotalvera</span><span class="o">|</span><span class="nx">gotorrente</span><span class="p">)</span><span class="o">|</span><span class="nx">pa</span><span class="p">(?:</span><span class="nx">sso</span><span class="o">|</span><span class="nx">rallela</span><span class="o">|</span><span class="nx">ssaggio</span><span class="o">|</span><span class="nx">sseggio</span><span class="o">|</span><span class="nx">sseggiata</span><span class="p">)</span><span class="o">|</span><span class="nx">pen</span><span class="p">(?:</span><span class="nx">dio</span><span class="o">|</span><span class="nx">dice</span><span class="o">|</span><span class="nx">dino</span><span class="o">|</span><span class="nx">ninata</span><span class="p">)</span><span class="o">|</span><span class="nx">pia</span><span class="p">(?:</span><span class="nx">zza</span><span class="o">|</span><span class="nx">ggia</span><span class="o">|</span><span class="nx">zzale</span><span class="o">|</span><span class="nx">zzetta</span><span class="p">)</span><span class="o">|</span><span class="nx">pi</span><span class="p">(?:</span><span class="nx">azza</span><span class="o">|</span><span class="nx">aggia</span><span class="o">|</span><span class="nx">scina</span><span class="o">|</span><span class="nx">azzale</span><span class="o">|</span><span class="nx">azzetta</span><span class="p">)</span><span class="o">|</span><span class="nx">ponte</span><span class="o">|</span><span class="nx">porto</span><span class="o">|</span><span class="nx">portico</span><span class="o">|</span><span class="nx">prato</span><span class="o">|</span><span class="nx">prolungamento</span><span class="o">|</span><span class="nx">ra</span><span class="p">(?:</span><span class="nx">mo</span><span class="o">|</span><span class="nx">mpa</span><span class="o">|</span><span class="nx">mpe</span><span class="o">|</span><span class="nx">tto</span><span class="o">|</span><span class="nx">ggio</span><span class="o">|</span><span class="nx">mpari</span><span class="p">)</span><span class="o">|</span><span class="nx">re</span><span class="p">(?:</span><span class="nx">cinto</span><span class="o">|</span><span class="nx">gaste</span><span class="o">|</span><span class="nx">gione</span><span class="o">|</span><span class="nx">ttifilo</span><span class="p">)</span><span class="o">|</span><span class="nx">ri</span><span class="p">(?:</span><span class="nx">o</span><span class="o">|</span><span class="nx">pa</span><span class="o">|</span><span class="nx">va</span><span class="o">|</span><span class="nx">one</span><span class="o">|</span><span class="nx">ello</span><span class="o">|</span><span class="nx">viera</span><span class="p">)</span><span class="o">|</span><span class="nx">rua</span><span class="o">|</span><span class="nx">ruga</span><span class="o">|</span><span class="nx">rugheta</span><span class="o">|</span><span class="nx">sa</span><span class="p">(?:</span><span class="nx">ia</span><span class="o">|</span><span class="nx">cca</span><span class="o">|</span><span class="nx">lita</span><span class="o">|</span><span class="nx">grato</span><span class="o">|</span><span class="nx">lizada</span><span class="p">)</span><span class="o">|</span><span class="nx">sca</span><span class="p">(?:</span><span class="nx">lea</span><span class="o">|</span><span class="nx">lone</span><span class="o">|</span><span class="nx">lette</span><span class="o">|</span><span class="nx">linata</span><span class="p">)</span><span class="o">|</span><span class="nx">sc</span><span class="p">(?:</span><span class="nx">esa</span><span class="o">|</span><span class="nx">alea</span><span class="o">|</span><span class="nx">alone</span><span class="o">|</span><span class="nx">alette</span><span class="o">|</span><span class="nx">alinata</span><span class="p">)</span><span class="o">|</span><span class="nx">selciato</span><span class="o">|</span><span class="nx">sentiero</span><span class="o">|</span><span class="nx">sopportico</span><span class="o">|</span><span class="nx">sotoportego</span><span class="o">|</span><span class="nx">sottoportico</span><span class="o">|</span><span class="nx">sp</span><span class="p">(?:</span><span class="nx">alto</span><span class="o">|</span><span class="nx">iazzo</span><span class="o">|</span><span class="nx">iaggia</span><span class="o">|</span><span class="nx">ianata</span><span class="p">)</span><span class="o">|</span><span class="nx">str</span><span class="p">(?:</span><span class="nx">ada</span><span class="o">|</span><span class="nx">etta</span><span class="o">|</span><span class="nx">etto</span><span class="o">|</span><span class="nx">adale</span><span class="o">|</span><span class="nx">adone</span><span class="o">|</span><span class="nx">adella</span><span class="o">|</span><span class="nx">adello</span><span class="o">|</span><span class="nx">adetta</span><span class="o">|</span><span class="nx">ettoia</span><span class="o">|</span><span class="nx">ettola</span><span class="o">|</span><span class="nx">adoncello</span><span class="p">)</span><span class="o">|</span><span class="nx">tra</span><span class="p">(?:</span><span class="nx">tturo</span><span class="o">|</span><span class="nx">versa</span><span class="o">|</span><span class="nx">zzera</span><span class="o">|</span><span class="nx">versale</span><span class="o">|</span><span class="nx">sversale</span><span class="p">)</span><span class="o">|</span><span class="nx">tr</span><span class="p">(?:</span><span class="nx">onco</span><span class="o">|</span><span class="nx">atturo</span><span class="o">|</span><span class="nx">aversa</span><span class="o">|</span><span class="nx">azzera</span><span class="o">|</span><span class="nx">esanda</span><span class="o">|</span><span class="nx">aversale</span><span class="o">|</span><span class="nx">asversale</span><span class="p">)</span><span class="o">|</span><span class="nx">vallone</span><span class="o">|</span><span class="nx">vanella</span><span class="o">|</span><span class="nx">via</span><span class="p">(?:</span><span class="nx">l</span><span class="o">|</span><span class="nx">le</span><span class="o">|</span><span class="nx">lone</span><span class="o">|</span><span class="nx">letto</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">vic</span><span class="p">(?:</span><span class="nx">o</span><span class="o">|</span><span class="nx">olo</span><span class="o">|</span><span class="nx">inale</span><span class="o">|</span><span class="nx">oletto</span><span class="p">)</span><span class="o">|</span><span class="nx">viella</span><span class="o">|</span><span class="nx">vietta</span><span class="o">|</span><span class="nx">vi</span><span class="p">(?:</span><span class="nx">a</span><span class="o">|</span><span class="nx">al</span><span class="o">|</span><span class="nx">co</span><span class="o">|</span><span class="nx">ale</span><span class="o">|</span><span class="nx">colo</span><span class="o">|</span><span class="nx">ella</span><span class="o">|</span><span class="nx">etta</span><span class="o">|</span><span class="nx">uzza</span><span class="o">|</span><span class="nx">uzzo</span><span class="o">|</span><span class="nx">alone</span><span class="o">|</span><span class="nx">aletto</span><span class="o">|</span><span class="nx">cinale</span><span class="o">|</span><span class="nx">ottolo</span><span class="o">|</span><span class="nx">coletto</span><span class="o">|</span><span class="nx">llaggio</span><span class="p">)</span><span class="o">|</span><span class="nx">volti</span><span class="o">|</span><span class="nx">voltone</span><span class="o">|</span><span class="nx">vocabolo</span><span class="o">|</span><span class="nx">accesso</span><span class="o">|</span><span class="nx">belvedere</span><span class="o">|</span><span class="nx">bivio</span><span class="o">|</span><span class="nx">cupa</span><span class="o">|</span><span class="nx">emiciclo</span><span class="o">|</span><span class="nx">erta</span><span class="o">|</span><span class="nx">estramurale</span><span class="o">|</span><span class="nx">frazione</span><span class="o">|</span><span class="nx">galleria</span><span class="o">|</span><span class="nx">isola</span><span class="o">|</span><span class="nx">masseria</span><span class="o">|</span><span class="nx">merceria</span><span class="o">|</span><span class="nx">molo</span><span class="o">|</span><span class="nx">mura</span><span class="o">|</span><span class="nx">quadrato</span><span class="o">|</span><span class="nx">rotonda</span><span class="o">|</span><span class="nx">sdrucciolo</span><span class="o">|</span><span class="nx">slargo</span><span class="o">|</span><span class="nx">supportico</span><span class="o">|</span><span class="nx">svoto</span><span class="o">|</span><span class="nx">terrazza</span><span class="o">|</span><span class="nx">tondo</span><span class="p">)</span><span class="err">\</span><span class="p">.?(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*){0,4}(?:[,</span><span class="se">\</span><span class="s1">.]?</span><span class="se">\</span><span class="s1">s+)</span><span class="se">\</span><span class="s1">d[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ#/-]*</span><span class="se">\</span><span class="s1">.?(?:</span><span class="se">\</span><span class="s1">s*,</span><span class="se">\</span><span class="s1">s*</span><span class="se">\</span><span class="s1">b(app|appartamento)</span><span class="se">\</span><span class="s1">.?</span><span class="se">\</span><span class="s1">s+</span><span class="se">\</span><span class="s1">d[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ#/-]*)?|(casella postale|c</span><span class="se">\</span><span class="s1">.?p</span><span class="se">\</span><span class="s1">.?)</span><span class="se">\</span><span class="s1">s+</span><span class="se">\</span><span class="s1">d+)
</span></code></pre></div></div>

<h4 id="street-address-mexico">Street address (Mexico)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">((</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">avenida</span><span class="o">|</span><span class="nx">av</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">blvd</span><span class="o">|</span><span class="nx">calle</span><span class="o">|</span><span class="nx">callejon</span><span class="o">|</span><span class="nx">calzada</span><span class="o">|</span><span class="nx">calz</span><span class="o">|</span><span class="nx">camino</span><span class="o">|</span><span class="nx">carretera</span><span class="o">|</span><span class="nx">carr</span><span class="o">|</span><span class="nx">cerrada</span><span class="o">|</span><span class="nx">cerr</span><span class="o">|</span><span class="nx">circuito</span><span class="o">|</span><span class="nx">privada</span><span class="o">|</span><span class="nx">priv</span><span class="o">|</span><span class="nx">prolongacion</span><span class="o">|</span><span class="nx">prol</span><span class="o">|</span><span class="nx">paseo</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">plz</span><span class="o">|</span><span class="nx">retorno</span><span class="o">|</span><span class="nx">ret</span><span class="o">|</span><span class="nx">viaducto</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">]</span><span class="o">+</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">]</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="p">.?(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">((</span><span class="nx">departamento</span><span class="o">|</span><span class="nx">depto</span><span class="o">|</span><span class="nx">edificio</span><span class="o">|</span><span class="nx">edif</span><span class="o">|</span><span class="nx">interior</span><span class="o">|</span><span class="nx">int</span><span class="o">|</span><span class="nx">lote</span><span class="o">|</span><span class="nx">manzana</span><span class="o">|</span><span class="nx">mz</span><span class="o">|</span><span class="nx">no</span><span class="o">|</span><span class="nx">numero</span><span class="o">|</span><span class="nx">num</span><span class="o">|</span><span class="nx">piso</span><span class="o">|</span><span class="err">#</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">)?(</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">([</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)?</span><span class="o">|</span><span class="nx">s</span><span class="o">/</span><span class="nx">n</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">))</span><span class="o">+|</span><span class="err">\</span><span class="nx">b</span><span class="p">(?:[</span><span class="nx">Aa</span><span class="p">]</span><span class="nx">partado</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">Pp</span><span class="p">]</span><span class="nx">ostal</span><span class="o">|</span><span class="nx">A</span><span class="err">\</span><span class="p">.?</span><span class="nx">P</span><span class="err">\</span><span class="p">.?)</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="p">)(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">C</span><span class="err">\</span><span class="p">.</span> <span class="nx">H</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">C</span><span class="err">\</span><span class="p">.</span><span class="nx">H</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">U</span><span class="err">\</span><span class="p">.</span> <span class="nx">H</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">U</span><span class="err">\</span><span class="p">.</span><span class="nx">H</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">barrio</span><span class="o">|</span><span class="nx">col</span><span class="o">|</span><span class="nx">colonia</span><span class="o">|</span><span class="nx">conjunto</span> <span class="nx">habitacional</span><span class="o">|</span><span class="nx">ejido</span><span class="o">|</span><span class="nx">fracc</span><span class="o">|</span><span class="nx">fraccionamiento</span><span class="o">|</span><span class="nx">paraje</span><span class="o">|</span><span class="nx">pueblo</span><span class="o">|</span><span class="nx">rancheria</span><span class="o">|</span><span class="nx">ranchería</span><span class="o">|</span><span class="nx">residencial</span><span class="o">|</span><span class="nx">sector</span><span class="o">|</span><span class="nx">unidad</span> <span class="nx">habitacional</span><span class="o">|</span><span class="nx">zona</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="p">(([</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">])</span><span class="o">|</span><span class="p">[</span><span class="dl">'</span><span class="s1">.-])+</span><span class="se">\</span><span class="s1">b(</span><span class="se">\</span><span class="s1">s+</span><span class="se">\</span><span class="s1">b(([A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ])|[</span><span class="dl">'</span><span class="p">.</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="p">])</span><span class="o">+</span><span class="p">)</span><span class="o">*</span><span class="p">)?(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">C</span><span class="err">\</span><span class="p">.</span><span class="nx">P</span><span class="err">\</span><span class="p">.</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)?</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">b</span><span class="p">((?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z</span><span class="p">])([</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">])</span><span class="o">+|</span><span class="nx">de</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="p">))</span><span class="o">*</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">de</span> <span class="nx">México</span><span class="o">|</span><span class="nx">de</span> <span class="nx">Mexico</span><span class="o">|</span><span class="nx">Zacatecas</span><span class="o">|</span><span class="nx">Zac</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Yucatán</span><span class="o">|</span><span class="nx">Yucatan</span><span class="o">|</span><span class="nx">Yuc</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Veracruz</span><span class="o">|</span><span class="nx">Ver</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Tlaxcala</span><span class="o">|</span><span class="nx">Tlax</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Tamps</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Tamaulipas</span><span class="o">|</span><span class="nx">Tabasco</span><span class="o">|</span><span class="nx">Tab</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Sonora</span><span class="o">|</span><span class="nx">Son</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Sinaloa</span><span class="o">|</span><span class="nx">Sin</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">San</span> <span class="nx">Luis</span> <span class="nx">Potosí</span><span class="o">|</span><span class="nx">San</span> <span class="nx">Luis</span> <span class="nx">Potosi</span><span class="o">|</span><span class="nx">S</span><span class="err">\</span><span class="p">.</span><span class="nx">L</span><span class="err">\</span><span class="p">.</span><span class="nx">P</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Quintana</span> <span class="nx">Roo</span><span class="o">|</span><span class="nx">Querétaro</span><span class="o">|</span><span class="nx">Queretaro</span><span class="o">|</span><span class="nx">Qro</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Q</span><span class="err">\</span><span class="p">.</span> <span class="nx">Roo</span><span class="o">|</span><span class="nx">Puebla</span><span class="o">|</span><span class="nx">Pue</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Oaxaca</span><span class="o">|</span><span class="nx">Oax</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Nuevo</span> <span class="nx">León</span><span class="o">|</span><span class="nx">Nuevo</span> <span class="nx">Leon</span><span class="o">|</span><span class="nx">Nayarit</span><span class="o">|</span><span class="nx">Nay</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">N</span><span class="err">\</span><span class="p">.</span><span class="nx">L</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">México</span><span class="o">|</span><span class="nx">Morelos</span><span class="o">|</span><span class="nx">Mor</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Michoacán</span><span class="o">|</span><span class="nx">Michoacan</span><span class="o">|</span><span class="nx">Mich</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Mexico</span><span class="o">|</span><span class="nx">Mex</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Jalisco</span><span class="o">|</span><span class="nx">Jal</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Hidalgo</span><span class="o">|</span><span class="nx">Hgo</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Guerrero</span><span class="o">|</span><span class="nx">Guanajuato</span><span class="o">|</span><span class="nx">Gto</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Gro</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Edomex</span><span class="o">|</span><span class="nx">Durango</span><span class="o">|</span><span class="nx">Dgo</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Colima</span><span class="o">|</span><span class="nx">Col</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Coahuila</span><span class="o">|</span><span class="nx">Coah</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Ciudad</span> <span class="nx">de</span> <span class="nx">México</span><span class="o">|</span><span class="nx">Ciudad</span> <span class="nx">de</span> <span class="nx">Mexico</span><span class="o">|</span><span class="nx">Chis</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Chihuahua</span><span class="o">|</span><span class="nx">Chih</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Chiapas</span><span class="o">|</span><span class="nx">Campeche</span><span class="o">|</span><span class="nx">Camp</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">CDMX</span><span class="o">|</span><span class="nx">Baja</span> <span class="nx">California</span> <span class="nx">Sur</span><span class="o">|</span><span class="nx">Baja</span> <span class="nx">California</span><span class="o">|</span><span class="nx">B</span><span class="err">\</span><span class="p">.</span><span class="nx">C</span><span class="err">\</span><span class="p">.</span><span class="nx">S</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">B</span><span class="err">\</span><span class="p">.</span><span class="nx">C</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">Aguascalientes</span><span class="o">|</span><span class="nx">Ags</span><span class="err">\</span><span class="p">.))?)?)</span>
</code></pre></div></div>

<h4 id="street-address-netherlands">Street address (Netherlands)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">((([</span><span class="err">\</span><span class="nx">w</span><span class="o">-</span><span class="p">]</span><span class="o">+</span> <span class="o">*</span><span class="p">(</span><span class="nx">bocht</span><span class="o">|</span><span class="nx">beurs</span><span class="o">|</span><span class="nx">brug</span><span class="o">|</span><span class="nx">burg</span><span class="o">|</span><span class="nx">dijk</span><span class="o">|</span><span class="nx">dreef</span><span class="o">|</span><span class="nx">gracht</span><span class="o">|</span><span class="nx">kade</span><span class="o">|</span><span class="nx">laan</span><span class="o">|</span><span class="nx">markt</span><span class="o">|</span><span class="nx">pad</span><span class="o">|</span><span class="nx">park</span><span class="o">|</span><span class="nx">plaats</span><span class="o">|</span><span class="nx">plantsoen</span><span class="o">|</span><span class="nx">plein</span><span class="o">|</span><span class="nx">pad</span><span class="o">|</span><span class="nx">poort</span><span class="o">|</span><span class="nx">rijbaan</span><span class="o">|</span><span class="nx">singel</span><span class="o">|</span><span class="nx">steeg</span><span class="o">|</span><span class="nx">stede</span><span class="o">|</span><span class="nx">straat</span><span class="o">|</span><span class="nx">str</span><span class="o">|</span><span class="nx">veld</span><span class="o">|</span><span class="nx">weg</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="p">.?</span> <span class="o">+</span><span class="p">((</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">([</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="o">-</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]{</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">})?(</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)?</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)</span><span class="o">|</span><span class="p">(</span><span class="nx">huisnummer</span><span class="o">|</span><span class="nx">Huisnummer</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">([</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="o">-</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]{</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">})?(</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)?</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)))(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">}</span> <span class="o">*</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z</span><span class="p">]{</span><span class="mi">2</span><span class="p">})</span><span class="err">\</span><span class="nx">b</span><span class="p">)?)(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">b</span><span class="p">((?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z</span><span class="p">])[</span><span class="nx">a</span><span class="o">-</span><span class="nx">zA</span><span class="o">-</span><span class="nx">Z</span><span class="p">]</span><span class="o">+</span><span class="p">(?:</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">zA</span><span class="o">-</span><span class="nx">Z</span><span class="p">]</span><span class="o">+</span><span class="p">)</span><span class="o">*</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="p">))</span><span class="o">*|</span><span class="p">(</span><span class="nx">postbus</span><span class="o">|</span><span class="nx">Postbus</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="p">?[</span><span class="err">\</span><span class="nx">d</span><span class="err">#</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">}</span> <span class="o">*</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z</span><span class="p">]{</span><span class="mi">2</span><span class="p">})</span><span class="err">\</span><span class="nx">b</span><span class="p">)?(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">b</span><span class="p">((?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z</span><span class="p">])[</span><span class="nx">a</span><span class="o">-</span><span class="nx">zA</span><span class="o">-</span><span class="nx">Z</span><span class="p">]</span><span class="o">+</span><span class="p">(?:</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">zA</span><span class="o">-</span><span class="nx">Z</span><span class="p">]</span><span class="o">+</span><span class="p">)</span><span class="o">*</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="p">))</span><span class="o">*|</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">}</span> <span class="o">*</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z</span><span class="p">]{</span><span class="mi">2</span><span class="p">})</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">b</span><span class="p">((?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Z</span><span class="p">])[</span><span class="nx">a</span><span class="o">-</span><span class="nx">zA</span><span class="o">-</span><span class="nx">Z</span><span class="p">]</span><span class="o">+</span><span class="p">(?:</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">zA</span><span class="o">-</span><span class="nx">Z</span><span class="p">]</span><span class="o">+</span><span class="p">)</span><span class="o">*</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="p">))</span><span class="o">+</span><span class="p">)</span>
</code></pre></div></div>

<h4 id="street-address-portugal">Street address (Portugal)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">av</span><span class="o">|</span><span class="nx">az</span><span class="o">|</span><span class="nx">ba</span><span class="o">|</span><span class="nx">br</span><span class="o">|</span><span class="nx">cc</span><span class="o">|</span><span class="nx">lg</span><span class="o">|</span><span class="nx">pc</span><span class="o">|</span><span class="nx">pq</span><span class="o">|</span><span class="nx">pr</span><span class="o">|</span><span class="nx">pç</span><span class="o">|</span><span class="nx">qt</span><span class="o">|</span><span class="nx">qu</span><span class="o">|</span><span class="nx">r</span><span class="o">|</span><span class="nx">tv</span><span class="o">|</span><span class="nx">vl</span><span class="o">|</span><span class="nx">zn</span><span class="o">|</span><span class="nx">al</span><span class="err">\</span><span class="p">.</span><span class="o">|</span><span class="nx">alameda</span><span class="o">|</span><span class="nx">ave</span><span class="o">|</span><span class="nx">avda</span><span class="o">|</span><span class="nx">avenida</span><span class="o">|</span><span class="nx">bai</span><span class="o">|</span><span class="nx">bairro</span><span class="o">|</span><span class="nx">bai</span><span class="o">|</span><span class="nx">bairro</span><span class="o">|</span><span class="nx">baluarte</span><span class="o">|</span><span class="nx">ca</span><span class="p">(?:</span><span class="nx">m</span><span class="o">|</span><span class="nx">is</span><span class="o">|</span><span class="nx">mpo</span><span class="o">|</span><span class="nx">sal</span><span class="o">|</span><span class="nx">lcada</span><span class="o">|</span><span class="nx">lçada</span><span class="o">|</span><span class="nx">minho</span><span class="o">|</span><span class="nx">rreiro</span><span class="o">|</span><span class="nx">lcadinha</span><span class="o">|</span><span class="nx">lçadinha</span><span class="p">)</span><span class="o">|</span><span class="nx">esc</span><span class="p">(?:</span><span class="nx">nh</span><span class="o">|</span><span class="nx">adas</span><span class="o">|</span><span class="nx">adinhas</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">es</span><span class="p">(?:</span><span class="nx">c</span><span class="o">|</span><span class="nx">t</span><span class="o">|</span><span class="nx">tr</span><span class="o">|</span><span class="nx">cnh</span><span class="o">|</span><span class="nx">cadas</span><span class="o">|</span><span class="nx">tacao</span><span class="o">|</span><span class="nx">tação</span><span class="o">|</span><span class="nx">trada</span><span class="o">|</span><span class="nx">planada</span><span class="o">|</span><span class="nx">cadinhas</span><span class="p">)</span><span class="o">|</span><span class="nx">fraiao</span><span class="o">|</span><span class="nx">fraião</span><span class="o">|</span><span class="nx">gav</span><span class="o">|</span><span class="nx">gaveto</span><span class="o">|</span><span class="nx">la</span><span class="p">(?:</span><span class="nx">rg</span><span class="o">|</span><span class="nx">rgo</span><span class="o">|</span><span class="nx">deira</span><span class="o">|</span><span class="nx">rguinho</span><span class="p">)</span><span class="o">|</span><span class="nx">lo</span><span class="p">(?:</span><span class="nx">cal</span><span class="o">|</span><span class="nx">mar</span><span class="o">|</span><span class="nx">team</span><span class="o">|</span><span class="nx">teamento</span><span class="p">)</span><span class="o">|</span><span class="nx">lug</span><span class="o">|</span><span class="nx">lugar</span><span class="o">|</span><span class="nx">nac</span><span class="o">|</span><span class="nx">nacional</span><span class="o">|</span><span class="nx">nogueiro</span><span class="o">|</span><span class="nx">nogueiró</span><span class="o">|</span><span class="nx">parque</span><span class="o">|</span><span class="nx">particular</span><span class="o">|</span><span class="nx">pa</span><span class="p">(?:</span><span class="nx">tio</span><span class="o">|</span><span class="nx">rque</span><span class="o">|</span><span class="nx">sseio</span><span class="o">|</span><span class="nx">rticular</span><span class="p">)</span><span class="o">|</span><span class="nx">pra</span><span class="p">(?:</span><span class="nx">ca</span><span class="o">|</span><span class="nx">ia</span><span class="o">|</span><span class="nx">ça</span><span class="o">|</span><span class="nx">ceta</span><span class="p">)</span><span class="o">|</span><span class="nx">prolng</span><span class="o">|</span><span class="nx">prolongamento</span><span class="o">|</span><span class="nx">qta</span><span class="o">|</span><span class="nx">qto</span><span class="o">|</span><span class="nx">quarta</span><span class="o">|</span><span class="nx">quarto</span><span class="o">|</span><span class="nx">quarta</span><span class="o">|</span><span class="nx">quarto</span><span class="o">|</span><span class="nx">quinta</span><span class="o">|</span><span class="nx">rot</span><span class="o">|</span><span class="nx">rodovia</span><span class="o">|</span><span class="nx">rotunda</span><span class="o">|</span><span class="nx">rua</span><span class="o">|</span><span class="nx">ruas</span><span class="o">|</span><span class="nx">santa</span><span class="o">|</span><span class="nx">santo</span><span class="o">|</span><span class="nx">sao</span><span class="o">|</span><span class="nx">santa</span><span class="o">|</span><span class="nx">santo</span><span class="o">|</span><span class="nx">tenoes</span><span class="o">|</span><span class="nx">tenões</span><span class="o">|</span><span class="nx">tenoes</span><span class="o">|</span><span class="nx">tenões</span><span class="o">|</span><span class="nx">terreiro</span><span class="o">|</span><span class="nx">tra</span><span class="p">(?:</span><span class="nx">nsv</span><span class="o">|</span><span class="nx">vessa</span><span class="o">|</span><span class="nx">nsversal</span><span class="p">)</span><span class="o">|</span><span class="nx">urb</span><span class="p">(?:</span><span class="nx">anizacao</span><span class="o">|</span><span class="nx">anização</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">vi</span><span class="p">(?:</span><span class="nx">la</span><span class="o">|</span><span class="nx">ela</span><span class="o">|</span><span class="nx">aduto</span><span class="o">|</span><span class="nx">venda</span><span class="p">)</span><span class="o">|</span><span class="nx">arco</span><span class="o">|</span><span class="nx">azinhaga</span><span class="o">|</span><span class="nx">beco</span><span class="o">|</span><span class="nx">ccnh</span><span class="o">|</span><span class="nx">charneca</span><span class="o">|</span><span class="nx">circular</span><span class="o">|</span><span class="nx">csl</span><span class="o">|</span><span class="nx">entrada</span><span class="o">|</span><span class="nx">forte</span><span class="o">|</span><span class="nx">impasse</span><span class="o">|</span><span class="nx">jardim</span><span class="o">|</span><span class="nx">jrd</span><span class="o">|</span><span class="nx">lgo</span><span class="o">|</span><span class="nx">mercado</span><span class="o">|</span><span class="nx">monte</span><span class="o">|</span><span class="nx">pct</span><span class="o">|</span><span class="nx">pto</span><span class="o">|</span><span class="nx">pátio</span><span class="o">|</span><span class="nx">rampa</span><span class="o">|</span><span class="nx">sitio</span><span class="o">|</span><span class="nx">são</span><span class="o">|</span><span class="nx">sítio</span><span class="o">|</span><span class="nx">tunel</span><span class="o">|</span><span class="nx">túnel</span><span class="o">|</span><span class="nx">vale</span><span class="o">|</span><span class="nx">vereda</span><span class="o">|</span><span class="nx">volta</span><span class="o">|</span><span class="nx">zona</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:([</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">]</span><span class="o">+</span><span class="p">[,</span><span class="err">\</span><span class="p">.]</span><span class="o">*</span> <span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">6</span><span class="p">}[</span><span class="err">\</span><span class="nx">d</span><span class="err">#</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">]?(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">bis</span><span class="p">)?</span><span class="o">|</span><span class="p">([</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">]</span><span class="o">+</span><span class="p">[,</span><span class="err">\</span><span class="p">.]</span><span class="o">*</span> <span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">6</span><span class="p">}(</span><span class="nx">s</span><span class="o">/</span><span class="nx">n</span><span class="o">|</span><span class="nx">sem</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">número</span><span class="p">))</span><span class="err">\</span><span class="p">.?,?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(?:</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">bl</span><span class="o">|</span><span class="nx">cv</span><span class="o">|</span><span class="nx">lj</span><span class="o">|</span><span class="nx">lt</span><span class="o">|</span><span class="nx">rc</span><span class="o">|</span><span class="nx">tr</span><span class="o">|</span><span class="nx">vv</span><span class="o">|</span><span class="nx">apt</span><span class="o">|</span><span class="nx">apartamento</span><span class="o">|</span><span class="nx">edf</span><span class="o">|</span><span class="nx">edificio</span><span class="o">|</span><span class="nx">edifício</span><span class="o">|</span><span class="nx">hab</span><span class="p">(?:</span><span class="nx">itacao</span><span class="o">|</span><span class="nx">itação</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">loja</span><span class="o">|</span><span class="nx">lote</span><span class="o">|</span><span class="nx">bloco</span><span class="o">|</span><span class="nx">cave</span><span class="o">|</span><span class="nx">res</span><span class="o">-</span><span class="k">do</span><span class="o">-</span><span class="nx">chao</span><span class="o">|</span><span class="nx">rés</span><span class="o">-</span><span class="k">do</span><span class="o">-</span><span class="nx">chão</span><span class="o">|</span><span class="nx">scv</span><span class="o">|</span><span class="nx">slj</span><span class="o">|</span><span class="nx">sobre</span><span class="o">-</span><span class="nx">loja</span><span class="o">|</span><span class="nx">sub</span><span class="o">-</span><span class="nx">cave</span><span class="o">|</span><span class="nx">torre</span><span class="o">|</span><span class="nx">vivenda</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">]</span><span class="o">+</span><span class="p">[,</span><span class="err">\</span><span class="p">.]</span><span class="o">*</span> <span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">4</span><span class="p">}[</span><span class="err">\</span><span class="nx">d</span><span class="err">#</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">(?:</span><span class="nx">º</span><span class="o">|</span><span class="nx">ª</span><span class="p">)?[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">]?</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">bl</span><span class="o">|</span><span class="nx">cv</span><span class="o">|</span><span class="nx">lj</span><span class="o">|</span><span class="nx">lt</span><span class="o">|</span><span class="nx">rc</span><span class="o">|</span><span class="nx">tr</span><span class="o">|</span><span class="nx">vv</span><span class="o">|</span><span class="nx">apt</span><span class="o">|</span><span class="nx">apartamento</span><span class="o">|</span><span class="nx">edf</span><span class="o">|</span><span class="nx">edificio</span><span class="o">|</span><span class="nx">edifício</span><span class="o">|</span><span class="nx">hab</span><span class="p">(?:</span><span class="nx">itacao</span><span class="o">|</span><span class="nx">itação</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">loja</span><span class="o">|</span><span class="nx">lote</span><span class="o">|</span><span class="nx">bloco</span><span class="o">|</span><span class="nx">cave</span><span class="o">|</span><span class="nx">res</span><span class="o">-</span><span class="k">do</span><span class="o">-</span><span class="nx">chao</span><span class="o">|</span><span class="nx">rés</span><span class="o">-</span><span class="k">do</span><span class="o">-</span><span class="nx">chão</span><span class="o">|</span><span class="nx">scv</span><span class="o">|</span><span class="nx">slj</span><span class="o">|</span><span class="nx">sobre</span><span class="o">-</span><span class="nx">loja</span><span class="o">|</span><span class="nx">sub</span><span class="o">-</span><span class="nx">cave</span><span class="o">|</span><span class="nx">torre</span><span class="o">|</span><span class="nx">vivenda</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0</span><span class="o">-</span><span class="mi">9</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">)(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">de</span><span class="o">|</span><span class="nx">da</span><span class="o">|</span><span class="k">do</span><span class="o">|</span><span class="nx">dos</span><span class="o">|</span><span class="nx">das</span><span class="o">|</span><span class="nx">e</span><span class="o">|&amp;</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0</span><span class="o">-</span><span class="mi">9</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">))?</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="p">([</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">]</span><span class="o">+</span><span class="p">[,</span><span class="err">\</span><span class="p">.]</span><span class="o">*</span> <span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">4</span><span class="p">}[</span><span class="err">\</span><span class="nx">d</span><span class="err">#</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">(?:</span><span class="nx">º</span><span class="o">|</span><span class="nx">ª</span><span class="p">)?[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">]?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">ft</span><span class="o">|</span><span class="nx">tr</span><span class="o">|</span><span class="nx">esq</span><span class="o">|</span><span class="nx">esquerdo</span><span class="o">|</span><span class="nx">andar</span><span class="o">|</span><span class="nx">direito</span><span class="o">|</span><span class="nx">dto</span><span class="o">|</span><span class="nx">frente</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">cave</span><span class="o">|</span><span class="nx">res</span><span class="o">-</span><span class="k">do</span><span class="o">-</span><span class="nx">chao</span><span class="o">|</span><span class="nx">rés</span><span class="o">-</span><span class="k">do</span><span class="o">-</span><span class="nx">chão</span><span class="o">|</span><span class="nx">sobre</span><span class="o">-</span><span class="nx">loja</span><span class="o">|</span><span class="nx">sub</span><span class="o">-</span><span class="nx">cave</span><span class="p">)</span><span class="err">\</span><span class="p">.?)(?:(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">angola</span><span class="o">|</span><span class="nx">brasil</span><span class="o">|</span><span class="nx">brazil</span><span class="o">|</span><span class="nx">cabo</span> <span class="nx">verde</span><span class="o">|</span><span class="nx">guine</span><span class="o">-</span><span class="nx">bissau</span><span class="o">|</span><span class="nx">guiné</span><span class="o">-</span><span class="nx">bissau</span><span class="o">|</span><span class="nx">macau</span><span class="o">|</span><span class="nx">mocambique</span><span class="o">|</span><span class="nx">mozambique</span><span class="o">|</span><span class="nx">moçambique</span><span class="o">|</span><span class="nx">portugal</span><span class="o">|</span><span class="nx">sao</span> <span class="nx">tome</span> <span class="nx">e</span> <span class="nx">principe</span><span class="o">|</span><span class="nx">são</span> <span class="nx">tomé</span> <span class="nx">e</span> <span class="nx">príncipe</span><span class="o">|</span><span class="nx">timor</span><span class="o">-</span><span class="nx">leste</span><span class="o">|</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:(?:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0</span><span class="o">-</span><span class="mi">9</span><span class="nx">ºª</span><span class="o">&amp;</span><span class="sr">/]*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))(?:\s</span><span class="sr">+</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))){0,4})(?:</span><span class="sr">,</span><span class="se">\s</span><span class="sr">*</span><span class="se">(?:(?:</span><span class="sr">angola|brasil|brazil|cabo verde|guine-bissau|guiné-bissau|macau|mocambique|mozambique|moçambique|portugal|sao tome e principe|são tomé e príncipe|timor-leste|</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))(?:\s</span><span class="sr">+</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))){0,4})))</span><span class="sr">*|</span><span class="se">(?:</span><span class="sr">,</span><span class="se">\s</span><span class="sr">*</span><span class="se">(?:(?:</span><span class="sr">angola|brasil|brazil|cabo verde|guine-bissau|guiné-bissau|macau|mocambique|mozambique|moçambique|portugal|sao tome e principe|são tomé e príncipe|timor-leste|</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))(?:\s</span><span class="sr">+</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))){0,4})))</span><span class="sr">+</span><span class="se">))?</span><span class="sr">|</span><span class="se">\b(</span><span class="sr">av|az|ba|br|cc|lg|pc|pq|pr|pç|qt|qu|r|tv|vl|zn|al</span><span class="se">\.</span><span class="sr">|alameda|ave|avda|avenida|bai|bairro|bai|bairro|baluarte|ca</span><span class="se">(?:</span><span class="sr">m|is|mpo|sal|lcada|lçada|minho|rreiro|lcadinha|lçadinha</span><span class="se">)</span><span class="sr">|esc</span><span class="se">(?:</span><span class="sr">nh|adas|adinhas|</span><span class="se">)</span><span class="sr">|es</span><span class="se">(?:</span><span class="sr">c|t|tr|cnh|cadas|tacao|tação|trada|planada|cadinhas</span><span class="se">)</span><span class="sr">|fraiao|fraião|gav|gaveto|la</span><span class="se">(?:</span><span class="sr">rg|rgo|deira|rguinho</span><span class="se">)</span><span class="sr">|lo</span><span class="se">(?:</span><span class="sr">cal|mar|team|teamento</span><span class="se">)</span><span class="sr">|lug|lugar|nac|nacional|nogueiro|nogueiró|parque|particular|pa</span><span class="se">(?:</span><span class="sr">tio|rque|sseio|rticular</span><span class="se">)</span><span class="sr">|pra</span><span class="se">(?:</span><span class="sr">ca|ia|ça|ceta</span><span class="se">)</span><span class="sr">|prolng|prolongamento|qta|qto|quarta|quarto|quarta|quarto|quinta|rot|rodovia|rotunda|rua|ruas|santa|santo|sao|santa|santo|tenoes|tenões|tenoes|tenões|terreiro|tra</span><span class="se">(?:</span><span class="sr">nsv|vessa|nsversal</span><span class="se">)</span><span class="sr">|urb</span><span class="se">(?:</span><span class="sr">anizacao|anização|</span><span class="se">)</span><span class="sr">|vi</span><span class="se">(?:</span><span class="sr">la|ela|aduto|venda</span><span class="se">)</span><span class="sr">|arco|azinhaga|beco|ccnh|charneca|circular|csl|entrada|forte|impasse|jardim|jrd|lgo|mercado|monte|pct|pto|pátio|rampa|sitio|são|sítio|tunel|túnel|vale|vereda|volta|zona</span><span class="se">)\.?\s</span><span class="sr">+</span><span class="se">(?:([</span><span class="sr">0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">,</span><span class="se">\.]</span><span class="sr">* </span><span class="se">){0,6}[\d</span><span class="sr">#-</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="se">]?(?:\s</span><span class="sr">+bis</span><span class="se">)?</span><span class="sr">|</span><span class="se">([</span><span class="sr">0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">,</span><span class="se">\.]</span><span class="sr">* </span><span class="se">){0,6}(</span><span class="sr">s/</span><span class="nx">n</span><span class="o">|</span><span class="nx">sem</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="nx">número</span><span class="p">))</span><span class="err">\</span><span class="p">.?(?:(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">angola</span><span class="o">|</span><span class="nx">brasil</span><span class="o">|</span><span class="nx">brazil</span><span class="o">|</span><span class="nx">cabo</span> <span class="nx">verde</span><span class="o">|</span><span class="nx">guine</span><span class="o">-</span><span class="nx">bissau</span><span class="o">|</span><span class="nx">guiné</span><span class="o">-</span><span class="nx">bissau</span><span class="o">|</span><span class="nx">macau</span><span class="o">|</span><span class="nx">mocambique</span><span class="o">|</span><span class="nx">mozambique</span><span class="o">|</span><span class="nx">moçambique</span><span class="o">|</span><span class="nx">portugal</span><span class="o">|</span><span class="nx">sao</span> <span class="nx">tome</span> <span class="nx">e</span> <span class="nx">principe</span><span class="o">|</span><span class="nx">são</span> <span class="nx">tomé</span> <span class="nx">e</span> <span class="nx">príncipe</span><span class="o">|</span><span class="nx">timor</span><span class="o">-</span><span class="nx">leste</span><span class="o">|</span><span class="p">(?</span><span class="o">-</span><span class="nx">i</span><span class="p">:(?:[</span><span class="nx">A</span><span class="o">-</span><span class="nx">ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="p">][</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0</span><span class="o">-</span><span class="mi">9</span><span class="nx">ºª</span><span class="o">&amp;</span><span class="sr">/]*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))(?:\s</span><span class="sr">+</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))){0,4})(?:</span><span class="sr">,</span><span class="se">\s</span><span class="sr">*</span><span class="se">(?:(?:</span><span class="sr">angola|brasil|brazil|cabo verde|guine-bissau|guiné-bissau|macau|mocambique|mozambique|moçambique|portugal|sao tome e principe|são tomé e príncipe|timor-leste|</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))(?:\s</span><span class="sr">+</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))){0,4})))</span><span class="sr">*|</span><span class="se">(?:</span><span class="sr">,</span><span class="se">\s</span><span class="sr">*</span><span class="se">(?:(?:</span><span class="sr">angola|brasil|brazil|cabo verde|guine-bissau|guiné-bissau|macau|mocambique|mozambique|moçambique|portugal|sao tome e principe|são tomé e príncipe|timor-leste|</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))(?:\s</span><span class="sr">+</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))){0,4})))</span><span class="sr">+</span><span class="se">))?</span><span class="sr">|^</span><span class="se">\b(</span><span class="sr">bl|cv|lj|lt|rc|tr|vv|apt|apartamento|edf|edificio|edifício|hab</span><span class="se">(?:</span><span class="sr">itacao|itação|</span><span class="se">)</span><span class="sr">|loja|lote|bloco|cave|res-do-chao|rés-do-chão|scv|slj|sobre-loja|sub-cave|torre|vivenda</span><span class="se">)\.?\s</span><span class="sr">+</span><span class="se">([</span><span class="sr">0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">,</span><span class="se">\.]</span><span class="sr">* </span><span class="se">){0,4}[\d</span><span class="sr">#-</span><span class="se">]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">º|ª</span><span class="se">)?[</span><span class="sr">0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="se">]?</span><span class="sr">$|</span><span class="se">(</span><span class="sr">apartado|caixa postal|c</span><span class="se">\.?</span><span class="sr">p</span><span class="se">\.?)\s</span><span class="sr">+</span><span class="se">\d</span><span class="sr">+</span><span class="se">(?:(?:\s</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">angola|brasil|brazil|cabo verde|guine-bissau|guiné-bissau|macau|mocambique|mozambique|moçambique|portugal|sao tome e principe|são tomé e príncipe|timor-leste|</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))(?:\s</span><span class="sr">+</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))){0,4})(?:</span><span class="sr">,</span><span class="se">\s</span><span class="sr">*</span><span class="se">(?:(?:</span><span class="sr">angola|brasil|brazil|cabo verde|guine-bissau|guiné-bissau|macau|mocambique|mozambique|moçambique|portugal|sao tome e principe|são tomé e príncipe|timor-leste|</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))(?:\s</span><span class="sr">+</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))){0,4})))</span><span class="sr">*|</span><span class="se">(?:</span><span class="sr">,</span><span class="se">\s</span><span class="sr">*</span><span class="se">(?:(?:</span><span class="sr">angola|brasil|brazil|cabo verde|guine-bissau|guiné-bissau|macau|mocambique|mozambique|moçambique|portugal|sao tome e principe|são tomé e príncipe|timor-leste|</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))(?:\s</span><span class="sr">+</span><span class="se">(?</span><span class="sr">-i:</span><span class="se">(?:[</span><span class="sr">A-ZÁÂÃÀÇÉÊÍÓÔÕÚÜ</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*|</span><span class="se">[</span><span class="sr">0-9</span><span class="se">][</span><span class="sr">0-9</span><span class="se">]</span><span class="sr">+</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">*</span><span class="se">(?:</span><span class="sr">-</span><span class="se">[</span><span class="sr">A-Za-zÁÂÃÀÇÉÊÍÓÔÕÚÜáâãàçéêíóôõúü0-9ºª&amp;</span><span class="se">/]</span><span class="sr">+</span><span class="se">)</span><span class="sr">*</span><span class="se">))){0,4})))</span><span class="sr">+</span><span class="se">))?</span><span class="err">)
</span></code></pre></div></div>

<h4 id="street-address-spain">Street address (Spain)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">((((</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">av</span><span class="o">|</span><span class="nx">avda</span><span class="o">|</span><span class="nx">avenida</span><span class="o">|</span><span class="nx">barriada</span><span class="o">|</span><span class="nx">barrio</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">bulevar</span><span class="o">|</span><span class="nx">c</span><span class="o">|</span><span class="nx">c</span><span class="o">/|</span><span class="nx">calle</span><span class="o">|</span><span class="nx">callejon</span><span class="o">|</span><span class="nx">callejón</span><span class="o">|</span><span class="nx">calzada</span><span class="o">|</span><span class="nx">camino</span><span class="o">|</span><span class="nx">carrera</span><span class="o">|</span><span class="nx">carretera</span><span class="o">|</span><span class="nx">circunvalacion</span><span class="o">|</span><span class="nx">circunvalación</span><span class="o">|</span><span class="nx">colonia</span><span class="o">|</span><span class="nx">corredera</span><span class="o">|</span><span class="nx">costanilla</span><span class="o">|</span><span class="nx">cuesta</span><span class="o">|</span><span class="nx">diagonal</span><span class="o">|</span><span class="nx">eje</span><span class="o">|</span><span class="nx">esq</span><span class="o">|</span><span class="nx">esquina</span><span class="o">|</span><span class="nx">glorieta</span><span class="o">|</span><span class="nx">malecon</span><span class="o">|</span><span class="nx">malecón</span><span class="o">|</span><span class="nx">muelle</span><span class="o">|</span><span class="nx">parque</span><span class="o">|</span><span class="nx">parques</span><span class="o">|</span><span class="nx">pasaje</span><span class="o">|</span><span class="nx">paseo</span><span class="o">|</span><span class="nx">placeta</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">poblado</span><span class="o">|</span><span class="nx">rambla</span><span class="o">|</span><span class="nx">retorno</span><span class="o">|</span><span class="nx">ronda</span><span class="o">|</span><span class="nx">rua</span><span class="o">|</span><span class="nx">ruta</span><span class="o">|</span><span class="nx">rúa</span><span class="o">|</span><span class="nx">senda</span><span class="o">|</span><span class="nx">transversal</span><span class="o">|</span><span class="nx">travesia</span><span class="o">|</span><span class="nx">travesía</span><span class="o">|</span><span class="nx">urbanizacion</span><span class="o">|</span><span class="nx">urbanización</span><span class="o">|</span><span class="nx">via</span><span class="o">|</span><span class="nx">viaducto</span><span class="o">|</span><span class="nx">vía</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*|</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*|[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*|[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">((</span><span class="nx">Edificio</span><span class="o">|</span><span class="nx">Edif</span><span class="o">|</span><span class="nx">torre</span><span class="o">|</span><span class="k">case</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)?</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">([</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="nx">bº</span><span class="p">?(</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)?(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">esq</span><span class="o">|</span><span class="nx">esquina</span><span class="p">)</span><span class="err">\</span><span class="p">.?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="err">\</span><span class="nx">w</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*){1,2})?)</span><span class="se">\</span><span class="s1">s*,?</span><span class="se">\</span><span class="s1">s+((Apartamento|DEP|DPTO|Departamento|Depto|Nro|Numero|N°|Número|Piso|Puerta|apt|apt.|apto)</span><span class="se">\</span><span class="s1">s+)?</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">d([</span><span class="se">\</span><span class="s1">da-fA-F]){0,3}</span><span class="se">\</span><span class="s1">bº?( [a-fA-F]</span><span class="se">\</span><span class="s1">b)?(</span><span class="se">\</span><span class="s1">s+(Derecha|Dcha|Izq|Izquierda)</span><span class="se">\</span><span class="s1">.?)?)|(</span><span class="se">\</span><span class="s1">b(av|avda|avenida|barriada|barrio|boulevard|bulevar|c|c/|calle|callejon|callejón|calzada|camino|carrera|carretera|circunvalacion|circunvalación|colonia|corredera|costanilla|cuesta|diagonal|eje|esq|esquina|glorieta|malecon|malecón|muelle|parque|parques|pasaje|paseo|placeta|plaza|poblado|rambla|retorno|ronda|rua|ruta|rúa|senda|transversal|travesia|travesía|urbanizacion|urbanización|via|viaducto|vía)</span><span class="se">\</span><span class="s1">.?</span><span class="se">\</span><span class="s1">s+([0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*|[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*|</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*|</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäayÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäayÿ</span><span class="dl">'</span><span class="s1">’.]*)</span><span class="se">\</span><span class="s1">s*,?</span><span class="se">\</span><span class="s1">s+((Edificio|Edif|torre|case)</span><span class="se">\</span><span class="s1">s+)?</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">d([</span><span class="se">\</span><span class="s1">da-fA-F]){0,3}</span><span class="se">\</span><span class="s1">bº?( [a-fA-F]</span><span class="se">\</span><span class="s1">b)?(?:</span><span class="se">\</span><span class="s1">s+(?:esq|esquina)</span><span class="se">\</span><span class="s1">.?(</span><span class="se">\</span><span class="s1">s+[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäayÿ][</span><span class="se">\</span><span class="s1">w.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">})?))(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">5</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäayÿ</span><span class="p">]</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="p">)?(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">España</span><span class="o">|</span><span class="nx">Espana</span><span class="o">|</span><span class="nx">Spain</span><span class="p">))?)</span><span class="o">|</span><span class="p">((</span><span class="nx">Apartado</span> <span class="nx">de</span> <span class="nx">Correos</span><span class="o">|</span><span class="nx">Casilla</span> <span class="nx">de</span> <span class="nx">Correo</span><span class="o">|</span><span class="nx">C</span><span class="err">\</span><span class="p">.?</span><span class="nx">C</span><span class="err">\</span><span class="p">.?)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">España</span><span class="o">|</span><span class="nx">Espana</span><span class="o">|</span><span class="nx">Spain</span><span class="p">))?)</span><span class="o">|</span><span class="p">((</span><span class="nx">Edif</span><span class="o">|</span><span class="nx">Edificio</span><span class="o">|</span><span class="k">case</span><span class="o">|</span><span class="nx">torre</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">([</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="nx">bº</span><span class="p">?(</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)?([,</span><span class="err">\</span><span class="nx">s</span><span class="p">]</span><span class="o">+</span><span class="p">((</span><span class="nx">Apartamento</span><span class="o">|</span><span class="nx">DEP</span><span class="o">|</span><span class="nx">DPTO</span><span class="o">|</span><span class="nx">Departamento</span><span class="o">|</span><span class="nx">Depto</span><span class="o">|</span><span class="nx">Nro</span><span class="o">|</span><span class="nx">Numero</span><span class="o">|</span><span class="nx">N</span><span class="err">°</span><span class="o">|</span><span class="nx">Número</span><span class="o">|</span><span class="nx">Piso</span><span class="o">|</span><span class="nx">Puerta</span><span class="o">|</span><span class="nx">apt</span><span class="o">|</span><span class="nx">apt</span><span class="p">.</span><span class="o">|</span><span class="nx">apto</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">([</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="nx">bº</span><span class="p">?(</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)?))?(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">España</span><span class="o">|</span><span class="nx">Espana</span><span class="o">|</span><span class="nx">Spain</span><span class="p">))?)((((</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="nx">av</span><span class="o">|</span><span class="nx">avda</span><span class="o">|</span><span class="nx">avenida</span><span class="o">|</span><span class="nx">barriada</span><span class="o">|</span><span class="nx">barrio</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">bulevar</span><span class="o">|</span><span class="nx">c</span><span class="o">|</span><span class="nx">c</span><span class="o">/|</span><span class="nx">calle</span><span class="o">|</span><span class="nx">callejon</span><span class="o">|</span><span class="nx">callejón</span><span class="o">|</span><span class="nx">calzada</span><span class="o">|</span><span class="nx">camino</span><span class="o">|</span><span class="nx">carrera</span><span class="o">|</span><span class="nx">carretera</span><span class="o">|</span><span class="nx">circunvalacion</span><span class="o">|</span><span class="nx">circunvalación</span><span class="o">|</span><span class="nx">colonia</span><span class="o">|</span><span class="nx">corredera</span><span class="o">|</span><span class="nx">costanilla</span><span class="o">|</span><span class="nx">cuesta</span><span class="o">|</span><span class="nx">diagonal</span><span class="o">|</span><span class="nx">eje</span><span class="o">|</span><span class="nx">esq</span><span class="o">|</span><span class="nx">esquina</span><span class="o">|</span><span class="nx">glorieta</span><span class="o">|</span><span class="nx">malecon</span><span class="o">|</span><span class="nx">malecón</span><span class="o">|</span><span class="nx">muelle</span><span class="o">|</span><span class="nx">parque</span><span class="o">|</span><span class="nx">parques</span><span class="o">|</span><span class="nx">pasaje</span><span class="o">|</span><span class="nx">paseo</span><span class="o">|</span><span class="nx">placeta</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">poblado</span><span class="o">|</span><span class="nx">rambla</span><span class="o">|</span><span class="nx">retorno</span><span class="o">|</span><span class="nx">ronda</span><span class="o">|</span><span class="nx">rua</span><span class="o">|</span><span class="nx">ruta</span><span class="o">|</span><span class="nx">rúa</span><span class="o">|</span><span class="nx">senda</span><span class="o">|</span><span class="nx">transversal</span><span class="o">|</span><span class="nx">travesia</span><span class="o">|</span><span class="nx">travesía</span><span class="o">|</span><span class="nx">urbanizacion</span><span class="o">|</span><span class="nx">urbanización</span><span class="o">|</span><span class="nx">via</span><span class="o">|</span><span class="nx">viaducto</span><span class="o">|</span><span class="nx">vía</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*|</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*|[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*|[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">((</span><span class="nx">Edificio</span><span class="o">|</span><span class="nx">Edif</span><span class="o">|</span><span class="nx">torre</span><span class="o">|</span><span class="k">case</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)?</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">([</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="nx">bº</span><span class="p">?(</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)?(?:</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">esq</span><span class="o">|</span><span class="nx">esquina</span><span class="p">)</span><span class="err">\</span><span class="p">.?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="err">\</span><span class="nx">w</span><span class="p">.</span><span class="dl">'</span><span class="s1">-]*){1,2})?)</span><span class="se">\</span><span class="s1">s*,?</span><span class="se">\</span><span class="s1">s+((Apartamento|DEP|DPTO|Departamento|Depto|Nro|Numero|N°|Número|Piso|Puerta|apt|apt.|apto)</span><span class="se">\</span><span class="s1">s+)?</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">d([</span><span class="se">\</span><span class="s1">da-fA-F]){0,3}</span><span class="se">\</span><span class="s1">bº?( [a-fA-F]</span><span class="se">\</span><span class="s1">b)?(</span><span class="se">\</span><span class="s1">s+(Derecha|Dcha|Izq|Izquierda)</span><span class="se">\</span><span class="s1">.?)?)|(</span><span class="se">\</span><span class="s1">b(av|avda|avenida|barriada|barrio|boulevard|bulevar|c|c/|calle|callejon|callejón|calzada|camino|carrera|carretera|circunvalacion|circunvalación|colonia|corredera|costanilla|cuesta|diagonal|eje|esq|esquina|glorieta|malecon|malecón|muelle|parque|parques|pasaje|paseo|placeta|plaza|poblado|rambla|retorno|ronda|rua|ruta|rúa|senda|transversal|travesia|travesía|urbanizacion|urbanización|via|viaducto|vía)</span><span class="se">\</span><span class="s1">.?</span><span class="se">\</span><span class="s1">s+([0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*|[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*|</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="s1">’.]*</span><span class="se">\</span><span class="s1">s+[A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ][-0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñóôõöøùúûüýÿ</span><span class="dl">'</span><span class="err">’</span><span class="p">.]</span><span class="o">*|</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäayÿ</span><span class="p">][</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">9</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäayÿ</span><span class="dl">'</span><span class="s1">’.]*)</span><span class="se">\</span><span class="s1">s*,?</span><span class="se">\</span><span class="s1">s+((Edificio|Edif|torre|case)</span><span class="se">\</span><span class="s1">s+)?</span><span class="se">\</span><span class="s1">b</span><span class="se">\</span><span class="s1">d([</span><span class="se">\</span><span class="s1">da-fA-F]){0,3}</span><span class="se">\</span><span class="s1">bº?( [a-fA-F]</span><span class="se">\</span><span class="s1">b)?(?:</span><span class="se">\</span><span class="s1">s+(?:esq|esquina)</span><span class="se">\</span><span class="s1">.?(</span><span class="se">\</span><span class="s1">s+[0-9A-Za-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäayÿ][</span><span class="se">\</span><span class="s1">w.</span><span class="dl">'</span><span class="o">-</span><span class="p">]</span><span class="o">*</span><span class="p">){</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">})?))(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">5</span><span class="p">]</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäayÿ</span><span class="p">]</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="p">)?(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">España</span><span class="o">|</span><span class="nx">Espana</span><span class="o">|</span><span class="nx">Spain</span><span class="p">))?)</span><span class="o">|</span><span class="p">((</span><span class="nx">Apartado</span> <span class="nx">de</span> <span class="nx">Correos</span><span class="o">|</span><span class="nx">Casilla</span> <span class="nx">de</span> <span class="nx">Correo</span><span class="o">|</span><span class="nx">C</span><span class="err">\</span><span class="p">.?</span><span class="nx">C</span><span class="err">\</span><span class="p">.?)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">España</span><span class="o">|</span><span class="nx">Espana</span><span class="o">|</span><span class="nx">Spain</span><span class="p">))?)</span><span class="o">|</span><span class="p">((</span><span class="nx">Edif</span><span class="o">|</span><span class="nx">Edificio</span><span class="o">|</span><span class="k">case</span><span class="o">|</span><span class="nx">torre</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">([</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="nx">bº</span><span class="p">?(</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)?([,</span><span class="err">\</span><span class="nx">s</span><span class="p">]</span><span class="o">+</span><span class="p">((</span><span class="nx">Apartamento</span><span class="o">|</span><span class="nx">DEP</span><span class="o">|</span><span class="nx">DPTO</span><span class="o">|</span><span class="nx">Departamento</span><span class="o">|</span><span class="nx">Depto</span><span class="o">|</span><span class="nx">Nro</span><span class="o">|</span><span class="nx">Numero</span><span class="o">|</span><span class="nx">N</span><span class="err">°</span><span class="o">|</span><span class="nx">Número</span><span class="o">|</span><span class="nx">Piso</span><span class="o">|</span><span class="nx">Puerta</span><span class="o">|</span><span class="nx">apt</span><span class="o">|</span><span class="nx">apt</span><span class="p">.</span><span class="o">|</span><span class="nx">apto</span><span class="p">)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="p">([</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}</span><span class="err">\</span><span class="nx">bº</span><span class="p">?(</span> <span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">fA</span><span class="o">-</span><span class="nx">F</span><span class="p">]</span><span class="err">\</span><span class="nx">b</span><span class="p">)?))?(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">España</span><span class="o">|</span><span class="nx">Espana</span><span class="o">|</span><span class="nx">Spain</span><span class="p">))?)</span>
</code></pre></div></div>

<h4 id="street-address-united-states">Street address (United States)</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">(</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]?(</span><span class="o">-</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">)?</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">}(?:</span><span class="nx">st</span><span class="o">|</span><span class="nx">rd</span><span class="o">|</span><span class="nx">dr</span><span class="o">|</span><span class="nx">ln</span><span class="o">|</span><span class="nx">ct</span><span class="o">|</span><span class="nx">pl</span><span class="o">|</span><span class="nx">sq</span><span class="o">|</span><span class="nx">ave</span><span class="o">|</span><span class="nx">avenue</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">cir</span><span class="o">|</span><span class="nx">circle</span><span class="o">|</span><span class="nx">plz</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">trl</span><span class="o">|</span><span class="nx">trail</span><span class="o">|</span><span class="nx">ter</span><span class="o">|</span><span class="nx">terrace</span><span class="o">|</span><span class="nx">center</span><span class="o">|</span><span class="nx">centre</span><span class="o">|</span><span class="nx">exp</span><span class="p">(?:</span><span class="nx">r</span><span class="o">|</span><span class="nx">w</span><span class="o">|</span><span class="nx">y</span><span class="o">|</span><span class="nx">wy</span><span class="o">|</span><span class="nx">ressway</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">street</span><span class="o">|</span><span class="nx">road</span><span class="o">|</span><span class="nx">drive</span><span class="o">|</span><span class="nx">blvd</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">lane</span><span class="o">|</span><span class="nx">court</span><span class="o">|</span><span class="nx">way</span><span class="o">|</span><span class="nx">pkwy</span><span class="o">|</span><span class="nx">parkway</span><span class="o">|</span><span class="nx">hwy</span><span class="o">|</span><span class="nx">highway</span><span class="o">|</span><span class="nx">square</span><span class="o">|</span><span class="nx">loop</span><span class="o">|</span><span class="nx">broadway</span><span class="o">|</span><span class="nx">ctr</span><span class="o">|</span><span class="nx">pike</span><span class="p">)</span><span class="err">\</span><span class="p">.?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">N</span><span class="o">|</span><span class="nx">S</span><span class="o">|</span><span class="nx">E</span><span class="o">|</span><span class="nx">W</span><span class="o">|</span><span class="nx">NE</span><span class="o">|</span><span class="nx">NW</span><span class="o">|</span><span class="nx">SE</span><span class="o">|</span><span class="nx">SW</span><span class="p">))?</span><span class="o">|</span><span class="err">\</span><span class="nx">b</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">}</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(?:</span><span class="nx">st</span><span class="o">|</span><span class="nx">rd</span><span class="o">|</span><span class="nx">dr</span><span class="o">|</span><span class="nx">ln</span><span class="o">|</span><span class="nx">ct</span><span class="o">|</span><span class="nx">pl</span><span class="o">|</span><span class="nx">sq</span><span class="o">|</span><span class="nx">ave</span><span class="o">|</span><span class="nx">avenue</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">cir</span><span class="o">|</span><span class="nx">circle</span><span class="o">|</span><span class="nx">plz</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">trl</span><span class="o">|</span><span class="nx">trail</span><span class="o">|</span><span class="nx">ter</span><span class="o">|</span><span class="nx">terrace</span><span class="o">|</span><span class="nx">center</span><span class="o">|</span><span class="nx">centre</span><span class="o">|</span><span class="nx">exp</span><span class="p">(?:</span><span class="nx">r</span><span class="o">|</span><span class="nx">w</span><span class="o">|</span><span class="nx">y</span><span class="o">|</span><span class="nx">wy</span><span class="o">|</span><span class="nx">ressway</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">street</span><span class="o">|</span><span class="nx">road</span><span class="o">|</span><span class="nx">drive</span><span class="o">|</span><span class="nx">blvd</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">lane</span><span class="o">|</span><span class="nx">court</span><span class="o">|</span><span class="nx">way</span><span class="o">|</span><span class="nx">pkwy</span><span class="o">|</span><span class="nx">parkway</span><span class="o">|</span><span class="nx">hwy</span><span class="o">|</span><span class="nx">highway</span><span class="o">|</span><span class="nx">square</span><span class="o">|</span><span class="nx">loop</span><span class="o">|</span><span class="nx">broadway</span><span class="o">|</span><span class="nx">ctr</span><span class="o">|</span><span class="nx">pike</span><span class="p">)</span><span class="err">\</span><span class="p">.?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">N</span><span class="o">|</span><span class="nx">S</span><span class="o">|</span><span class="nx">E</span><span class="o">|</span><span class="nx">W</span><span class="o">|</span><span class="nx">NE</span><span class="o">|</span><span class="nx">NW</span><span class="o">|</span><span class="nx">SE</span><span class="o">|</span><span class="nx">SW</span><span class="p">))?)(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(</span><span class="nx">apt</span><span class="o">|</span><span class="nx">apartment</span><span class="o">|</span><span class="nx">unit</span><span class="o">|</span><span class="nx">suite</span><span class="o">|</span><span class="nx">ste</span><span class="o">|</span><span class="nx">fl</span><span class="o">|</span><span class="nx">floor</span><span class="o">|</span><span class="nx">rm</span><span class="o">|</span><span class="nx">room</span><span class="o">|</span><span class="nx">bldg</span><span class="o">|</span><span class="nx">building</span><span class="o">|</span><span class="nx">dept</span><span class="o">|</span><span class="nx">lot</span><span class="o">|</span><span class="nx">pier</span><span class="o">|</span><span class="nx">slip</span><span class="o">|</span><span class="nx">trlr</span><span class="o">|</span><span class="err">#</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z0</span><span class="o">-</span><span class="mi">9</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">)?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]{</span><span class="mi">2</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.)(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]{</span><span class="mi">2</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.)){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">}(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*|</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)(?:(?:</span><span class="nx">al</span><span class="o">|</span><span class="nx">ak</span><span class="o">|</span><span class="nx">az</span><span class="o">|</span><span class="nx">ar</span><span class="o">|</span><span class="nx">ca</span><span class="o">|</span><span class="nx">co</span><span class="o">|</span><span class="nx">ct</span><span class="o">|</span><span class="nx">de</span><span class="o">|</span><span class="nx">dc</span><span class="o">|</span><span class="nx">fl</span><span class="o">|</span><span class="nx">ga</span><span class="o">|</span><span class="nx">hi</span><span class="o">|</span><span class="nx">ia</span><span class="o">|</span><span class="nx">id</span><span class="o">|</span><span class="nx">il</span><span class="o">|</span><span class="k">in</span><span class="o">|</span><span class="nx">ks</span><span class="o">|</span><span class="nx">ky</span><span class="o">|</span><span class="nx">la</span><span class="o">|</span><span class="nx">ma</span><span class="o">|</span><span class="nx">md</span><span class="o">|</span><span class="nx">me</span><span class="o">|</span><span class="nx">mi</span><span class="o">|</span><span class="nx">mn</span><span class="o">|</span><span class="nx">mo</span><span class="o">|</span><span class="nx">ms</span><span class="o">|</span><span class="nx">mt</span><span class="o">|</span><span class="nx">nc</span><span class="o">|</span><span class="nx">nd</span><span class="o">|</span><span class="nx">ne</span><span class="o">|</span><span class="nx">nh</span><span class="o">|</span><span class="nx">nj</span><span class="o">|</span><span class="nx">nm</span><span class="o">|</span><span class="nx">nv</span><span class="o">|</span><span class="nx">ny</span><span class="o">|</span><span class="nx">oh</span><span class="o">|</span><span class="nx">ok</span><span class="o">|</span><span class="nx">or</span><span class="o">|</span><span class="nx">pa</span><span class="o">|</span><span class="nx">ri</span><span class="o">|</span><span class="nx">sc</span><span class="o">|</span><span class="nx">sd</span><span class="o">|</span><span class="nx">tn</span><span class="o">|</span><span class="nx">tx</span><span class="o">|</span><span class="nx">ut</span><span class="o">|</span><span class="nx">va</span><span class="o">|</span><span class="nx">vt</span><span class="o">|</span><span class="nx">wa</span><span class="o">|</span><span class="nx">wi</span><span class="o">|</span><span class="nx">wv</span><span class="o">|</span><span class="nx">wy</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="p">(?:</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="nx">l</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="nx">k</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="nx">z</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="nx">e</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">f</span><span class="err">\</span><span class="p">.?</span><span class="nx">l</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">g</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">h</span><span class="err">\</span><span class="p">.?</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="nx">l</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">k</span><span class="err">\</span><span class="p">.?</span><span class="nx">s</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">k</span><span class="err">\</span><span class="p">.?</span><span class="nx">y</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">l</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">e</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">s</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">e</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">h</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">j</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">v</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">y</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span><span class="nx">h</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span><span class="nx">k</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">p</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">s</span><span class="err">\</span><span class="p">.?</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">s</span><span class="err">\</span><span class="p">.?</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="nx">x</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">u</span><span class="err">\</span><span class="p">.?</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">v</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">v</span><span class="err">\</span><span class="p">.?</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">w</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">w</span><span class="err">\</span><span class="p">.?</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">w</span><span class="err">\</span><span class="p">.?</span><span class="nx">v</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">w</span><span class="err">\</span><span class="p">.?</span><span class="nx">y</span><span class="err">\</span><span class="p">.?))(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}(</span><span class="o">-</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">})?</span><span class="err">\</span><span class="nx">b</span><span class="p">)?</span><span class="o">|</span><span class="p">(?:</span><span class="nx">ak</span><span class="o">|</span><span class="nx">az</span><span class="o">|</span><span class="nx">ar</span><span class="o">|</span><span class="nx">ca</span><span class="o">|</span><span class="nx">co</span><span class="o">|</span><span class="nx">ct</span><span class="o">|</span><span class="nx">dc</span><span class="o">|</span><span class="nx">fl</span><span class="o">|</span><span class="nx">ga</span><span class="o">|</span><span class="nx">ia</span><span class="o">|</span><span class="nx">il</span><span class="o">|</span><span class="nx">ks</span><span class="o">|</span><span class="nx">ky</span><span class="o">|</span><span class="nx">md</span><span class="o">|</span><span class="nx">mn</span><span class="o">|</span><span class="nx">mo</span><span class="o">|</span><span class="nx">ms</span><span class="o">|</span><span class="nx">mt</span><span class="o">|</span><span class="nx">nc</span><span class="o">|</span><span class="nx">nd</span><span class="o">|</span><span class="nx">nh</span><span class="o">|</span><span class="nx">nj</span><span class="o">|</span><span class="nx">nm</span><span class="o">|</span><span class="nx">nv</span><span class="o">|</span><span class="nx">ny</span><span class="o">|</span><span class="nx">oh</span><span class="o">|</span><span class="nx">pa</span><span class="o">|</span><span class="nx">ri</span><span class="o">|</span><span class="nx">sc</span><span class="o">|</span><span class="nx">sd</span><span class="o">|</span><span class="nx">tn</span><span class="o">|</span><span class="nx">tx</span><span class="o">|</span><span class="nx">ut</span><span class="o">|</span><span class="nx">va</span><span class="o">|</span><span class="nx">vt</span><span class="o">|</span><span class="nx">wa</span><span class="o">|</span><span class="nx">wi</span><span class="o">|</span><span class="nx">wv</span><span class="o">|</span><span class="nx">wy</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}(</span><span class="o">-</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">})?</span><span class="err">\</span><span class="nx">b</span><span class="p">)?</span><span class="o">|</span><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]{</span><span class="mi">2</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.)</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]{</span><span class="mi">2</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.)(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]{</span><span class="mi">2</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.)){</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">})(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(</span><span class="nx">apt</span><span class="o">|</span><span class="nx">apartment</span><span class="o">|</span><span class="nx">unit</span><span class="o">|</span><span class="nx">suite</span><span class="o">|</span><span class="nx">ste</span><span class="o">|</span><span class="nx">fl</span><span class="o">|</span><span class="nx">floor</span><span class="o">|</span><span class="nx">rm</span><span class="o">|</span><span class="nx">room</span><span class="o">|</span><span class="nx">bldg</span><span class="o">|</span><span class="nx">building</span><span class="o">|</span><span class="nx">dept</span><span class="o">|</span><span class="nx">lot</span><span class="o">|</span><span class="nx">pier</span><span class="o">|</span><span class="nx">slip</span><span class="o">|</span><span class="nx">trlr</span><span class="o">|</span><span class="err">#</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z0</span><span class="o">-</span><span class="mi">9</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">)?</span><span class="o">|</span><span class="p">(</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">[</span><span class="nx">A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z</span><span class="p">]?(</span><span class="o">-</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">)?</span><span class="err">\</span><span class="nx">b</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">){</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">}(?:</span><span class="nx">st</span><span class="o">|</span><span class="nx">rd</span><span class="o">|</span><span class="nx">dr</span><span class="o">|</span><span class="nx">ln</span><span class="o">|</span><span class="nx">ct</span><span class="o">|</span><span class="nx">pl</span><span class="o">|</span><span class="nx">sq</span><span class="o">|</span><span class="nx">ave</span><span class="o">|</span><span class="nx">avenue</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">cir</span><span class="o">|</span><span class="nx">circle</span><span class="o">|</span><span class="nx">plz</span><span class="o">|</span><span class="nx">place</span><span class="o">|</span><span class="nx">plaza</span><span class="o">|</span><span class="nx">trl</span><span class="o">|</span><span class="nx">trail</span><span class="o">|</span><span class="nx">ter</span><span class="o">|</span><span class="nx">terrace</span><span class="o">|</span><span class="nx">center</span><span class="o">|</span><span class="nx">centre</span><span class="o">|</span><span class="nx">exp</span><span class="p">(?:</span><span class="nx">r</span><span class="o">|</span><span class="nx">w</span><span class="o">|</span><span class="nx">y</span><span class="o">|</span><span class="nx">wy</span><span class="o">|</span><span class="nx">ressway</span><span class="o">|</span><span class="p">)</span><span class="o">|</span><span class="nx">street</span><span class="o">|</span><span class="nx">road</span><span class="o">|</span><span class="nx">drive</span><span class="o">|</span><span class="nx">blvd</span><span class="o">|</span><span class="nx">boulevard</span><span class="o">|</span><span class="nx">lane</span><span class="o">|</span><span class="nx">court</span><span class="o">|</span><span class="nx">way</span><span class="o">|</span><span class="nx">pkwy</span><span class="o">|</span><span class="nx">parkway</span><span class="o">|</span><span class="nx">hwy</span><span class="o">|</span><span class="nx">highway</span><span class="o">|</span><span class="nx">square</span><span class="o">|</span><span class="nx">loop</span><span class="o">|</span><span class="nx">broadway</span><span class="o">|</span><span class="nx">ctr</span><span class="o">|</span><span class="nx">pike</span><span class="p">)</span><span class="err">\</span><span class="p">.?(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">(</span><span class="nx">N</span><span class="o">|</span><span class="nx">S</span><span class="o">|</span><span class="nx">E</span><span class="o">|</span><span class="nx">W</span><span class="o">|</span><span class="nx">NE</span><span class="o">|</span><span class="nx">NW</span><span class="o">|</span><span class="nx">SE</span><span class="o">|</span><span class="nx">SW</span><span class="p">))?(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">(</span><span class="nx">apt</span><span class="o">|</span><span class="nx">apartment</span><span class="o">|</span><span class="nx">unit</span><span class="o">|</span><span class="nx">suite</span><span class="o">|</span><span class="nx">ste</span><span class="o">|</span><span class="nx">fl</span><span class="o">|</span><span class="nx">floor</span><span class="o">|</span><span class="nx">rm</span><span class="o">|</span><span class="nx">room</span><span class="o">|</span><span class="nx">bldg</span><span class="o">|</span><span class="nx">building</span><span class="o">|</span><span class="nx">dept</span><span class="o">|</span><span class="nx">lot</span><span class="o">|</span><span class="nx">pier</span><span class="o">|</span><span class="nx">slip</span><span class="o">|</span><span class="nx">trlr</span><span class="o">|</span><span class="err">#</span><span class="p">)</span><span class="err">\</span><span class="p">.?</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z0</span><span class="o">-</span><span class="mi">9</span><span class="o">-</span><span class="p">]</span><span class="o">+</span><span class="p">)?)([</span><span class="o">^</span><span class="err">\</span><span class="nx">w</span><span class="p">]</span><span class="o">|</span><span class="nx">$</span><span class="p">)</span><span class="o">|</span><span class="err">\</span><span class="nx">bp</span><span class="err">\</span><span class="p">.?</span> <span class="p">?</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span> <span class="o">*</span><span class="nx">box</span> <span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]{</span><span class="mi">2</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.)(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">([</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">.</span><span class="o">-</span><span class="p">]{</span><span class="mi">2</span><span class="p">,}</span><span class="o">|</span><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.[</span><span class="nx">a</span><span class="o">-</span><span class="nx">z</span><span class="p">]</span><span class="err">\</span><span class="p">.)){</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">})?(</span><span class="err">\</span><span class="nx">s</span><span class="o">*</span><span class="p">,</span><span class="err">\</span><span class="nx">s</span><span class="o">*|</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="p">)(?:(?:</span><span class="nx">al</span><span class="o">|</span><span class="nx">ak</span><span class="o">|</span><span class="nx">az</span><span class="o">|</span><span class="nx">ar</span><span class="o">|</span><span class="nx">ca</span><span class="o">|</span><span class="nx">co</span><span class="o">|</span><span class="nx">ct</span><span class="o">|</span><span class="nx">de</span><span class="o">|</span><span class="nx">dc</span><span class="o">|</span><span class="nx">fl</span><span class="o">|</span><span class="nx">ga</span><span class="o">|</span><span class="nx">hi</span><span class="o">|</span><span class="nx">ia</span><span class="o">|</span><span class="nx">id</span><span class="o">|</span><span class="nx">il</span><span class="o">|</span><span class="k">in</span><span class="o">|</span><span class="nx">ks</span><span class="o">|</span><span class="nx">ky</span><span class="o">|</span><span class="nx">la</span><span class="o">|</span><span class="nx">ma</span><span class="o">|</span><span class="nx">md</span><span class="o">|</span><span class="nx">me</span><span class="o">|</span><span class="nx">mi</span><span class="o">|</span><span class="nx">mn</span><span class="o">|</span><span class="nx">mo</span><span class="o">|</span><span class="nx">ms</span><span class="o">|</span><span class="nx">mt</span><span class="o">|</span><span class="nx">nc</span><span class="o">|</span><span class="nx">nd</span><span class="o">|</span><span class="nx">ne</span><span class="o">|</span><span class="nx">nh</span><span class="o">|</span><span class="nx">nj</span><span class="o">|</span><span class="nx">nm</span><span class="o">|</span><span class="nx">nv</span><span class="o">|</span><span class="nx">ny</span><span class="o">|</span><span class="nx">oh</span><span class="o">|</span><span class="nx">ok</span><span class="o">|</span><span class="nx">or</span><span class="o">|</span><span class="nx">pa</span><span class="o">|</span><span class="nx">ri</span><span class="o">|</span><span class="nx">sc</span><span class="o">|</span><span class="nx">sd</span><span class="o">|</span><span class="nx">tn</span><span class="o">|</span><span class="nx">tx</span><span class="o">|</span><span class="nx">ut</span><span class="o">|</span><span class="nx">va</span><span class="o">|</span><span class="nx">vt</span><span class="o">|</span><span class="nx">wa</span><span class="o">|</span><span class="nx">wi</span><span class="o">|</span><span class="nx">wv</span><span class="o">|</span><span class="nx">wy</span><span class="p">)</span><span class="err">\</span><span class="nx">b</span><span class="o">|</span><span class="p">(?:</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="nx">l</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="nx">k</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="nx">z</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="nx">e</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">f</span><span class="err">\</span><span class="p">.?</span><span class="nx">l</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">g</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">h</span><span class="err">\</span><span class="p">.?</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="nx">l</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">k</span><span class="err">\</span><span class="p">.?</span><span class="nx">s</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">k</span><span class="err">\</span><span class="p">.?</span><span class="nx">y</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">l</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">e</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">s</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">e</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">h</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">j</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">m</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">v</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="nx">y</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span><span class="nx">h</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span><span class="nx">k</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">o</span><span class="err">\</span><span class="p">.?</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">p</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">r</span><span class="err">\</span><span class="p">.?</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">s</span><span class="err">\</span><span class="p">.?</span><span class="nx">c</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">s</span><span class="err">\</span><span class="p">.?</span><span class="nx">d</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="nx">n</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="nx">x</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">u</span><span class="err">\</span><span class="p">.?</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">v</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">v</span><span class="err">\</span><span class="p">.?</span><span class="nx">t</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">w</span><span class="err">\</span><span class="p">.?</span><span class="nx">a</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">w</span><span class="err">\</span><span class="p">.?</span><span class="nx">i</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">w</span><span class="err">\</span><span class="p">.?</span><span class="nx">v</span><span class="err">\</span><span class="p">.?</span><span class="o">|</span><span class="nx">w</span><span class="err">\</span><span class="p">.?</span><span class="nx">y</span><span class="err">\</span><span class="p">.?))(</span><span class="err">\</span><span class="nx">s</span><span class="o">+</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">5</span><span class="p">}(</span><span class="o">-</span><span class="err">\</span><span class="nx">d</span><span class="p">{</span><span class="mi">4</span><span class="p">})?</span><span class="err">\</span><span class="nx">b</span><span class="p">)?</span>
</code></pre></div></div>

<h4 id="url">URL</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">[</span><span class="nx">a</span><span class="o">-</span><span class="nx">zA</span><span class="o">-</span><span class="nx">Z</span><span class="p">][</span><span class="nx">a</span><span class="o">-</span><span class="nx">zA</span><span class="o">-</span><span class="nx">Z0</span><span class="o">-</span><span class="mi">9</span><span class="o">+</span><span class="err">\</span><span class="o">-</span><span class="p">.]</span><span class="o">*</span><span class="p">:</span><span class="err">\</span><span class="o">/</span><span class="err">\</span><span class="o">/</span><span class="p">(?:[</span><span class="o">^</span><span class="err">\</span><span class="nx">s</span><span class="o">/</span><span class="p">?</span><span class="err">#</span><span class="p">@]</span><span class="o">*</span><span class="p">@)?[</span><span class="o">^</span><span class="p">:</span><span class="sr">/</span><span class="se">?</span><span class="sr">#</span><span class="se">\s</span><span class="sr">&lt;&gt;</span><span class="se">\"</span><span class="sr">]+</span><span class="se">(?:\:\d</span><span class="sr">+</span><span class="se">)?(</span><span class="sr">/</span><span class="p">[</span><span class="o">^</span><span class="p">?</span><span class="err">#\</span><span class="nx">s</span><span class="o">&lt;&gt;</span><span class="err">\</span><span class="dl">"</span><span class="s2">]*)?(?:</span><span class="se">\</span><span class="s2">?[^#</span><span class="se">\</span><span class="s2">s&lt;&gt;</span><span class="se">\"</span><span class="s2">]*)?(?:</span><span class="se">\</span><span class="s2">#[^</span><span class="se">\</span><span class="s2">s&lt;&gt;</span><span class="se">\"</span><span class="s2">]*)?
</span></code></pre></div></div>

<h3 id="access-pii-masking-configuration">Access PII masking configuration</h3>

<ol>
  <li>In the navigation menu on the left side, click <strong>Manage &gt; Management Console</strong>.</li>
  <li>
    <p>Search for “Generative AI Management,” and select the page from the results.</p>

    <p><img style="width:800px" src="img/piimasking/access_config_1.png" alt="Searching for the page in the Management Console" /></p>
  </li>
  <li>
    <p>Under <strong>Configuration</strong>, scroll down to <strong>PII Masking</strong>, and expand the section.</p>

    <p><img style="width:800px" src="img/piimasking/access_config_2.png" alt="The PII Masking subsection header in the Configuration section of the page" /></p>
  </li>
  <li>
    <p><strong>(One time only)</strong> Review LivePerson’s terms of use, and click <strong>Agree</strong>.</p>

    <p><img style="width:800px" src="img/piimasking/access_config_3.png" alt="Acknowledging the PII Masking terms of use" /></p>
  </li>
  <li>Proceed with configuration.</li>
</ol>

<h3 id="specify-a-default-behavior-for-all-new-prompts">Specify a default behavior for all new prompts</h3>

<p>To help support privacy and security, you can configure the system so that all <strong>new</strong> prompts created by your prompt engineers have PII masking turned On (<strong>strongly recommended</strong> as a best practice). The prompt engineer is still able to change this on a per prompt basis.</p>

<p class="attn-note">If you’re working on a solution within aiStudio (LivePerson’s authoring environment for building, testing, and tuning advanced AI agents), you must manually turn on PII Masking in each prompt.</p>

<h4 id="to-specify-a-default-behavior-for-all-new-prompts">To specify a default behavior for all new prompts</h4>

<ol>
  <li>Access PII masking configuration as described earlier in this article.</li>
  <li>
    <p>For <strong>Mask PII in new prompts</strong>, turn the toggle on or off:</p>

    <ul>
      <li><strong>On</strong>: PII masking is turned on by default in all new prompts.</li>
      <li><strong>Off</strong>: PII masking is turned off by default in all new prompts.</li>
    </ul>

    <p><img style="width:800px" src="img/piimasking/specify_default_behavior.png" alt="Choosing a default behavior for new prompts by enabling or disabling the toggle" /></p>

    <p class="attn-alert">Changes to this setting have no impact on existing prompts. You must turn on PII masking within an existing prompt in the Prompt Library.</p>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="specify-the-types-of-data-to-mask">Specify the types of data to mask</h3>

<p>You can specify the data types that you want the system to attempt to mask. As we state in the UI, masking certain data types may affect prompt behavior or output.</p>

<p>Electing not to mask a specific type of data is a decision that should be made with consideration of your company’s privacy and compliance requirements. Test thoroughly using the debugging info that’s made available; see the section on testing and debugging in this article.</p>

<p class="attn-note">While these settings are designed to detect and mask common types of PII, they are not foolproof. Certain data types (e.g., names, passwords) may be more difficult to reliably detect and may not always be masked. Please review your prompts carefully and apply additional safeguards where needed.</p>

<h4 id="to-specify-the-data-types-to-mask">To specify the data types to mask</h4>

<ol>
  <li>Access PII masking configuration as described earlier in this article.</li>
  <li>
    <p>Under <strong>Types of data to mask</strong>, select the types of data that you want to be masked.</p>

    <p><img style="width:800px" src="img/piimasking/specify_types_of_data.png" alt="Choosing the types of PII data to mask" /></p>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="specify-words-and-phrases-to-exclude">Specify words and phrases to exclude</h3>

<p>You might want to exclude certain words or numbers from PII masking before sending info to an LLM if those words or numbers are crucial for the LLM to understand the context or intent of the text. For example, your brand name might include a common name for a person, such as Sarah’s Coffee. So, you might want to exclude “Sarah.”</p>

<p>Similarly, domain-specific terms that aren't PII but could be mistakenly masked might be important for the LLM to process information accurately within that domain. Domain-specific terms are specialized vocabulary used within a particular field, profession, or subject area. If a domain-specific term happens to resemble one of these patterns (e.g., a product code that looks like a phone number, or a medical code that contains numbers and hyphens similar to an SSN), it could be flagged incorrectly.</p>

<h4 id="to-specify-words-or-phrases-to-exclude">To specify words or phrases to exclude</h4>

<ol>
  <li>Access PII masking configuration as described earlier in this article.</li>
  <li>
    <p>Under <strong>Exclude from masking</strong>, enter the comma-separated list of words and phrases that you want to always exclude from masking.</p>

    <p><img style="width:800px" src="img/piimasking/specify_exclusion_words.png" alt="Specifying words or phrases to exclude from PII masking" /></p>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h4 id="turn-on-pii-masking-in-an-existing-prompt">Turn on PII masking in an existing prompt</h4>

<p>There’s no “global switch” to turn on PII masking. To support a flexible configuration, enablement is on a prompt by prompt basis.</p>

<ol>
  <li>Open the prompt in the Prompt Library for editing.</li>
  <li>
    <p>On the <strong>Advanced</strong> tab, select <strong>Mask PII</strong>, and save the change.</p>

    <p><img style="width:800px" src="img/piimasking/turn_on_masking_in_prompt.png" alt="Enabling PII Masking within a prompt in Prompt Library" /></p>
  </li>
  <li>Test thoroughly.</li>
</ol>

<h3 id="testing-and-debugging">Testing and debugging</h3>

<p>In our testing and debugging tools within Conversational Cloud (KnowledgeAI’s Answer Tester, Conversation Builder’s Debug Logs, etc.) the prompt with <strong>masked PII</strong> (which is sent to the LLM) is always shown. As you debug issues, this makes it possible for you to determine if PII is being masked correctly.</p>

<p>Additionally, in KnowledgeAI’s testing and debugging tools, there’s an <strong>Unmask</strong> button (shown below) to show the unmasked PII.</p>

<p><img style="width:500px" src="img/piimasking/debugging_tool.gif" alt="Masked PII in a debugging tool" /></p>

<h3 id="error-handling">Error handling</h3>

<p>If an error occurs during masking or unmasking of PII, LivePerson’s LLM Gateway returns an error to the client application that made the request. LivePerson’s various applications handle such errors differently.</p>

<p>For example, if the request is for an <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">answer from a knowledge base in KnowledgeAI to be enriched by the LLM</a>—but a PII masking or unmasking error occurs—then KnowledgeAI returns the <strong>unenriched</strong> answer to the calling application. Other client applications simply return an error during the operation in question.
Such errors should be rare, will be detected immediately via LivePerson’s monitoring, and will be resolved by LivePerson expeditously.</p>
]]></description>
      <!-- <pubDate>Thu, 04 Dec 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Account Details</title>
      <link>https://developers.liveperson.com/conversation-builder-bot-accounts-account-details.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-bot-accounts-account-details.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>In the Bot Accounts sub-application within Conversation Builder, use the <strong>Account Details</strong> page to configure account-level settings:</p>

<ul>
  <li><strong>Brand name</strong> and <strong>Industry</strong>: Using our Generative AI features? Enter or change your brand name and industry in the Management Console in <strong>Generative AI Management &gt; Account details</strong>. During queries to the Large Language Model (LLM) service, this info is included in the prompt that gets sent to the service. It helps the responses to stay in bounds, i.e., specific to your brand, with fewer hallucinations.</li>
  <li><strong>Watson Assistant</strong>: Enable or disable the IBM Watson NLU provider. When this is enabled, you can specify Watson Assistant as the NLU provider for a domain that you create.</li>
  <li><strong>Google DialogFlow</strong>: Enable or disable the Google DialogFlow NLU provider. When this is enabled, you can specify Google DialogFlow as the NLU provider for a domain that you create.</li>
  <li><strong>Conversation Context Service</strong>: Enable or disable the Conversation Context Service for <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html">custom data sharing across bots</a>.</li>
  <li><strong>Small Talk</strong>: Enable or disable <a href="conversation-builder-best-practices-support-small-talk.html">support for small talk</a> (chitchat) in your Conversation Builder bots. When you support small talk, you offer your consumers a more human-like experience.</li>
  <li><strong>Post-conversation surveys</strong>: There are several <a href="conversation-builder-bots-post-conversation-survey-bots.html#configure-account-level-settings">account-level settings</a>.</li>
</ul>
]]></description>
      <!-- <pubDate>Thu, 04 Dec 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Route Conversations by Intents</title>
      <link>https://developers.liveperson.com/conversation-orchestrator-dynamic-routing-route-conversations-by-intents.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-orchestrator-dynamic-routing-route-conversations-by-intents.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note">This topic assumes that you are familiar with <a href="intent-manager-overview.html">Intent Manager</a>.</p>

<p>You can create policies to recognize a consumer's intent from their utterance and transfer to the appropriate agent or skill. Routing by intent is very useful when agents or bots are organized by functional departments.</p>

<p><strong>Examples</strong></p>

<ul>
  <li>When a VIP consumer says, “I want to upgrade my service,” they should be transferred to the Upgrade Service skill that includes all upgrade specialists or bots.</li>
  <li>When a member says, “I have an outage,” they should be escalated to an Outage specialist.</li>
</ul>

<p><strong>Please Note:</strong>
The technique is very useful for advanced routing use cases, such as scenarios that involve a combination of intent recognition, contextual information and/or transferring to both humans and bots.</p>

<p>If all your operations are contained within LivePerson Conversation Builder bots, and you already have different bots for specific intents, please use the direct approach of <a href="conversation-builder-bots-bot-to-bot-transfers.html#automatic-transfers-via-bot-group">bot collaboration</a>.</p>

<h3 id="prerequisite-steps">Prerequisite steps</h3>

<ul>
  <li>Configure the intents using <a href="intent-manager-overview.html">Intent Manager</a>.</li>
  <li>Configure your <a href="conversation-orchestrator-dynamic-routing-get-started.html">routing bot</a>.</li>
</ul>

<h3 id="process">Process</h3>

<p>There are two ways to accomplish intent-based routing:</p>

<ul>
  <li>If you have a limited number of intents, use the dialog starter approach.</li>
  <li>If you have many intents and corresponding skills, enable intent routing in the Conversation Orchestrator bot.</li>
</ul>

<p class="attn-note">Some users might be using older approaches to routing by intents. Typically, this involves writing custom JavaScript to store context variables and call the Next Actions API. However, LivePerson recommends that you use the approaches discussed in this topic; they leverage Conversation Builder's Dynamic Routing interaction, which reduces the need to write custom code. Still, for information to aid in troubleshooting older approaches, you can access <a href="conversation-orchestrator-dynamic-routing-route-conversations-by-intents-legacy.html">an older version of this topic</a>.</p>

<h4 id="routing-by-intent-using-the-dialog-starter-approach">Routing by intent using the dialog starter approach</h4>

<p>When an intent triggers a dialog starter, the intent name is automatically saved to the default “orchestrator” namespace in the Context Service in a variable named “intent”. This approach is useful when using a small number of intents (5-10).</p>

<ol>
  <li>
    <p>Create a new dialog in your Conversation Builder bot.</p>
  </li>
  <li>
    <p>In the newly created dialog starter, select the <strong>+ Intent</strong> option to add a domain and intent to trigger this dialog.</p>
  </li>
  <li>
    <p>Set the <strong>Next Action</strong> to the Dynamic Routing interaction.</p>

    <p><img class="fancyimage" width="800" src="img/convorchestrator/co_dr_next_action.png" alt="The dialog starter that's mapped to an intent named ‘book flight’" /></p>
  </li>
  <li>
    <p>Create intent-based routing policies. For more on this, see the section at the end of this topic.</p>
  </li>
</ol>

<h4 id="enabling-intent-routing-in-the-dynamic-routing-bot">Enabling intent routing in the Dynamic Routing bot</h4>

<p>When working with larger domains, assigning individual dialogs to each intent can be difficult to scale. By using the Conversation Orchestrator bot template, bot developers can manually call the analyze intent API and save the intent name to the default namespace, enabling routing to any intent-based skill in the account.</p>

<p class="attn-note">This approach is powered by an API provided by the <a href="conversation-builder-bot-templates-conversation-orchestrator.html">Dynamic Routing Bot template</a>. This API is not suitable for use with legacy versions of LivePerson’s NLU engine. Please upgrade to the current NLU domain offering if using this approach.</p>

<ol>
  <li>
    <p>Create the Dynamic Routing bot, and open <strong>Global Functions</strong>.</p>

    <p>Create a new bot using the <strong>Dynamic Routing Bot</strong> by following the steps in the <a href="conversation-orchestrator-dynamic-routing-get-started.html">Getting Started topic</a>. Then open <strong>Global Functions</strong>, and change two configurations (botAppKey and domainId) as highlighted in the next, few steps.</p>
  </li>
  <li>
    <p>Retrieve the botAppKey.</p>

    <p>Retrieve the botAppKey value from a bot user agent. This can be found in the <strong>User Management</strong> section of the Conversational Cloud. Copy this value.</p>

    <p><img class="fancyimage" width="800" src="img/convorchestrator/co_dr_route1.png" alt="The App key field in the User Management section of Conversational Cloud" /></p>
  </li>
  <li>
    <p>Retrieve the intent domain ID.</p>

    <p>Retrieve the Domain ID for your intent domain. You can find this in the <strong>Domain Settings</strong> for your domain in Intent Manager. Copy this value.</p>

    <p><img class="fancyimage" width="800" src="img/convorchestrator/co_dr_route2.png" alt="The Domain Settings option for a given domain that's listed on the dashboard in Intent Manager" /></p>

    <p><img class="fancyimage" width="800" src="img/convorchestrator/co_dr_route3.png" alt="The Domain ID field in the settings for a given domain" /></p>
  </li>
  <li>
    <p>Update configurations in the <strong>Global Functions</strong>.</p>

    <p>Enter the botAppKey and domainId values into their associated variables within the <strong>Global Functions</strong> editor of your bot.</p>

    <p><img class="fancyimage" width="800" src="img/convorchestrator/co_dr_route4.png" alt="The lines of code in the bot's global functions where you need to enter the botAppKey and domainID values" /></p>
  </li>
  <li>
    <p>Enable the intent dialogs in the bot.</p>

    <p>Delete the COLLECT_PHONE_NUMBER interaction. Enable both the ASK_INTENT and getIntent_API interactions using the interaction settings for each. Make sure the Dynamic Routing interaction is directly below the getIntent_API as shown below.</p>

    <p><em>Enabling ASK_INTENT and getIntent_API interactions:</em></p>

    <p><img class="fancyimage" width="800" src="img/convorchestrator/co_dr_route5.png" alt="The dialog flow, illustrating how the Dynamic Routing interaction is below the getIntent_API interaction" /></p>

    <p><em>To enable interactions, go to the <strong>Interaction Settings</strong>, and enable the toggle</em>:</p>

    <p><img class="fancyimage" width="800" src="img/convorchestrator/co_dr_route6.png" alt="The Interaction Enabled setting in the Basic settings of a given interaction" /></p>
  </li>
  <li>
    <p>Create intent-based routing policies. For help with this, see the next section.</p>
  </li>
</ol>

<h3 id="create-intent-based-routing-policies">Create intent-based routing policies</h3>

<p>The policy creation flow is identical for both approaches:</p>

<ul>
  <li>Dialog starter</li>
  <li>Enabling intent routing</li>
</ul>

<ol>
  <li>
    <p>Navigate to <strong>Manage Policies</strong>.</p>

    <p>Use the <strong>Manage routing policies</strong> link in the Dynamic Routing interaction to navigate to Conversation Orchestrator.</p>

    <p><img class="fancyimage" width="800" src="img/convorchestrator/co_dr_ibpolicies1.png" alt="The Manage routing policies link that's directly on the face of the Dynamic Routing interaction" /></p>
  </li>
  <li>
    <p>Create your policy.</p>

    <p>Create a new policy by selecting <strong>Add Policy</strong>. Give the new policy a name. In the conditions editor, select “orchestrator.intent” from the dropdown, and set it equal to the relevant intent name.</p>
  </li>
  <li>
    <p>Configure your policy.</p>

    <p>In the actions editor, select "Transfer to skill" from the left-hand dropdown and the relevant skill from the right-hand dropdown. Ensure that agents are assigned to the book_flight skill.</p>

    <p><img class="fancyimage" width="800" src="img/convorchestrator/co_dr_ibpolicies2.png" alt="The configured Book flight policy" /></p>
  </li>
  <li>
    <p>Enable your policy.</p>

    <p>Once saved, toggle the switch for the policy in the policy list to enable the policy.</p>

    <p><img class="fancyimage" width="800" src="img/convorchestrator/co_dr_ibpolicies3.png" alt="The enabled Book flight policy" /></p>
  </li>
  <li>
    <p>Test your policy.</p>

    <p>You can <a href="conversation-orchestrator-dynamic-routing-test-with-the-web-emulator.html">test your setup on the web client emulator</a>.</p>

    <p>Alternatively, to test, you can <a href="conversation-orchestrator-dynamic-routing-get-started.html">deploy the bot and connect it to a campaign that’s linked to the production/staging channel of your choice</a>.</p>

    <p>Follow these steps once you have configured your testing setup:</p>

    <p><img class="fancyimage" width="250" src="img/convorchestrator/co_dr_ibpolicies4.png" alt="The conversation flow to follow" /></p>

    <p>The message routing flow is identical for both approaches (Dialog Starter and Enabling Intent Routing) because we have used the same intent and the same policy in our demonstration.</p>

    <p>Start by saying “Hi.”</p>

    <p>When prompted by the routing bot, provide the phone number 1111. This is when the Dynamic Routing interaction evaluates all your policies to make the routing decision.</p>

    <p>The conversation will be routed to the skill SeattleEmployeeSkill. A specific agent within the skill will be picked.</p>

    <p>For this example, it will be routed to Agent Bob if you have configured Agent Bob to be the only user who maps to SeattleEmployeeSkill.</p>
  </li>
</ol>
]]></description>
      <!-- <pubDate>Mon, 17 Nov 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Basic Concepts</title>
      <link>https://developers.liveperson.com/knowledgeai-key-terms-concepts-basic-concepts.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-key-terms-concepts-basic-concepts.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="knowledgeai-versus-generative-ai">KnowledgeAI versus Generative AI</h3>

<p>KnowledgeAI's architecture is built upon robust algorithms and data-driven methodologies that ensure relevant answers to consumer queries. Generative AI <strong>isn't used</strong> when retrieving answers from your knowledge bases.</p>

<p>That said—if you choose—you can use the power of Generative AI to <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">enrich the retrieved answers using the conversation's context</a>. The resulting responses are grounded in knowledge base content, contextually aware, and natural sounding. Answer enrichment is optional.</p>

<h3 id="knowledge-bases">Knowledge bases</h3>

<p>A knowledge base exposes a repository of articles that support a particular classification in your business. As an example, the following is an illustration of an <a href="knowledgeai-internal-knowledge-bases-introduction.html">internal knowledge base</a>, which contains telco FAQs.</p>

<p><img class="fancyimage" style="width:800px" alt="Example articles in an example internal knowledge base" src="img/ConvoBuilder/kb_overview.png" /></p>

<p>When used in a bot, a knowledge base is a great tool to answer questions about a variety of topics specific to the bot's area of expertise. Typically, in LivePerson Conversation Builder, you might add a knowledge base integration in a <a href="conversation-builder-dialogs-fallback-dialogs.html">Fallback dialog</a> to provide simple answers to topics not covered elsewhere in the bot. Alternatively, you might have an FAQ bot that is driven by a knowledge base full of articles. Powering bots with intelligent answers can <strong>increase containment</strong>: It helps to ensure that the conversation stays between the bot and the consumer and that the consumer's need is resolved by the bot.</p>

<p>In the KnowledgeAI application, you add and manage knowledge bases. The knowledge bases either contain articles, or they integrate with an external content source that contains them.</p>

<p class="attn-note"><a href="knowledgeai-best-practices.html">Learn about knowledge base best practices.</a></p>

<h3 id="articles">Articles</h3>

<p>An article is a focused piece of content (a message) on a single topic that you want to serve to consumers.</p>

<p><img class="fancyimage" style="width:800px" alt="Example articles in an example internal knowledge base" src="img/ConvoBuilder/kb_overview.png" /></p>

<p class="attn-note"><a href="knowledgeai-best-practices.html">Learn about article best practices.</a></p>

<h3 id="content-sources">Content sources</h3>

<p>You can create knowledge bases using a variety of content sources:</p>

<ul>
  <li>Knowledge management system (KMS) or content management system (CMS)</li>
  <li>CSV file</li>
  <li>Google sheet</li>
</ul>

<p>You can also start <strong>from scratch</strong> and author articles directly in a knowledge base.</p>

<h4 id="kms-or-cms">KMS or CMS</h4>

<p class="attn-note">LivePerson recommends this approach because it's not just flexible and powerful, but also <strong>automatic</strong>. The other approaches to content management are manual.</p>

<p>If you have a knowledge management system (KMS) or content management system (CMS) with well-curated content that you want to leverage in bot conversations, you can <a href="knowledgeai-internal-knowledge-bases-integrate-a-kms-or-cms.html">integrate it with KnowledgeAI</a>. Integrating with your KMS/CMS lets your content creators use familiar tools and workflows to author and manage the content.</p>

<p>You can integrate with any KMS/CMS that has a public API for retrieving knowledge articles. Notable examples include Salesforce and Zendesk.</p>

<p>When you create an internal knowledge base of this type, you use LivePerson's Integration Hub (iHub) to integrate the KMS/CMS. iHub embeds Workato and uses Workato to set up the integration.</p>

<h4 id="csv-files">CSV files</h4>

<p>If your tool of choice is a simple CSV sheet, you can <a href="knowledgeai-internal-knowledge-bases-knowledge-bases.html">add an internal knowledge base</a> and import the contents of the CSV file when you do.</p>

<h4 id="google-sheets">Google sheets</h4>

<p>If your tool of choice is a simple Google sheet, you can <a href="knowledgeai-internal-knowledge-bases-knowledge-bases.html">add an internal knowledge base</a> and link the sheet to it.</p>

<h4 id="starting-from-scratch">Starting from scratch</h4>

<p>If you’re starting a knowledge base from scratch, and you prefer to work directly in the KnowledgeAI application, you can also do this.</p>

<h3 id="content-management">Content management</h3>

<p>As mentioned above, in KnowledgeAI, you can populate a knowledge base in several ways. Here's an at-a-glance view of how that works:</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Are articles enabled by default?</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a href="knowledgeai-internal-knowledge-bases-integrate-a-kms-or-cms.html">Integrate with KMS/CMS</a></td>
      <td>Yes</td>
    </tr>
    <tr>
      <td><a href="knowledgeai-internal-knowledge-bases-import-content.html#import-content-from-a-csv-file">Import CSV</a></td>
      <td>Yes</td>
    </tr>
    <tr>
      <td><a href="knowledgeai-internal-knowledge-bases-import-content.html#import-content-from-a-google-sheet">Import Google sheet</a></td>
      <td>Yes</td>
    </tr>
    <tr>
      <td><a href="knowledgeai-internal-knowledge-bases-articles.html#add-an-article">Manual creation within KnowledgeAI</a></td>
      <td>No</td>
    </tr>
  </tbody>
</table>

<p>What you can’t do is mix content types within a knowledge base. For example, if you add a knowledge base and import 2 PDFs into it, you’ll see a <strong>Sources</strong> page which you can use for adding more PDFs…and only PDFs.</p>

<h3 id="user-query-contextualization">User query contextualization</h3>

<p>Before performing a knowledge base search for answers, you can pass the user’s query—along with some conversation context—to a LivePerson small language model so that the model can enhance (rephrase) the query. This can significantly improve the relevancy and accuracy of the retrieved answers. Query contextualization is optional.</p>

<p><a href="knowledgeai-key-terms-concepts-user-queries-contextualize.html">Learn more about query contextualization.</a></p>

<p><a href="knowledgeai-key-terms-concepts-search-methods.html#search-flow">See where query contextualization fits into the overall search flow.</a></p>

<h3 id="answer-retrieval">Answer retrieval</h3>

<p>There are two different techniques that you can use to retrieve answers from your knowledge bases:</p>

<ul>
  <li><strong>AI Search</strong>: This is KnowledgeAI's powerful, one-size-fits-all search method based on the latest research in deep learning. It gets to the intent, is context-aware and phrasing-agnostic, and requires <strong>no setup</strong>.</li>
  <li><strong>Intent-based search</strong>: This search method makes use of Natural Language Understanding or NLU to find relevant answers. This method does require an investment in setup.</li>
</ul>

<p class="attn-note">As stated earlier in this article, Generative AI <strong>isn't</strong> used during answer retrieval.</p>

<p>You can use either, or both, of the methods above.</p>

<p><a href="knowledgeai-key-terms-concepts-search-methods.html">Learn more about these search methods</a>, including the <a href="knowledgeai-key-terms-concepts-search-methods.html#search-flow">overall search flow</a>.</p>

<h3 id="answer-enrichment">Answer enrichment</h3>

<p>You can use the power of Generative AI to enrich retrieved answers using the conversation's context. The resulting responses are grounded in knowledge base content, contextually aware, and natural sounding. Answer enrichment is optional.</p>

<p><a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Learn more about answer enrichment.</a></p>

<p><a href="knowledgeai-key-terms-concepts-search-methods.html#search-flow">See where answer enrichment fits into the overall search flow.</a></p>

<h3 id="summary-versus-detail">Summary versus Detail</h3>

<p>Every article has a <strong>Summary</strong> field and a <strong>Detail</strong> field.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/kai_summary_detail.png" alt="An example article with a callout to the distinct Summary and Detail fields" /></p>

<p><strong>Summary</strong> stores a brief response to send to the consumer. <strong>Detail</strong> stores a longer, more detailed response to send to the consumer. (<a href="knowledgeai-limits.html">Learn about their character limits.</a>)</p>

<p>There are a few important concepts to understand about Summary and Detail:</p>

<ul>
  <li><strong>Summary</strong> is a required field, but <strong>Detail</strong> is optional.</li>
  <li><a href="knowledgeai-best-practices.html#summary-and-detail">Follow our best practices</a> when entering content into these fields.</li>
  <li>Both fields (among others) are used when searching the knowledge base to retrieve matched articles. (<a href="knowledgeai-key-terms-concepts-search-methods.html">Learn about search methods.</a>)</li>
  <li>If you’re <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">using Generative AI to enrich answers</a>, the system sends the content in <strong>Detail</strong> to the LLM for enrichment. This is intentional. It ensures that as much info as possible is available to the LLM so that it can generate an enriched answer of good quality. The LLM excels at taking a large amount of info and using it to generate a concise response. So, while <strong>Detail</strong> is optional, it can play an important role. Importantly, if there’s no <strong>Detail</strong> in the article, then the content in <strong>Summary</strong> is sent to the LLM for enrichment instead. (<a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#answer-enrichment-flow">Learn about the answer enrichment flow.</a>) Regardless of which content is sent to the LLM for enrichment, the enriched response is <em>returned</em> to the calling application in the <strong>Summary</strong> field of the top matched article.</li>
  <li>The content (<strong>Summary</strong>, <strong>Detail</strong>, or enriched response) that's sent to the consumer or agent varies based on the use case:</li>
</ul>

<table>
  <thead>
    <tr>
      <th>Application</th>
      <th><a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Using Generative AI?</a></th>
      <th>What's sent to the consumer?</th>
      <th>Notes</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Conversation Builder bot with a KnowledgeAI interaction</td>
      <td>No</td>
      <td>Summary</td>
      <td>This is true for both the <a href="conversation-builder-interactions-integrations.html#the-auto-render-rich-answer-layout">rich and plain “auto render” answer layouts</a>.<br /><br />If you want to send <strong>Detail</strong> to the consumer, don’t use auto rendering; <a href="conversation-builder-interactions-integrations.html#no-auto-rendering-using-a-custom-answer-layout">use a custom layout</a> instead.</td>
    </tr>
    <tr>
      <td>Conversation Builder bot with a KnowledgeAI interaction</td>
      <td>Yes</td>
      <td>Enriched answer generated by LLM</td>
      <td> </td>
    </tr>
    <tr>
      <td>Conversation Assist</td>
      <td>No</td>
      <td>Detail</td>
      <td>If <strong>Detail</strong> is empty, <strong>Summary</strong> is used instead in the answer recommendation (for the agent to send to the consumer).</td>
    </tr>
    <tr>
      <td>Conversation Assist</td>
      <td>Yes</td>
      <td>Enriched answer generated by LLM</td>
      <td>Conversation Assist uses this in the answer recommendation (for the agent to send to the consumer).</td>
    </tr>
  </tbody>
</table>

<h4 id="more-about-detail">More about Detail</h4>

<p>When using the <strong>Detail</strong> field in a <a href="conversation-builder-interactions-statements.html#text">Text interaction</a> in a Conversation Builder bot, very long pieces of text are split into multiple messages (after 1,000 characters) when sent to the consumer, and in rare cases the messages can be sent in the wrong order.</p>

<p>If you need to use a long piece of text, you can use the <a href="conversation-builder-interactions-interaction-basics.html#break-point-within-a-large-block-of-text">breakWithDelay tag</a> to force the break at a specific point. Alternatively, you can override the behavior to break the text using the <a href="conversation-builder-scripting-functions-manage-conversation-flow.html#set-allow-max-text-response">setAllowMaxTextResponse scripting function</a>.</p>
]]></description>
      <!-- <pubDate>Wed, 22 Oct 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Best Practices</title>
      <link>https://developers.liveperson.com/knowledgeai-best-practices.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-best-practices.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>For a flexible architecture and an optimal consumer experience, follow these best practices.</p>

<h3 id="language-of-content">Language of content</h3>

<p>For optimal performance, add content in only <strong>one</strong> language to a knowledge base. Don’t create a <a href="knowledgeai-key-terms-concepts-language-support.html#mixed-language-knowledge-bases">mixed-language knowledge base</a>.</p>

<p>This is especially true in the case of English content, so you can use the underlying English-language embedding model. The multi-lingual embedding model performs very well, but the English-language embedding model performs even better.</p>

<h3 id="structuring-and-organizing-content">Structuring and organizing content</h3>

<ul>
  <li>Design a modular approach, where each knowledge base supports a particular classification in your business: Create knowledge bases per category, likewise split the intents into domains based on category, and add multiple knowledge base integrations for use in bots. A modular approach like this makes it easier to use a knowledge base for a specific purpose in a bot. Moreover, it yields a faster response during the conversation.</li>
  <li>Provide broad coverage within the knowledge base. The more diverse the content is, the more likely it is that the consumer’s query will be matched to an article.</li>
</ul>

<h3 id="adding-articles">Adding articles</h3>

<p class="attn-note">For functional details, see the discussion on <a href="knowledgeai-internal-knowledge-bases-articles.html#add-an-article">how to add an article</a>. Also, learn about <a href="knowledgeai-limits.html#article-level-limits-for-internal-knowledge-bases">article-level limits</a>.</p>

<h4 id="article-coverage">Article coverage</h4>

<p>Strive for one topic per article. Split long articles that cover multiple topics into separate articles that each cover a single topic.</p>

<h4 id="title">Title</h4>

<p>At a minimum, enter a complete sentence or question, for example:</p>

<ul>
  <li><code class="language-html highlighter-rouge">I can't remember my password.</code></li>
  <li><code class="language-html highlighter-rouge">Do we have a company org chart?</code></li>
  <li><code class="language-html highlighter-rouge">How do I renew my car registration?</code></li>
</ul>

<p>Since the title is used in an AI Search (which is a semantic vector search), we recommend that you expand the title to include different ways of expressing the same query, using different synonyms. For example: <code class="language-html highlighter-rouge">How do I renew my car registration? / How can I update the registration for my motor vehicle? / What's the way to re-register my car? / I need help with my car tag renewal</code></p>

<p>The closer the title is to the consumer's potential question, the better that the search works.</p>

<h4 id="summary-and-detail">Summary and Detail</h4>

<ul>
  <li><strong>Summary</strong>: Keep this as brief as possible. We recommend that it's no longer than 120 words. (<a href="knowledgeai-limits.html">Learn about limits.</a>)</li>
  <li><strong>Detail</strong>: If all of the necessary info on the topic fits into the <strong>Summary</strong>, use that instead, and keep this section empty. If you use this section, keep the content as brief as possible while also ensuring it contains exhaustive info on the topic. It's advisable to format the content in a structured and easy-to-read format. Avoid using questions in this section, especially questions that duplicate the title.</li>
</ul>

<p><a href="knowledgeai-key-terms-concepts-basic-concepts.html#summary-versus-detail">Learn the basic concepts about Summary and Detail.</a></p>

<h4 id="tags">Tags</h4>

<p><a href="knowledgeai-key-terms-concepts-search-methods.html#how-does-ai-search-work">Tags are used by AI Search.</a> To increase the accuracy of knowledge base search results, add <a href="knowledgeai-internal-knowledge-bases-articles.html#add-an-article">tags</a>.</p>

<h4 id="categories">Categories</h4>

<p><a href="knowledgeai-key-terms-concepts-search-methods.html#how-does-ai-search-work">Categories are used by AI Search.</a> Take advantage of <a href="knowledgeai-internal-knowledge-bases-articles.html#add-an-article">categories</a>.</p>

<p>Categories also make it easier to find articles within the knowledge base when you're in KnowledgeAI™.</p>

<p>Use only alphanumeric and underscore characters in the category name; only these are permitted.</p>

<h3 id="considering-the-number-of-articles">Considering the number of articles</h3>

<p>When using <a href="knowledgeai-key-terms-concepts-search-methods.html">AI Search</a> to find and serve answers, the more articles that exist in one knowledge base, the better that the search performs. That said, keep in mind the <a href="knowledgeai-limits.html">article limit</a>, and take care to avoid redundant articles.</p>

<p>When using <strong>only</strong> <a href="knowledgeai-key-terms-concepts-search-methods.html">intent matching (NLU)</a> to find and serve answers, follow these guidelines:</p>

<ul>
  <li>A good guideline is 75-100 articles in a knowledge base. Keep in mind that every article requires some level of training if you’re going to use NLU.</li>
  <li>If you have a knowledge base that exceeds 75-100 articles, consider splitting the knowledge base into smaller ones based on category, likewise splitting the intents into domains based on category, and adding multiple knowledge base integrations. Then have the NLU match the consumer’s question to the category-based intent and search the applicable knowledge base. This yields a faster response during the conversation.</li>
</ul>

<h3 id="raising-the-quality-of-answers">Raising the quality of answers</h3>

<p>There are several best practices you can follow to raise the quality of answers:</p>

<h4 id="article-creation">Article creation</h4>

<p>If you created the articles by <a href="knowledgeai-internal-knowledge-bases-import-content.html">importing content</a>, always check for import errors and substantively review the articles that were created.</p>

<h4 id="article-length">Article length</h4>

<p>Evaluate whether long articles can be broken into smaller ones.</p>

<h4 id="confidence-thresholds">Confidence thresholds</h4>

<p>KnowledgeAI™ integrations within LivePerson Conversation Builder bots (<a href="conversation-builder-interactions-integrations.html#knowledge-ai">Knowledge AI interaction</a>, <a href="conversation-builder-integrations-knowledgeai-integrations.html">KnowledgeAI integration</a>) and the <a href="conversation-assist-setup-configure-settings.html#answer-confidence">settings</a> within Conversation Assist both allow you to specify a “threshold” that matched articles must meet to be returned as results. We recommend a threshold of “GOOD” or better for best performance.</p>

<h4 id="article-matching">Article matching</h4>

<p>The actual <a href="knowledgeai-key-terms-concepts-search-methods.html">KnowledgeAI search</a> for relevant answers (matched articles) in your knowledge base is an important part of any KnowledgeAI integration.</p>

<p>Before you get too far with your use case (Conversation Assist, Conversation Builder bot, etc.), use the <a href="knowledgeai-optimizing-your-content-tune-a-knowledge-base.html">Answer Tester tool</a> to test the article matching. This can help to ensure you get the performance you expect.</p>

<p>Here below, we're testing the article matching when using <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">enriched answers</a>.</p>

<p><img style="width:500px" src="img/ConvoBuilder/genai_answertester.png" alt="An enriched answer shown in the Answer Tester tool" /></p>

<p>If, during testing, you find there’s an article that isn’t returned by <a href="knowledgeai-key-terms-concepts-search-methods.html">AI Search</a> as the top answer, associate an intent with the article.</p>

<h3 id="integrating-with-a-kms-or-cms">Integrating with a KMS or CMS</h3>

<p>Take stock of the content in the KMS/CMS to assess its readiness for Conversational AI.</p>

<p>In general, ensure messages are short and focused. Sending content that’s too long or complex can create a poor consumer experience. For the best experience, consider the following:</p>

<ul>
  <li>Make sure that all required info (title, summary, etc.) is as brief as possible.</li>
  <li>If you require more than a brief answer, use a content URL, so the consumer can be directed to an external location for more information.</li>
  <li>Use rich content, such as images.</li>
  <li>Consider the channels you are serving when preparing your content. For example, SMS messaging can only support very simple textual content.</li>
</ul>

<p>Keep in mind that, while knowledge bases do support URLs for video and audio, Video and Audio <a href="conversation-builder-interactions-statements.html">statements</a> currently aren’t supported by Conversational Cloud. For this reason, they can’t be added to dialogs in Conversation Builder. As an alternative for video, you can use a Text statement that includes a video URL as a link.</p>

<h3 id="using-answers-enriched-via-generative-ai">Using answers enriched via Generative AI</h3>

<h4 id="prompts">Prompts</h4>

<p>In the context of Large Language Models (LLMs), the prompt is the text or input that is given to the model in order to receive generated text as output. Prompts can be a single sentence, a paragraph, or even a series of instructions or examples.</p>

<p>The LLM uses the provided prompt to understand the context and generate a coherent and relevant response. The quality and relevance of the generated response depend on the clarity of the instructions and how well the prompt conveys your intent. What's more, <a href="trustworthy-generative-ai-prompt-library-key-terms-concepts.html#hallucinations">the style of the prompt impacts the degree of risk for hallucinations</a>.</p>

<p>For best performance, ensure your prompts follow our <a href="trustworthy-generative-ai-prompt-library-best-practices.html">best practices for writing prompts</a>. Also see our <a href="trustworthy-generative-ai-prompt-library-migrate-to-gpt-4o-mini.html">guidance on migrating to GPT-4o mini</a>.</p>

<h4 id="hallucinations">Hallucinations</h4>

<p>Using <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">enriched answers created via Generative AI</a>? Concerned about hallucinations? Consider turning on enriched answers <a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html">in bots</a> that aren’t consumer-facing first (e.g., in a support bot for your internal field team), or <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">in Conversation Assist</a> first. An internal bot is still an automated experience, but it’s safer because the conversations are with your internal employees. Conversation Assist is a bit more consumer-facing, but it has an intermediary safety measure, namely, your agents. They can review the quality of the enriched answers and edit them if necessary, before sending them to consumers. Once you’re satisfied with the results in these areas, you can add support in consumer-facing bots.</p>

<h4 id="more-generative-ai-best-practices">More Generative AI best practices</h4>

<p>See the relevant section for your use case:</p>

<ul>
  <li><a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html#best-practices">Best practices for usage in Conversation Assist</a></li>
  <li><a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html#best-practices">Best practices for usage in Conversation Builder bots</a></li>
</ul>

<h3 id="using-liveperson-nlu">Using LivePerson NLU</h3>

<p>If your internal knowledge base uses Knowledge Base intents, which is a legacy feature, behind the scenes the LivePerson (Legacy) engine is used for intent matching. For better performance and a more scalable solution, LivePerson recommends that you <a href="knowledgeai-internal-knowledge-bases-knowledge-bases.html#convert-knowledge-base-intents-to-domain-intents">convert from Knowledge Base intents to Domain intents</a> as soon as possible. This allows you to associate a domain that uses the LivePerson engine (or a third-party engine). There are many <a href="intent-manager-natural-language-understanding-liveperson-nlu-engine.html#benefits-of-liveperson-over-liveperson-legacy">benefits of LivePerson over LivePerson (Legacy)</a>.</p>

<p class="attn-tip">The above said, you can also use our powerful <em>AI Search</em> instead of Natural Language Understanding. It's ready out of the box. No setup required. No intents required. <a href="knowledgeai-key-terms-concepts-search-methods.html">Learn about search methods.</a></p>

<h3 id="limits">Limits</h3>

<p>To promote best practices, <a href="knowledgeai-limits.html">limits</a> are enforced for the number of articles, the length of fields, and so on.</p>
]]></description>
      <!-- <pubDate>Tue, 21 Oct 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Answer Recommendations</title>
      <link>https://developers.liveperson.com/conversation-assist-key-terms-concepts-answer-recommendations.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-key-terms-concepts-answer-recommendations.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>Answer recommendations are relevant responses that agents can use to resolve consumer queries. They're drawn from the <a href="knowledgeai-key-terms-concepts-basic-concepts.html">knowledge base</a> that contains all of your knowledge content. They can even be <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">enriched via Generative AI</a> to make them warm and contextually aware.</p>

<p><img width="800" alt="Example conversation with agent, showing two recommendations offered, one an answer, the other a bot, with a callout to the answer recommendation" src="img/agentassist/recs_types_answer.png" /></p>

<p>When answer recommendations are used, conversational outcomes are more consistent and more efficient. Agent productivity is thereby improved, as are overall operational metrics for the contact center.</p>

<p>This topic discusses important concepts related to answer recommendations.</p>

<h3 id="videos">Videos</h3>

<p>Watch our videos on:</p>

<ul>
  <li>Processing the user's query for better search</li>
  <li>Processing the answers for better results</li>
</ul>

<p>Both of these concepts are introduced in this article.</p>

<iframe src="https://player.vimeo.com/video/1094174430?h=a57daff6d2" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>
<p><br /></p>
<iframe src="https://player.vimeo.com/video/1094174404?h=eb3ca37301" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<h3 id="user-queries-contextualize">User queries: contextualize</h3>

<p>Due to the dynamic, evolving, and efficient nature of language, often the consumer’s query doesn’t include enough context to retrieve a high-quality answer from a knowledge base. Consider a conversation about the iPhone 15 Pro, with a final query from the consumer of, “How much is it?” Using this query to search a knowledge base for an answer isn’t likely to find a great answer.</p>

<p>But Conversation Assist has an elegant, AI-powered answer to this: Before performing the knowledge base search, you can pass the consumer’s query—along with some conversation context—to a LivePerson small language model so that <a href="knowledgeai-key-terms-concepts-user-queries-contextualize.html">the model can enhance (rephrase) it</a>. This can significantly improve the quality (relevancy and accuracy) of the answer recommendations that are offered to your agents.</p>

<p>Turn on this behavior in the <a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">knowledge base rule</a>. (Currently, it’s not available in bot rules.)</p>

<h3 id="user-queries-custom-process-via-generative-ai">User queries: custom process via Generative AI</h3>

<p>You can use an LLM to perform any kind of custom processing of the user’s query before performing the knowledge base search for answers. For example, if you’re supporting cross-lingual queries (say the query is in Spanish, but your knowledge base is in English), you might want to translate the query into the language of the knowledge base that will be searched for answers. Doing so can improve the search results significantly.</p>

<p><img width="800" alt="An answer recommendation, where the user query was in Spanish and translated into English before searching the knowledge base" src="img/agentassist/custom_process_query.png" /></p>

<p>Benefits:</p>

<ul>
  <li>Boost the accuracy and relevancy of answers.</li>
  <li>Support a global reach with multi-lingual capabilities.</li>
</ul>

<p>Related info:</p>

<ul>
  <li><a href="knowledgeai-key-terms-concepts-user-queries-custom-process-via-generative-ai.html">Learn about related KnowledgeAI guidelines.</a></li>
  <li><a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">Learn how to set up custom processing in a knowledge base rule</a> in Conversation Assist.</li>
</ul>

<h3 id="answers-enrich-via-generative-ai">Answers: enrich via Generative AI</h3>

<p>If you’re using Conversation Assist to offer answer recommendations to your agents, you can <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">offer ones that are enriched by KnowledgeAI's LLM-powered answer enrichment service</a>. The resulting answers, formulated via Generative AI, are accurate, contextually aware, and natural-sounding.</p>

<h3 id="answers-custom-process-via-generative-ai">Answers: custom process via Generative AI</h3>

<p>You can use an LLM to perform any kind of custom processing of the answers returned by KnowledgeAI, before returning those answers to Conversation Assist.</p>

<p>A popular use case for this is to rephrase the answers so that they better conform to your brand’s voice.</p>

<p><img width="800" alt="An answer recommendation, where the answer was rephrased into a helpful and friendly voice before offering it to the agent" src="img/agentassist/custom_process_answer1.png" /></p>

<p>Or, you might need to translate the answer into the consumer’s language.</p>

<p><img width="800" alt="An answer recommendation, where the answer was translated into Spanish before offering it to the agent" src="img/agentassist/custom_process_answer2.png" /></p>

<p>Benefits:</p>

<ul>
  <li>Promote smarter conversations via optimized answers.</li>
  <li>Ensure brand compliance by aligning communications with your brand’s voice.</li>
  <li>Support a global reach with multi-lingual capabilities.</li>
  <li>Save agents time and reduce manual edits.</li>
</ul>

<p>Related info:</p>

<ul>
  <li><a href="knowledgeai-key-terms-concepts-answers-custom-process-via-generative-ai.html">Learn about related KnowledgeAI guidelines.</a></li>
  <li><a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">Learn how to set up custom processing in a knowledge base rule</a> in Conversation Assist.</li>
</ul>

<h3 id="summary-or-detail">Summary or detail?</h3>

<p>An article (answer) in a knowledge base in KnowledgeAI™ has two primary fields for content: <strong>Summary</strong> and <strong>Detail</strong>. Confused about which one is used to offer answer recommendations to agents? <a href="knowledgeai-key-terms-concepts-basic-concepts.html#summary-versus-detail">Learn the basic concepts about <strong>Summary</strong> and <strong>Detail</strong>.</a></p>

<p>Also see our <a href="knowledgeai-best-practices.html#summary-and-detail">best practices for using <strong>Summary</strong> and <strong>Detail</strong>.</a></p>

<h3 id="rich-or-plain">Rich or plain?</h3>

<p class="attn-note">Currently, rich answer recommendations are supported only on the Web and Mobile SDK channels.</p>

<p>When offering your agents answer recommendations, you want them to be relevant. But you also want them to be engaging, right? We agree.</p>

<p>So, when it comes to offering answer recommendations, you have options: You can offer plain text answers. Or, you can offer both rich and plain answers, and let your agents choose which type to send within the conversation. Here below, we’ve done the latter.</p>

<h5 id="recommended-answer-offered-in-a-conversation">Recommended answer offered in a conversation</h5>

<p><img width="700" alt="Rich answers being offered to the agent along with plain answers, inline in a conversation" src="img/agentassist/richcontent_inline_lessanno.png" /></p>

<h5 id="recommended-answer-offered-on-demand">Recommended answer offered on demand</h5>

<p><img width="500" alt="Rich answers being offered to the agent along with plain answers, via the On-Demand Recommendations widget" src="img/agentassist/richcontent_ondemand.png" /></p>

<p>Considering supporting rich answers. Their multimedia nature makes them much more engaging than plain answers, leading to a best-in-class experience for the consumer. <a href="conversation-assist-setup-configure-settings.html#rich-content">Learn more.</a></p>
]]></description>
      <!-- <pubDate>Tue, 21 Oct 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Methods v2</title>
      <link>https://developers.liveperson.com/conversation-orchestrator-conversation-context-service-methods-v2.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-orchestrator-conversation-context-service-methods-v2.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>There are two ways to manage properties in the Conversation Context Service (CCS).</p>

<ul>
  <li>REST APIs can directly access the CCS outside Conversational Cloud. Use the REST APIs when you want to retrieve information from external data sources.</li>
  <li>A Javascript function wraps the REST API for easy use within Conversational Cloud. If you want to save and delete properties in LivePerson Conversation Builder, use the Javascript wrapper functions.</li>
</ul>

<h3 id="important-notes">Important notes</h3>

<p>Note the following when using the v2 API:</p>

<ul>
  <li>Some clients invoke the CCS v2 APIs <em>indirectly</em>. For example, calls from a <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html">LivePerson Conversation Builder bot</a> or the <a href="liveperson-functions-toolbelt-documentation-toolbelt.html">LivePerson Functions Toolbelt</a> invoke the v1 APIs, which forward the requests to the v2 APIs. In such cases, when no session is provided, a session named <code class="language-html highlighter-rouge">__default__</code> is defined and forwarded to the v2 APIs.</li>
  <li>The name for a namespace can be a combination of letter(s), number(s) and underscore(_) only. Other special characters are not permitted.</li>
  <li>For optimal performance, Conversation Context Service (v2) default and session-level properties have a character limit of 800,000 (800 kb), which includes spaces, punctuation, and other visible characters. If the stored value exceeds 800,000 characters, the API will return an HTTP status of 413 with a message body of "document too large." Data will not be saved for that call or subsequent ones until the character count falls below the imposed limit.</li>
  <li>Context Service supports a Global namespace, which is independent of session/conversation. Use the Global namespace only to manage data that is truly global: the data is consistent across every user and every conversation, such as your store's operating hours. <strong>Don't</strong> use the Global namespace to aggregate data from many different users or conversations. It isn't designed for that purpose.
    <ul>
      <li>Use context documents per session/conversation. Don’t try to reuse a context document across multiple sessions/conversations if not required.</li>
      <li>Assign TTL on context document. In V2, we enforce TTL on context documents. By default, the max retention on context documents is 13 months.</li>
      <li>In V2, multiple context properties can be upserted in one API call. Using the new feature can improve performance significantly.</li>
    </ul>
  </li>
  <li>The following namespaces are reserved for internal use only:
    <ul>
      <li><code class="language-html highlighter-rouge">consumer</code></li>
      <li><code class="language-html highlighter-rouge">operational</code></li>
      <li><code class="language-html highlighter-rouge">conversation</code></li>
      <li><code class="language-html highlighter-rouge">faas</code></li>
      <li><code class="language-html highlighter-rouge">custom</code></li>
      <li><code class="language-html highlighter-rouge">sde</code></li>
    </ul>
  </li>
</ul>

<h3 id="javascript-wrapper">JavaScript wrapper</h3>

<p>See the <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html">discussion on scripting functions for managing the Conversation Context Service</a> in the Conversation Builder documentation.</p>

<h3 id="rest-apis-overview">REST APIs overview</h3>

<p>The APIs can be called as shown below. Every API call requires the <a href="conversation-orchestrator-api-authorization.html#api-authorization-for-v2">secure token</a>:</p>

<p>{domain}/{api}?access_token=<Token></Token></p>

<h4 id="retrieving-the-domain">Retrieving the domain</h4>

<p>Use the <a href="domain-api.html">LivePerson Domain API</a> to retrieve the domain, providing your account ID and the <code class="language-html highlighter-rouge">ccs</code> service name.</p>

<h3 id="rest-api--save-properties">REST API — Save Properties</h3>

<p>This API can be used to add new properties or update existing properties. This API requires accountId, namespace, session (optional) and time to live as parameters. This API overwrites existing properties and inserts non-existing properties.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>POST</td>
      <td>/v2/context/document/create</td>
    </tr>
  </tbody>
</table>

<h4 id="request-payload-example">Request payload example</h4>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "accountId": "le12345678",
  "nameSpace": "myNamespace",
  "sessionId": "mySessionId",
  "ttlSeconds": 3600,
  "payload": {
    "property1": 100,
    "Property2": "abc"
  }
}
</code></pre></div></div>

<h4 id="request-example">Request example</h4>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> POST <span class="s2">"https://{domain}/v2/context/document/create"</span> <span class="nt">-H</span> <span class="s1">'Authorization: {token}'</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="nt">-d</span> <span class="s2">"{</span><span class="se">\"</span><span class="s2">accountId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">le12345678</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">nameSpace</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">myNamespace</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">sessionId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">mySessionId</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">ttlSeconds</span><span class="se">\"</span><span class="s2">:3600,</span><span class="se">\"</span><span class="s2">payload</span><span class="se">\"</span><span class="s2">:{</span><span class="se">\"</span><span class="s2">property1</span><span class="se">\"</span><span class="s2">:100,</span><span class="se">\"</span><span class="s2">Property2</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">abc</span><span class="se">\"</span><span class="s2">}}"</span>
</code></pre></div></div>

<h4 id="response-payload-example">Response payload example</h4>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "documentKey": "le12345678:myNamespace:mySessionId",
  "tenantId": "le12345678",
  "success": true
}
</code></pre></div></div>

<p>status code = 201</p>

<h3 id="rest-api--read-properties">REST API — Read Properties</h3>

<h4 id="retrieve-all-properties-within-a-namespace">Retrieve all properties within a namespace</h4>

<p>This API requires accountId and namespace as input. In its response, it returns all properties within the namespace.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>/v2​/context​/document​/{accountId}​/{nameSpace}</td>
    </tr>
  </tbody>
</table>

<h5 id="request-payload-example-1">Request payload example</h5>
<p>N/A</p>

<h5 id="request-example-1">Request example</h5>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v2/context/document/le12345678/myNamespace"</span> <span class="nt">-H</span> <span class="s1">'Authorization: {token}'</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span>
</code></pre></div></div>

<h5 id="response-payload-example-1">Response payload example</h5>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "accountId": "le12345678",
  "documentKey": "le12345678:myNamespace:",
  "documentType": "CONTEXT",
  "nameSpace": "myNamespace",
  "payload": {
    "Property2": "abc",
    "property1": 100
  },
  "tenantId": "le12345678",
  "ttl": "2021-05-11T22:37:39.176Z"
}
</code></pre></div></div>

<p>status code = 200</p>

<h4 id="retrieve-all-properties-within-a-session">Retrieve all properties within a session</h4>
<p>This API requires accountId, namespace and sessionId as inputs. In its response, it returns all properties within the session.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>/v2​/context​/document​/{accountId}​/{nameSpace}​/{sessionId}</td>
    </tr>
  </tbody>
</table>

<h5 id="request-payload-example-2">Request payload example</h5>
<p>N/A</p>

<h5 id="request-example-2">Request example</h5>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v2/context/document/le12345678/myNamespace/mySessionId"</span> <span class="nt">-H</span> <span class="s1">'Authorization: {token}'</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span>
</code></pre></div></div>

<h5 id="response-payload-example-2">Response payload example</h5>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "accountId": "le12345678",
  "documentKey": "le12345678:myNamespace:mySessionId",
  "documentType": "CONTEXT",
  "nameSpace": "myNamespace",
  "payload": {
    "Property2": "abc",
    "property1": 100
  },
  "sessionId": "mySessionId",
  "tenantId": "le12345678",
  "ttl": "2021-05-11T22:37:39.176Z"
}
</code></pre></div></div>

<p>status code = 200</p>

<h4 id="read-specific-properties">Read specific properties</h4>
<p>This API requires accountId, namespace and sessionId (optional) and properties as inputs. In its response, it returns all values for those properties.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>POST</td>
      <td>/v2​/context​/document​/properties</td>
    </tr>
  </tbody>
</table>

<h5 id="request-payload-example-3">Request payload example</h5>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "accountId": "le12345678",
  "nameSpace": "myNamespace",
  "sessionId": "mySessionId",
  "filter": [
    "myNamespace.property1",
    "myNamespace.property2"
  ]
}
</code></pre></div></div>

<h5 id="request-example-3">Request example</h5>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> POST <span class="s2">"https://{domain}/v2/context/document/properties"</span> <span class="nt">-H</span> <span class="s1">'Authorization: {token}'</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="nt">-d</span> <span class="s2">"{</span><span class="se">\"</span><span class="s2">accountId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">le12345678</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">nameSpace</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">myNamespace</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">sessionId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">mySessionId</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">filter</span><span class="se">\"</span><span class="s2">:[</span><span class="se">\"</span><span class="s2">myNamespace.property1</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">myNamespace.property2</span><span class="se">\"</span><span class="s2">]}"</span>
</code></pre></div></div>

<h5 id="response-payload-example-3">Response payload example</h5>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "myNamespace.property1": 100,
  "myNamespace.property2": "abc"
}
</code></pre></div></div>

<p>status code = 200</p>

<h3 id="rest-api--delete-properties">REST API — Delete Properties</h3>

<p>There are three ways to delete properties:</p>
<ul>
  <li>By setting the TTL</li>
  <li>By namespace or session</li>
  <li>By removing specific properties</li>
</ul>

<h4 id="delete-properties-within-a-namespace-or-session">Delete properties within a namespace or session</h4>
<p>This API takes namespace, session (optional) and properties as parameters and deletes those specific properties.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>DELETE</td>
      <td>/v2​/context​/document​/property​/delete</td>
    </tr>
  </tbody>
</table>

<h5 id="request-payload-example-4">Request payload example</h5>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "accountId": "le12345678",
  "nameSpace": "myNamespace",
  "sessionId": "mySessionId",
  "propertyToDelete": [
    "property1"
  ]
}
</code></pre></div></div>

<h5 id="request-example-4">Request example</h5>
<p>curl -X DELETE "https://{domain}/v2/context/document/property/delete" -H 'Authorization: {token}' -H  "accept: application/json" -H  "Content-Type: application/json" -d "{"accountId":"le12345678","nameSpace":"myNamespace","sessionId":"mySessionId"}"</p>

<h5 id="response-payload-example-4">Response payload example</h5>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "documentKey": "le12345678:myNamespace:mySessionId",
  "tenantId": "le12345678",
  "success": true
}
</code></pre></div></div>

<p>status code = 200</p>

<h4 id="delete-all-properties-within-a-namespace-or-session">Delete all properties within a namespace or session</h4>
<p>This API takes namespace and session (optional) and deletes all properties within the namespace or session.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>DELETE</td>
      <td>/v2​/context​/document​/delete</td>
    </tr>
  </tbody>
</table>

<h5 id="request-payload-example-5">Request payload example</h5>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "accountId": "le12345678",
  "nameSpace": "myNamespace",
  "sessionId": "mySessionId"
}
</code></pre></div></div>

<h5 id="request-example-5">Request example</h5>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> DELETE <span class="s2">"https://{domain}/v2/context/document/delete"</span> <span class="nt">-H</span> <span class="s1">'Authorization: {token}'</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="nt">-d</span> <span class="s2">"{</span><span class="se">\"</span><span class="s2">accountId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">le12345678</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">nameSpace</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">myNamespace</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">sessionId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">mySessionId</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">propertyToDelete</span><span class="se">\"</span><span class="s2">:[</span><span class="se">\"</span><span class="s2">property1</span><span class="se">\"</span><span class="s2">]}"</span>
</code></pre></div></div>

<h5 id="response-payload-example-5">Response payload example</h5>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "documentKey": "le12345678:myNamespace:mySessionId",
  "tenantId": "le12345678",
  "success": true
}
</code></pre></div></div>

<p>status code = 200</p>
]]></description>
      <!-- <pubDate>Mon, 20 Oct 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Trustworthy Generative AI for the Enterprise</title>
      <link>https://developers.liveperson.com/trustworthy-generative-ai-trustworthy-generative-ai-for-the-enterprise.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/trustworthy-generative-ai-trustworthy-generative-ai-for-the-enterprise.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>Generative AI is transforming the future of business across all industries. Are you interested in learning about LivePerson's solution that promotes <strong>safe, responsible, and equal AI</strong>?</p>

<p><a href="https://community.liveperson.com/kb/articles/1501-trustworthy-generative-ai-for-the-enterprise">Get acquainted and get started here</a> in our Community Center.</p>

<h3 id="deep-dive-into-our-generative-ai-offerings">Deep dive into our Generative AI offerings</h3>

<p>Need the in-depth product docs? Use the links below to get to the right place:</p>

<ul>
  <li><strong>Automated conversation summaries</strong>: <a href="https://community.liveperson.com/kb/articles/2007-automated-conversation-summaries-overview">Automated conversation summaries</a> are AI-generated summaries shown to agents, so they can quickly catch up on ongoing and historical conversations with consumers. This reduces the time that it takes to handle conversations, and it improves the experience during conversation hand-offs.</li>
  <li><strong>Copilot Rewrite</strong>: <a href="https://community.liveperson.com/kb/articles/1216-copilot-rewrite-overview">Copilot Rewrite</a> interprets and refines agent messages for clarity and professionalism within the Agent Workspace, raising the bar for agent-to-customer experiences. Enhance the productivity of your agents by automating message editing; free them up to focus on consumer queries. And enhance your brand's image with consistent and error-free agent communications.</li>
  <li><strong>Copilot Translate</strong>: Break language barriers. <a href="https://community.liveperson.com/kb/articles/2228-overview-of-copilot-translate">Copilot Translate</a> translates inbound and outbound messages for the agent in real time: Consumer messages are translated automatically into the agent’s language. Agent messages are translated into the consumer’s language upon request by the agent.</li>
  <li><strong>Copilot Assist</strong>: <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">Copilot Assist</a> lets you offer answer recommendations that are enriched via Generative AI to your agents. Enriched answer recommendations are grounded in knowledge base content, contextually aware, and natural-sounding. Enriched answer recommendations are powered by <a href="conversation-assist-overview.html">Conversation Assist</a>.</li>
  <li><strong>AI agents</strong>: <a href="conversation-builder-generative-ai-introduction.html">AI agents</a> are specialized, LLM-powered automations that are tailored to high-value use cases. AI agents are capable of engaging in complex, natural conversations to resolve more queries, as they have great accuracy when it comes to understanding language.</li>
</ul>
]]></description>
      <!-- <pubDate>Tue, 14 Oct 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Conversation Copilot</title>
      <link>https://developers.liveperson.com/conversation-copilot.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-copilot.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>Looking for info on our Conversation Copilot suite of products?</p>

<p>Use this page to get to the right spot:</p>

<ul>
  <li><a href="https://community.liveperson.com/kb/articles/2007-automated-conversation-summaries-overview">Automated Conversation Summaries</a>: AI-powered conversation summaries equip agents with concise overviews of past and present customer interactions (voice and messaging). These summaries highlight key issues, questions, and resolutions, enabling agents to quickly understand customer intent, saving time and improving efficiency. Access summaries for both ongoing and historical conversations to ensure seamless context and issue resolution.</li>
  <li><a href="https://community.liveperson.com/kb/articles/1216-overview-of-copilot-rewrite">Copilot Rewrite</a>: Elevate agent communication by intelligently interpreting and refining their messages directly within the workspace. This "magic wand" empowers agents to enhance clarity, grammar, and professionalism with up to three rephrasing options per phrase, ultimately fostering superior customer and agent experiences.</li>
  <li><a href="https://community.liveperson.com/kb/articles/2228-overview-of-copilot-translate">Copilot Translate</a>: Break language barriers and extend your global reach. Take advantage of AI-powered translation of inbound and outbound messages to and from agents in real time.</li>
  <li><a href="conversation-assist-overview.html">Conversation Assist</a>: Offer recommended bots and answers to your human agents in line in their conversations with consumers, and on demand within a dedicated widget. When your agents take advantage of these just-in-time recommendations, they become more efficient and save time. What's more, their conversational outcomes are improved and more consistent. Conversation Assist can even help to reduce the time to onboard new agents.</li>
</ul>
]]></description>
      <!-- <pubDate>Tue, 14 Oct 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Permissions</title>
      <link>https://developers.liveperson.com/conversation-builder-bot-accounts-permissions.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-bot-accounts-permissions.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>Users are granted privileges in LivePerson Conversation Builder by way of assignment of Conversation Builder permissions.</p>

<p>Conversation Builder's permission model is built on Conversational Cloud’s. You can use Conversational Cloud’s four roles (Agent, Agent manager, Campaign manager, Admin) as the basis from which to create custom profiles to suit your organization's needs. You can then assign those <a href="https://community.liveperson.com/kb/articles/1391-profiles">profiles</a> to users.</p>

<p>As an example, in Conversational Cloud, you might want to create a profile that grants (turns on) all Conversation Builder permissions, naming it something like, "CB — All Permissions," as we've done below.</p>

<p><img class="fancyimage" alt="Top of Edit Profile page in Conversational Cloud" style="width:700px" src="img/ConvoBuilder/permissions2.png" /></p>

<p><img class="fancyimage" alt="Bottom of Edit Profile page in Conversational Cloud" style="width:700px" src="img/ConvoBuilder/permissions3.png" /></p>

<p>You can then assign this profile to users like so:</p>

<p><img class="fancyimage" alt="Adding a profile to the Assignment field on the Edit user page" style="width:650px" src="img/ConvoBuilder/permissions4.png" /></p>

<p>As shown above, a profile contains a set of permissions. Conversation Builder supports two categories of permissions:</p>

<ul>
  <li><strong>Primary permissions</strong>: These are stand-alone permissions that govern the primary functionality of Conversation Builder. "Stand-alone" means you could assign just one of these to a Conversation Builder user.</li>
  <li><strong>Granular Permissions</strong>: These are designed to give you more flexibility regarding the restrictions that you want to put into place. This is achieved through the use of "add-on" roles.</li>
</ul>

<h3 id="primary-permissions">Primary permissions</h3>

<h4 id="conversation-builder-administrator">Conversation Builder: Administrator</h4>

<p>Users with this permission can view and edit public bots and their own private bots.</p>

<p>Additionally, users with this permission have full privileges (with exceptions noted below), including the ability to create, deploy and manage agent connectors at the bot level within Conversation Builder.</p>

<p>Users with this permission do have the following limitations:</p>

<ul>
  <li>No ability to create and manage (bot) templates</li>
  <li>No access to the Bot Status application, which is the operations area where bot deployments for the entire organization can be managed</li>
</ul>

<h4 id="conversation-builder-bot-builder">Conversation Builder: Bot Builder</h4>

<p>Users with this permission can view and edit public bots and their own private bots.</p>

<p>This permission provides full privileges for creating bots and related resources. More specifically, users with this permission can create and manage:</p>

<ul>
  <li>Bots</li>
  <li>Bot groups</li>
  <li>Dialogs and dialog templates</li>
  <li>Integrations</li>
  <li>Global functions</li>
  <li>Credentials</li>
  <li>Knowledge bases and articles</li>
  <li>Domains, intents and entities</li>
</ul>

<p>Users with this permission can also:</p>

<ul>
  <li>Activate and train models</li>
  <li>Create, deploy and manage agent connectors at the bot level within Conversation Builder</li>
  <li>Use the Conversation Tester</li>
  <li>View versions and releases (For privileges to create and manage these, add on the "Release Creator" and/or "Release Acceptor" granular permissions, discussed farther below.)</li>
  <li>View and download analytics data</li>
</ul>

<p>This permission doesn't allow the user to create and manage (bot) templates, accounts or users. Also, this permission doesn't allow the user access to the Bot Status application, which is the operations area where bot deployments for the entire organization can be managed.</p>

<h4 id="conversation-builder-content-user">Conversation Builder: Content User</h4>

<p>This permission is for users who create content. More specifically, users with this permission can create and manage:</p>

<ul>
  <li>Knowledge bases and articles</li>
  <li>Domains, intents and entities</li>
</ul>

<p>Users with this permission can also:</p>

<ul>
  <li>Activate and train models</li>
  <li>View and download analytics data</li>
</ul>

<h4 id="conversation-builder-business-user">Conversation Builder: Business User</h4>

<p>Users with this permission can only do the following:</p>

<ul>
  <li>View and download analytics data</li>
</ul>

<h4 id="conversation-builder-bot-status-access">Conversation Builder: Bot Status Access</h4>

<p>Users with this permission can only do the following:</p>

<ul>
  <li>Create, deploy and manage agent connectors for the entire organization in the Bot Status application</li>
</ul>

<h3 id="granular-permissions">Granular permissions</h3>

<p>As a business, you might want to provide basic Conversation Builder development capabilities to some users, with restrictions regarding certain capabilities like access to API integrations, for example. You can achieve this using combinations of the roles discussed below.</p>

<h4 id="conversation-builder-bot-builder-lite">Conversation Builder: Bot Builder Lite</h4>

<p>This "lite" permission is just like the Bot Builder permission with the following, additional limitations:</p>

<ul>
  <li>No ability to create and work with integrations</li>
  <li>No ability to create and work with credentials</li>
  <li>No ability to export and import bots</li>
</ul>

<p>Use one or more add-on permissions (below) along with this permission, as per your requirements. This allows you to selectively enable access to specific functions. For example, if you want to provide a bot developer with access to API integrations, grant the Bot Builder Lite and API Developer permissions, as shown below.</p>

<p><img class="fancyimage" alt="List of Conversation Builder add-on permissions in Conversational Cloud" style="width:700px" src="img/ConvoBuilder/permissions1.png" /></p>

<h4 id="add-on-permissions">Add-on permissions</h4>

<h5 id="conversation-builder-api-developer">Conversation Builder: API Developer</h5>

<p>Users with this permission can only create and manage integrations.</p>

<h5 id="conversation-builder-api-credentials-manager">Conversation Builder: API Credentials Manager</h5>

<p>Users with this permission can only manage credentials for API and NLU integrations.</p>

<p>Whenever you assign this permission, also assign:</p>

<ul>
  <li>Conversation Builder Bot Builder Lite</li>
  <li>Conversation Builder: API Developer</li>
</ul>

<h5 id="conversation-builder-importexport-manager">Conversation Builder: Import/Export Manager</h5>

<p>Users with this permission can only do the following:</p>

<ul>
  <li>Export/import bots</li>
  <li>Export/import knowledge bases</li>
</ul>

<h5 id="conversation-builder-release-creator">Conversation Builder: Release Creator</h5>

<p>Users with this permission can only do the following:</p>

<ul>
  <li>Create and delete versions</li>
  <li>Create releases</li>
</ul>

<p>Use this permission with the Bot Builder or Bot Builder Lite permission as you require.</p>

<h5 id="conversation-builder-release-acceptor">Conversation Builder: Release Acceptor</h5>

<p>Users with this permission can only do the following:</p>

<ul>
  <li>Create versions</li>
  <li>Accept releases, i.e., upgrade bots</li>
</ul>

<p>Use this permission with the Bot Builder or Bot Builder Lite permission as you require.</p>
]]></description>
      <!-- <pubDate>Tue, 30 Sep 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Credentials</title>
      <link>https://developers.liveperson.com/conversation-builder-bot-accounts-credentials.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-bot-accounts-credentials.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>Resource owners can use the Bot Accounts area within LivePerson Conversation Builder to define credentials for accessing resources.</p>

<p>Once a credential is defined, you can attach it to a bot <a href="conversation-builder-integrations-api-integrations.html">API integration</a>. When the bot is processing a dialog and needs to call the API integration as a part of the dialog flow, the bot will use the associated credentials to authenticate and perform the necessary actions.</p>

<p>You define credentials per organization.</p>

<p class="attn-alert">When working with API integrations, keep in mind that the authentication type that you select for a credential must be supported by the API that you intend to call. For example, don't use Basic Authentication if the API doesn't support it.</p>

<h3 id="api-credentials-managers">API credentials managers</h3>

<p>There exists a permission in Conversational Cloud that you can assign to relevant profiles if you want the user to only be able to manage credentials for API and NLU integrations. It's named <strong>Conversation Builder: API Credentials Manager</strong>.</p>

<p>Whenever you assign this permission, also assign these permissions:</p>

<ul>
  <li>Conversation Builder: Bot Builder Lite</li>
  <li>Conversation Builder: API Developer</li>
</ul>

<p>Learn more about:</p>
<ul>
  <li><a href="https://community.liveperson.com/kb/articles/1391-profiles">Conversational Cloud profiles</a></li>
  <li><a href="conversation-builder-bot-accounts-permissions.html">Conversation Builder permissions</a></li>
  <li><a href="conversation-builder-integrations-integration-basics.html">Conversation Builder integrations</a></li>
</ul>

<h3 id="oauth-20-using-the-authorization-code-grant-type">OAuth 2.0 using the Authorization Code grant type</h3>

<p>You can create an OAuth 2.0 credential and use it in <a href="conversation-builder-integrations-api-integrations.html">API integrations</a> when you require the use of an access token that's obtained via the OAuth 2.0 protocol.</p>

<p class="attn-note">The images in this section illustrate creating an OAuth 2.0 credential to support integration with Salesforce in particular, as an example.</p>

<h4 id="optionally-using-proof-key-for-code-exchange-pkce">Optionally using Proof Key for Code Exchange (PKCE)</h4>

<p>PKCE is an optional extension to the OAuth 2.0 protocol that provides an additional layer of security for authorization code grant flows.</p>

<p>When using the authorization code grant flow in OAuth 2.0, the client requests an authorization code from the authorization server, which is then exchanged for an access token. The authorization code is typically sent over a redirect from the authorization server to the client.</p>

<p>Without PKCE, there is a risk that an attacker could intercept the authorization code during this redirect and use it to obtain an access token for the client. PKCE mitigates this risk by requiring the client to generate a secret value called a "code verifier" and a hashed value called a "code challenge."</p>

<p>The client then sends the code challenge to the authorization server when requesting the authorization code, and the authorization server stores the code challenge with the authorization code. When the client exchanges the authorization code for an access token, it sends the code verifier to the authorization server, which hashes it to compare it to the stored code challenge.</p>

<p>If the code verifier matches the code challenge, the authorization server grants an access token to the client. This process ensures that only the client that originally requested the authorization code can exchange it for an access token, and not an attacker who intercepts the authorization code during the redirect.</p>

<h4 id="add-an-oauth-20-credential-using-the-authorization-code-grant-type">Add an OAuth 2.0 credential using the Authorization Code grant type</h4>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access Bot Accounts</a>, and select the name of the organization for which to create the credential.</li>
  <li>Click <strong>Credentials</strong> in the upper-left corner.</li>
  <li>Click <strong>Add Credential</strong> in the upper-right corner.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a descriptive name.</li>
      <li><strong>Authentication Type</strong>: Select "OAuth 2.0."</li>
      <li><strong>Proof Key for Code Exchange (PKCE) extension for OAuth 2.0</strong>: Check this box if you want to provide this additional layer of security for the authorization code grant flow. PKCE is discussed above.</li>
      <li><strong>Grant Type</strong>: Select "Authorization Code."</li>
    </ul>

    <p><img class="fancyimage" alt="Add Credentials page when adding an OAuth 2.0 credential and selecting the credential type" style="width:750px" src="img/ConvoBuilder/creds_oauth2_img7.png" /></p>
  </li>
  <li>Click <strong>Next</strong>.</li>
  <li>
    <p>Set the callback/redirect URI in the resource:</p>

    <p>a. Click <strong>Copy</strong> to copy the redirect URI to your clipboard.
     <img class="fancyimage" alt="Add Credentials page when adding an OAuth 2.0 credential and setting the callback or redirect URI in the resource" style="width:750px" src="img/ConvoBuilder/creds_oauth2_img1.png" />
 b. Go to the resource (for example, Salesforce), paste in/set the redirect URI there, and save.
     <img class="fancyimage" alt="Setting the redirect URI in the resource, for example, Salesforce" style="width:750px" src="img/ConvoBuilder/creds_oauth2_img2.png" /></p>
  </li>
  <li>Click <strong>Next</strong>.</li>
  <li>In the Add Credentials dialog box, specify the following based on the OAuth 2.0 configuration in the resource application (where you earlier pasted the redirect URI):
    <ul>
      <li><strong>Client ID</strong>: A public ID that identifies the API client to the respective entity. Also called the consumer key/ID.</li>
      <li><strong>Client Secret</strong>: A private secret that only the client should have. Used for verifying the client's identity before providing an access token to the API. Also called the consumer secret.</li>
      <li><strong>Scope</strong>: (Optional) Used to define the scope of the access granted by the token. For example, read_only in some resource providers would mean that the token will only grant access to read APIs. This value is passed as is; it should conform to the OAuth 2.0 specification.</li>
      <li><strong>Auth URL</strong>: Enter the auth URL (the auth end point). Used to exchange the OAuth2 credentials for a code that is later exchanged for an access token. Used only during the authorization process, which usually happens once.</li>
      <li><strong>Token URL</strong>: Enter the resource URL (the token end point). Used to exchange the OAuth2 credentials plus the code that was received from the Auth URL for an access token that will be used for making the secured API calls. Also used for refreshing the token when it expires.
 <img class="fancyimage" alt="Add Credentials page when adding an OAuth 2.0 credential and setting the properties needed for the authorization process" style="width:750px" src="img/ConvoBuilder/creds_oauth2_img3.png" /></li>
    </ul>
  </li>
  <li>
    <p>Click <strong>Authorize</strong>.</p>

    <p>This adds the credentials and proceeds to authorize them with the resource. You are redirected to the resource for authentication. If a session is already cached, you might be redirected immediately back to Conversation Builder; otherwise, you'll have to allow authorization.</p>

    <p><img class="fancyimage" alt="Logging into the resource, for example, Salesforce, to authenticate" style="width:400px" src="img/ConvoBuilder/creds_oauth2_img4.png" /></p>

    <p>If the credentials are valid, you are then redirected back to Conversation Builder, and you'll see a confirmation message indicating that authorization passed successfully. At this point, the access token is captured via your brand’s endpoint and persisted in Conversation Builder, and it can be used by bots. If a refresh token was defined (recommended), it also is captured and persisted.</p>
  </li>
</ol>

<h3 id="oauth-20-using-the-client-credentials-grant-type">OAuth 2.0 using the Client Credentials grant type</h3>

<p>You can create an OAuth 2.0 credential and use it in <a href="conversation-builder-integrations-api-integrations.html">API integrations</a> when you require the use of an access token that's obtained via the OAuth 2.0 protocol.</p>

<h4 id="add-an-oauth-20-credential-using-the-client-credentials-grant-type">Add an OAuth 2.0 credential using the Client Credentials grant type</h4>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access Bot Accounts</a>, and select the name of the organization for which to create the credential.</li>
  <li>Click <strong>Credentials</strong> in the upper-left corner.</li>
  <li>Click <strong>Add Credential</strong> in the upper-right corner.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a descriptive name.</li>
      <li><strong>Authentication Type</strong>: Select "OAuth 2.0."</li>
      <li><strong>Grant Type</strong>: Select "Client Credentials."</li>
    </ul>

    <p><img class="fancyimage" alt="Add Credentials page when adding an OAuth 2.0 credential and selecting the authentication type" style="width:750px" src="img/ConvoBuilder/creds_oauth2_img8.png" /></p>
  </li>
  <li>Click <strong>Next</strong>.</li>
  <li>In the Add Credentials dialog box, specify the following based on the OAuth 2.0 configuration in the resource application:
    <ul>
      <li><strong>Client ID</strong>: A public ID that identifies the API client to the respective entity. Also called the consumer key/ID.</li>
      <li><strong>Client Secret</strong>: A private secret that only the client should have. Used for verifying the client's identity before providing an access token to the API. Also called the consumer secret.</li>
      <li><strong>Scope</strong>: (Optional) Used to define the scope of the access granted by the token. For example, read_only in some resource providers would mean that the token will only grant access to read APIs. This value is passed as is; it should conform to the OAuth 2.0 specification.</li>
      <li><strong>Token URL</strong>: Enter the resource URL (the token end point). Used to exchange the OAuth2 credentials for an access token that will be used for making the secured API calls. Also used for refreshing the token when it expires.
 <img class="fancyimage" alt="Add Credentials page when adding an OAuth 2.0 credential and setting the properties needed for the authorization process" style="width:750px" src="img/ConvoBuilder/creds_oauth2_img9.png" /></li>
    </ul>
  </li>
  <li>
    <p>Click <strong>Authorize</strong>.</p>

    <p>If the credentials are valid, you'll see a confirmation message indicating that authorization passed successfully. At this point, the access token is captured via your brand’s endpoint and persisted in Conversation Builder, and it can be used by bots. If a refresh token was defined (recommended), it also is captured and persisted.</p>
  </li>
</ol>

<h3 id="automatic-refresh-of-an-oauth-20-credential">Automatic refresh of an OAuth 2.0 credential</h3>

<p>During the initial setup of the credential, when you grant authorization, Conversation Builder retrieves and securely stores the access token from your brand's designated web endpoint. If you've also set up a refresh token (which we strongly advise), that will be stored as well.</p>

<p>It's important for the refresh token to have a significantly longer lifespan than the access token (for example, 7 days versus 24 hours). This difference ensures that the access token can be successfully renewed when it expires.</p>

<p>Access tokens are automatically renewed, but only when there's activity that requires them (like an API call). There isn't a scheduled background process for this renewal. If you've configured both an expiration time for the access token (which we recommend) and a refresh token, the refresh token will be used to get a new access token. If the refresh token is within 5 minutes of its own expiration, both the access token and the refresh token will be renewed before the intended API call is made.</p>

<p>You’ll need to <strong>manually</strong> reauthorize the credential in the following cases:</p>

<ul>
  <li>At your endpoint, you’ve defined the expiry of the access token, but you haven’t defined a refresh token, and the access token has expired. (A configuration like this isn’t recommended so that processes can be automated as much as possible.)</li>
  <li>Both the access token and the refresh token have expired. (Refresh tokens should have a longer lifespan than access tokens, but they should also have an expiration date to limit potential abuse.)</li>
</ul>

<p>As mentioned above, manual reauthorization captures and persists a new access token and, if applicable, a new refresh token.</p>

<h3 id="manually-reauthorize-an-oauth-20-credential">Manually reauthorize an OAuth 2.0 credential</h3>

<p class="attn-note">Currently, there’s no way to programmatically reauthorize the credential.</p>

<ul>
  <li>
    <p>In the Credentials view, move your mouse over the credential in the list, click the <img class="inlineimage" style="width:25px" alt="3-dot icon" src="img/ConvoBuilder/icon_ellipsis.png" /> icon, and then select <strong>Authorize</strong> from the menu that appears.</p>

    <p><img class="fancyimage" alt="Menu for a credential; provides options for Edit, Delete, and Authorize" style="width:125px" src="img/ConvoBuilder/creds_oauth2_img6.png" /></p>

    <p>At this point, the access token is captured via your brand’s endpoint and persisted in Conversation Builder, and it can be used by bots. If a refresh token was defined (recommended), it also is captured and persisted.</p>
  </li>
</ul>

<h3 id="consumer-pre-authentication">Consumer Pre-Authentication</h3>

<p>Consumer Pre-Authentication is a type of OAuth 2.0 authentication. If you’re authenticating your consumers and then storing and managing their digital identities using an identity provider (IdP) service, you can leverage that functionality in the Conversational Cloud, effectively federating their identities to LivePerson.</p>

<p>The Consumer Pre-Authentication credential lets you securely share those consumer tokens with registered LivePerson services (Conversation Builder, etc.). In turn, our services can use the tokens to:</p>

<ul>
  <li>Validate consumers.</li>
  <li>Carry on authenticated conversations, without prompting the consumer to re-authenticate when powering multiple LivePerson use cases.</li>
  <li>Make API calls to your brand’s services on the consumer’s behalf (retrieve order details, make a payment, etc.).</li>
</ul>

<p class="attn-note">Consumer Pre-Authentication (IdP) credentials are supported only in the LivePerson cloud (North America), not in the public cloud.</p>

<h4 id="using-consumer-pre-authentication">Using Consumer Pre-Authentication</h4>

<p>In this authentication flow, the consumer is authenticated before a conversation with a bot ever begins. To set this up:</p>

<ol>
  <li>
    <p>Configure your IdP service, so you can leverage it in Conversational Cloud. <a href="consumer-authentication-configuration.html">Learn more</a>.</p>
  </li>
  <li>In <a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Bot Accounts</a>, <a href="conversation-builder-bot-accounts-credentials.html#add-a-consumer-pre-authentication-credential">add a Consumer Pre-Authentication credential</a>.</li>
  <li>In Conversation Builder, in an API integration in the bot, select the configured credential. This gets the consumer’s unique token from the IdP service when needed for the API call.</li>
</ol>

<p><img alt="Example API integration that uses a Consumer Pre-Authentication credential" style="width:800px" src="img/ConvoBuilder/creds_consumer_preauth_use.png" /></p>

<h4 id="how-does-consumer-pre-authentication-differ-from-consumer-authentication">How does Consumer Pre-Authentication differ from Consumer Authentication?</h4>

<p>The Consumer Pre-Authentication credential is somewhat similar to the <a href="conversation-builder-bot-accounts-credentials.html#consumer-authentication">Consumer Authentication credential</a>: Both use an IdP service to provide consumer tokens when requested.</p>

<p>However, the authentication flows are different. With the former, the consumer is “pre-authenticated,” i.e., they’re authenticated before a conversation with the bot begins. With the latter, the consumer must complete an authentication challenge during the conversation in order to be authenticated.</p>

<p>Consumer Pre-Authentication is strongly recommended over Consumer Authentication for several reasons:</p>

<ul>
  <li>It’s more secure. LivePerson securely stores and manages the consumer tokens in one, central place for use by all registered LivePerson services.</li>
  <li>It’s simpler for you. Lifecycle management is easier because you update the policies in one, central place instead of in multiple LivePerson services. What’s more, within your bot, the integration is implemented differently and more simply: Just select the Consumer Pre-Authentication credential as the one to use. That’s it.</li>
  <li>It’s simpler for your consumers. There’s no work for the consumer to do during the bot conversation.</li>
  <li>Token renewal is done automatically upon expiry.</li>
</ul>

<h4 id="add-a-consumer-pre-authentication-credential">Add a Consumer Pre-Authentication credential</h4>

<p class="attn-note">Only one Consumer Pre-Authentication credential can exist per account.</p>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access Bot Accounts</a>, and select the name of the organization for which to create the credential.</li>
  <li>Click <strong>Credentials</strong> in the upper-left corner.</li>
  <li>Click <strong>Add Credentials</strong> in the upper-right corner.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a descriptive name.</li>
      <li><strong>Authentication Type</strong>: Select “Consumer Pre-Authentication.”
 <img class="fancyimage" alt="Adding a Consumer Pre-Authentication credential" style="width:800px" src="img/ConvoBuilder/creds_consumer_preauth_add.png" /></li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="consumer-authentication">Consumer Authentication</h3>

<p>Unfamiliar with this credential? <a href="conversation-builder-integrations-using-consumer-access-tokens.html">Learn more</a>.</p>

<p class="attn-note">Consider using Consumer Pre-Authentication instead. It’s strongly recommended over this credential; <a href="conversation-builder-bot-accounts-credentials.html#how-does-consumer-pre-authentication-differ-from-consumer-authentication">learn why</a>.</p>

<h4 id="add-a-consumer-authentication-credential">Add a Consumer Authentication credential</h4>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access Bot Accounts</a>, and select the name of the organization for which to create the credential.</li>
  <li>Click <strong>Credentials</strong> in the upper-left corner.</li>
  <li>Click <strong>Add Credentials</strong> in the upper-right corner.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a descriptive name.</li>
      <li><strong>Authentication Type</strong>: Select “Consumer Authentication.”</li>
    </ul>
  </li>
  <li>Click <strong>Next</strong>.</li>
  <li>
    <p>For <strong>Authentication URL</strong>, enter the authentication endpoint to be sent to the consumer in order to obtain an access token that is sent to the bot. An example is below. The URL is provided by the resource provider; see their documentation for this info.</p>

    <p>The authentication URL must include the following query params:</p>
    <ul>
      <li>client_id={PROVIDE THE CLIENT ID}</li>
      <li>response_type=code</li>
      <li>redirectedCode={PROVIDE THE REDIRECT URI}</li>
      <li>scope={PROVIDE THE SCOPE}</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h5 id="authentication-url-example">Authentication URL Example</h5>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>https://accounts.brand.com/authorize?client_id=34e83335186541078261d83c6d050a32<span class="err">&amp;</span>response_type=code<span class="err">&amp;</span>redirect_uri=https://va.idp.liveperson.net/callback/12345566/redirectedCode<span class="err">&amp;</span>scope=user-read-private
</code></pre></div></div>

<h3 id="mutual-authentication">Mutual Authentication</h3>

<p>You can create a Mutual Authentication credential (Mutual TLS or mTLS) and use it in <a href="conversation-builder-integrations-api-integrations.html">API integrations</a> when you require an industry-standard, two-way authentication protocol where both the client and the server authenticate each other. A Mutual Authentication credential makes use of a key certificate and a trust certificate.</p>

<h4 id="key-certificates">Key certificates</h4>

<p>A key certificate is a key store file that contains private and public key pairs. A key certificate identifies the LivePerson platform as a valid entity that is allowed to interact with external systems. The recommended format is .p12 (PKCS12). You can generate a self-signed certificate pair using openssl or keytool, for example:</p>

<p><code class="language-html highlighter-rouge">keytool -genkeypair -alias nt-ms -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore cb-mtls-server.p12 -validity 3650 -ext SAN=dns:localhost,ip:127.0.0.1</code></p>

<p>You can verify the file using:</p>

<p><code class="language-html highlighter-rouge">keytool -keystore somefilename.p12 -list</code></p>

<h4 id="trust-certificates">Trust certificates</h4>

<p>A trust certificate is exported from the external system (e.g., Salesforce) to which the LivePerson platform makes the external call. The recommended file format is .pem.</p>

<p>When you add a Mutual Authentication credential, you can upload a trust certificate via the UI, or you can import it into the keystore as follows. If your keystore already has the trust certificate, then one provided via the UI is not required.</p>

<p class="attn-note">The PEM format is the most common format used for trust certificates. Extensions used for PEM certificates are .cer, .crt, and .pem. They are Base64-encoded ASCII files. The DER format is the binary form of the certificate. DER-formatted certificates do not contain the "BEGIN CERTIFICATE/END CERTIFICATE" statements. DER-formatted certificates most often use the .der extension.</p>

<p>You can convert a trust certificate to the required format using openssl. For example, the following commands convert a PEM-format file to DER and then import it into the keystore:</p>

<p><code class="language-html highlighter-rouge">openssl x509 -outform der -in certificate.pem -out certificate.der</code></p>

<p><code class="language-html highlighter-rouge">keytool -import -alias company-alias -keystore ./cb-mtls-server.p12 -file ./certificate.der</code></p>

<h4 id="standard-tls-versus-mtls">Standard TLS versus mTLS</h4>

<p>With standard TLS, the trust certificate is validated by an external party known as a Certificate Authority (CA) to ensure that the client is communicating with a server that legitimately owns the domain. However, with mTLS, a provider can act as a CA itself and optionally provide a self-signed TLS trust certificate that they can validate.</p>

<h4 id="add-a-mutual-authentication-credential">Add a Mutual Authentication credential</h4>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access Bot Accounts</a>, and select the name of the organization for which to create the credential.</li>
  <li>Click <strong>Credentials</strong> in the upper-left corner.</li>
  <li>Click <strong>Add Credential</strong> in the upper-right corner.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a descriptive name.</li>
      <li><strong>Authentication Type</strong>: Select "Mutual Authentication."</li>
    </ul>
  </li>
  <li>Click <strong>Next</strong>.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>Key Certificate</strong>: This is required. Click <strong>Upload</strong>, and upload the file that contains the private and public keys. The file format must be .pfx, .p12 (recommended), or .jks. Note that the UI doesn’t verify that the uploaded certificate and keys are working; you must verify externally that they’re current and valid.</li>
      <li><strong>Trust Certificate</strong>: This is optional. Click <strong>Upload</strong>, and upload the file that contains the trusted resources. The file format must be .crt, .cer, or .pem. As mentioned above, if your keystore already has the trust certificate, then one provided via the UI is not required. Note that the UI doesn’t verify that the uploaded certificate and keys are working; you must verify externally that they’re current and valid.</li>
      <li><strong>Key Certificate Password</strong>: This is an optional field, but if the keys certificate requires a password (a standard practice), you must enter it here.</li>
      <li><strong>Trust Certificate Password</strong>: This is an optional field, but if the trust certificate requires a password (a standard practice), you must enter it here.</li>
      <li><strong>Cryptographic Protocols</strong>: Select the encryption/decryption protocols that are supported by the trusted resources. If you leave this blank, the default value of TLS 1.2 and TLS1.1 is used.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="basic-authentication">Basic Authentication</h3>

<p>You can create a Basic Authentication credential and use it in <a href="conversation-builder-integrations-api-integrations.html">API integrations</a> when the API has a permanent token that you always want to use. The token is created by the system using the user name and password that you specify, and it's valid as long as the password isn't changed.</p>

<p>Like the Access Token credential (discussed below), this type of credential isn't very secure, so it isn't used very often.</p>

<h4 id="add-a-basic-authentication-credential">Add a Basic Authentication credential</h4>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access Bot Accounts</a>, and select the name of the organization for which to create the credential.</li>
  <li>Click <strong>Credentials</strong> in the upper-left corner.</li>
  <li>Click <strong>Add Credential</strong> in the upper-right corner.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a descriptive name.</li>
      <li><strong>Authentication Type</strong>: Select "Basic Authentication."</li>
    </ul>
  </li>
  <li>Click <strong>Next</strong>.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>User Name</strong>: Enter the user name for the system to use to create the token.</li>
      <li><strong>User Password</strong>: Enter the password for the system to use to create the token.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="access-token">Access Token</h3>

<p>You can create an Access Token credential and use it in <a href="conversation-builder-integrations-api-integrations.html">API integrations</a> when the API has a permanent token that you always want to use. You specify the token to use.</p>

<p>Like the Basic Authentication credential (discussed above), this type of credential isn't very secure, so it isn't used very often.</p>

<h4 id="add-an-access-token-credential">Add an Access Token credential</h4>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access Bot Accounts</a>, and select the name of the organization for which to create the credential.</li>
  <li>Click <strong>Credentials</strong> in the upper-left corner.</li>
  <li>Click <strong>Add Credential</strong> in the upper-right corner.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a descriptive name.</li>
      <li><strong>Authentication Type</strong>: Select "Access Token."</li>
    </ul>
  </li>
  <li>Click <strong>Next</strong>.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>Access Token</strong>: Enter the token.</li>
      <li><strong>Token Type</strong>: Enter the type of token; typically, this value is "Bearer" or "Basic," but this field allows for free text to let you specify another third-party type that isn't supported by any protocol.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="transfer-to-messaging">Transfer to Messaging</h3>

<p>A Voicebot that includes a <a href="conversation-builder-interactions-integrations.html#transfer-to-messaging">Transfer to Messaging</a> interaction to transfer the phone conversation to a messaging channel must use a "Transfer to Messaging" credential to perform the transfer.</p>

<p>The credential provides a client ID and client secret to establish a secure and authorized communication channel between the Conversation Builder Voicebot and LivePerson's Connect-to-Messaging (C2M) system.</p>

<p class="attn-note">Get the client ID and client secret from your LivePerson account representative.</p>

<p>The Voicebot must perform several API calls to accomplish the transfer to messaging. In the first API call, if the client ID is recognized and the client secret is valid, the C2M system provides an access token to use when making the rest of the API calls. This avoids revealing the client secret every time.</p>

<h4 id="add-a-transfer-to-messaging-credential">Add a Transfer to Messaging credential</h4>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access Bot Accounts</a>, and select the name of the organization for which to create the credential.</li>
  <li>Click <strong>Credentials</strong> in the upper-left corner.</li>
  <li>Click <strong>Add Credential</strong> in the upper-right corner.</li>
  <li>In the Add Credential dialog box, specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a descriptive name.</li>
      <li><strong>Authentication Type</strong>: Select "Transfer to Messaging."</li>
    </ul>
  </li>
  <li>Click <strong>Next</strong>.</li>
  <li>In the Add Credential dialog box, specify the following:
    <ul>
      <li><strong>Client ID</strong>: Enter the unique identifier that the LivePerson C2M system uses to identify Conversation Builder as a recognized client application. Get this client ID from your LivePerson account representative.</li>
      <li><strong>Client Secret</strong>: Enter the secret key that's used to verify that Conversation Builder is authorized to access the LivePerson C2M system. Get this client secret from your LivePerson account representative.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="third-party-nlu">Third-party NLU</h3>

<p class="attn-note">This procedure applies if you're using a Google Dialogflow or IBM Watson NLU engine for NLU intelligence.</p>

<p>While the credential types discussed above support <a href="conversation-builder-integrations-api-integrations.html">API integrations</a>, a third-party NLU credential is different in that it's used during <em>domain training</em> in <a href="intent-manager-overview.html">Intent Manager</a>. Use it to authenticate with the third-party NLU engine.</p>

<h4 id="add-a-third-party-nlu-credential">Add a third-party NLU credential</h4>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access Bot Accounts</a>, and select the name of the organization for which to create the credential.</li>
  <li>Click <strong>Credentials</strong> in the upper-left corner.</li>
  <li>Click <strong>Add Credential</strong> in the upper-right corner.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>Name</strong>: Enter a descriptive name.</li>
      <li><strong>Authentication Type</strong>: Select "Third-party NLU."</li>
    </ul>
  </li>
  <li>Click <strong>Next</strong>.</li>
  <li>In the Add Credentials dialog box, specify the following:
    <ul>
      <li><strong>NLU Provider</strong>: Select the NLU provider.</li>
      <li><strong>Credentials</strong>: Paste here the credentials that you received from the NLU provider when you set up the service. The credentials must be in JSON format.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="delete-a-credential">Delete a credential</h3>

<p>Before deleting a credential, manually verify that it isn't in use by a bot or, in the case of third-party NLU credentials, by a domain. If the credential is in use, you'll need to reconfigure the bots or domains as appropriate.</p>

<h4 id="to-delete-a-credential">To delete a credential</h4>

<ol>
  <li><a href="conversation-builder-bot-accounts-overview.html#access-bot-accounts">Access Bot Accounts</a>, and select the name of the organization for which to delete the credential.</li>
  <li>Click <strong>Credentials</strong> in the upper-left corner to display the list of credentials.</li>
  <li>Select the credential, and then click the <img style="width:25px" alt="3-dot icon" src="img/ConvoBuilder/icon_ellipsis.png" /> icon that appears.</li>
  <li>Select <strong>Delete</strong>.</li>
  <li>Click <strong>Continue</strong> in the confirmation dialog.</li>
</ol>
]]></description>
      <!-- <pubDate>Tue, 30 Sep 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Agent Experience - Messaging</title>
      <link>https://developers.liveperson.com/conversation-assist-agent-experience-messaging.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-agent-experience-messaging.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="use-a-recommended-answer-or-bot">Use a recommended answer or bot</h3>

<p>In Conversational Cloud, inline recommendations (answers and bots) are displayed directly within the conversation.</p>

<p><img width="550" alt="Two recommendations being offered to the agent inline in the conversation" src="img/agentassist/use_recs.png" /></p>

<h4 id="to-use-a-recommended-bot">To use a recommended bot</h4>

<ul>
  <li>
    <p>Click <strong>Delegate</strong> to join a bot to the conversation, so the bot takes over. You stay in the conversation, so you can monitor the bot’s progress and remove the bot if needed.</p>

    <p><img width="550" alt="The conversation flow when a bot is joined to the conversation" src="img/agentassist/use_bot.png" /></p>
  </li>
</ul>

<p class="attn-tip">As shown in the image above, a system message announces when the bot joins the conversation. You can <a href="conversation-assist-setup-configure-settings.html#bot-messages">customize this message</a>.</p>

<h4 id="to-use-a-recommended-answer">To use a recommended answer</h4>

<ul>
  <li>
    <p>Click <strong>Use Answer</strong> to copy the article’s text to the agent’s text input area. You can edit the text before sending it to the consumer.</p>

    <p><img width="550" alt="Use answer button for using a recommended answer" src="img/agentassist/use_article.png" />
  <img width="550" alt="The conversation flow after a recommended answer has been used" src="img/agentassist/use_article2.png" /></p>
  </li>
</ul>

<h3 id="edit-a-rich-answer">Edit a rich answer</h3>

<p>You can edit the text (only) of rich answers that are offered via Conversation Assist.</p>

<p>Here's how to edit a rich answer that's offered inline in a conversation:</p>

<p><img width="550" alt="An agent editing the text of a rich answer that's offered inline in the conversation" src="img/agentassist/ca_editrichanswer_inline.gif" /></p>

<p>And here's how to edit a rich answer that's offered via the On-Demand Recommendations widget:</p>

<p><img width="800" alt="An agent using the Bots and Answers tab of the On-Demand Recommendations widget to find a rich answer and to edit the text of that answer" src="img/agentassist/ca_editrichanswer_odw.gif" /></p>

<h3 id="remove-or-replace-the-current-bot">Remove or replace the current bot</h3>

<p>After you have joined a bot to a conversation, you can remove or replace it if desired:</p>

<ul>
  <li>To remove the current bot, click <strong>Remove bot</strong> at the top of the messaging panel. The agent can then take over.</li>
  <li>
    <p>To replace the current bot, click <strong>Replace bot</strong> beside the bot you want to substitute into the conversation. The selected bot joins the conversation, taking over for the previous bot. (Only one bot can be joined to a conversation at a time.)</p>

    <p><img width="550" alt="Remove bot and Replace bot options that are available when a bot is a part of the conversation" src="img/agentassist/remove_replace_bot.png" /></p>
  </li>
</ul>

<h3 id="look-up-offered-recommendations">Look up offered recommendations</h3>

<p class="attn-note">The feature discussed in this section is in <strong>Early Access</strong> (EA) release. It is available by request; contact your LivePerson representative to enable it for your account. Once the feature is enabled, it is visible to <strong>all</strong> of your agents regardless of their assigned skill.</p>

<p>Your agents’ conversations with consumers often can be long. Sometimes, the agent wants to use an answer or a bot that was recommended earlier in the conversation. But scrolling back through the conversation to find it is tedious and time-consuming.</p>

<p>To meet this need, the agent can click the button below, which provides one-click access to every recommendation that was offered <strong>in the conversation</strong> (not in the On-Demand Recommendations widget).</p>

<p><img width="600" alt="A callout to the unique recommendations icon with a badge showing two recommendations have been offered in the conversation" src="img/agentassist/unique_recs1.png" /></p>

<p>Check it out in action:</p>

<p><img width="600" alt="Opening and closing the unique recommendations window" src="img/agentassist/unique_recs2.gif" /></p>

<p>Note the following:</p>
<ul>
  <li>To streamline the list, every unique recommendation is listed just once. For an answer recommendation to be considered unique, the answer’s content must not exactly match another recommendation.</li>
  <li>If you use a bot recommendation from the list—thereby delegating the conversation to the bot—the consumer’s <strong>most recent utterance</strong> in the conversation is used to trigger a dialog (flow) in the bot.</li>
  <li>If there are no recommendations that were offered in the conversation, the button remains visible, but there is no badge indicating the count of recommendations that are available.</li>
</ul>

<h3 id="look-up-answers-and-bots-on-demand">Look up answers and bots on demand</h3>

<p>Conversation Assist automatically recommends answers and bots to agents, inline in conversations, based on consumer intent and conversation skill. But…sometimes…your agents need more flexibility. Sometimes, they need to be able to look up answers and bots on demand, regardless of what the consumer just said. The On-Demand Recommendations widget in the Agent Workspace meets this need.</p>

<p><img width="800" alt="An agent using the Bots and Answers tab of the On-Demand Recommendations widget to find bots and answers" src="img/agentassist/ca_widget_botsandanswers.gif" /></p>

<p>If you’ve <a href="conversation-assist-setup-configure-settings.html#on-demand-recommendations-widget">turned on the display of the widget</a>, you can use the Bots &amp; Answers tab to ask any question, or enter a phrase, and get back available bots and answers. You can then easily use those recommendations in the current conversation.</p>

<p><img width="800" alt="The Bots and Answers tab of the On-Demand Recommendations widget" src="img/agentassist/ca_ondemandwidget_botsandanswers.png" /></p>

<p>Note the following identified in the image:</p>

<ol>
  <li><strong>Copy answer</strong>: Copy the recommended answer (the plain text) to your clipboard in order to paste it somewhere else.</li>
  <li><strong>Edit and send answer</strong>: Copy the recommended answer to the conversation window, where you can edit it before sending it.</li>
  <li><strong>Send answer</strong>: Send the recommended answer immediately.</li>
  <li><strong>Delegate to bot</strong>: Delegate the conversation to the recommended bot.</li>
</ol>

<p>As with recommendations that are displayed inline in the conversation, all recommendations shown in the widget respect the configuration rules that you've set up in Conversation Assist.</p>

<p class="attn-note">In the widget, use of the <strong>Most used by me</strong> and <strong>Most used by all</strong> areas is no longer available; we're working on removing these areas from the UI.</p>

<h3 id="look-up-replies-on-demand">Look up replies on demand</h3>

<p><a href="https://community.liveperson.com/kb/articles/1382-predefined-content-overview">Predefined content</a> is a set of canned responses (replies) for common use cases: greetings, closings, and so on. Conversational Cloud lets you personalize predefined content, so it reflects your brand’s voice and business needs.</p>

<p>Predefined content is made available on the Replies tab in the On-Demand Recommendations widget.</p>

<p><img width="800" alt="An agent using the Replies tab of the On-Demand Recommendations widget to find predefined content" src="img/agentassist/ca_widget_predefinedcontent.gif" /></p>

<p>If you’ve <a href="conversation-assist-setup-configure-settings.html#on-demand-recommendations-widget">turned on the display of the widget</a>, you can use the tab to search and browse for replies on demand. You can then easily use them in the current conversation.</p>

<p><img width="800" alt="The Replies tab of the On-Demand Recommendations widget" src="img/agentassist/ca_ondemandwidget_replies.png" /></p>

<p>Note the following identified in the image:</p>

<ol>
  <li><strong>Copy reply</strong>: Copy the reply to your clipboard in order to paste it somewhere else.</li>
  <li><strong>Edit and send reply</strong>: Copy the reply to the conversation window, where you can edit it before sending it.</li>
</ol>

<h3 id="provide-feedback-on-recommendations">Provide feedback on recommendations</h3>

<p>You can provide "thumbs up" and "thumbs down" feedback on recommendations. Give a "thumbs up" when the recommendation is right based on the consumer's query. And give a "thumbs down" when it's wrong.</p>

<p>Here's how to give feedback on an inline recommendation:</p>

<p><img width="600" alt="An agent giving a thumbs-up for a recommended answer and then sending that answer to the consumer" src="img/agentassist/ca_agentSendsFeedback.gif" /></p>

<p>And here's how to give feedback on a recommendation that's offered in the On-Demand Recommendations widget:</p>

<p><img width="800" alt="An agent giving a thumbs-up for a recommended answer and then sending that answer to the consumer" src="img/agentassist/ca_agentSendsFeedback2.gif" /></p>

<p><a href="conversation-assist-setup-configure-settings.html#agent-feedback">Learn how to turn on the agent feeback feature.</a></p>

<p><a href="conversation-assist-reporting.html#use-agent-feedback-reports-to-tune-answers-and-bots">Learn about agent feedback reports.</a></p>
]]></description>
      <!-- <pubDate>Mon, 29 Sep 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>FAQs</title>
      <link>https://developers.liveperson.com/conversation-assist-faqs.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-faqs.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="setup">Setup</h3>

<h4 id="can-i-use-the-same-agent-group-or-profile-in-multiple-add-ons-within-a-rule">Can I use the same agent group or profile in multiple add-ons within a rule?</h4>

<p>Yes. But keep in mind that the order of the add-ons matters: At runtime, the add-ons are evaluated in order, and only the first one that’s matched is executed.</p>

<h4 id="can-i-turn-off-all-recommendations">Can I turn off all recommendations?</h4>

<p>Yes, you can turn off recommendations for your account. To do this:</p>

<ol>
  <li><a href="conversation-assist-overview.html#access-conversation-assist">Access Conversation Assist</a>.</li>
  <li>Click <strong>Settings</strong> from the menu at the top.</li>
  <li>Under <strong>General</strong>, click <strong>Suspend</strong>.</li>
</ol>

<h3 id="agent-experience">Agent experience</h3>

<h4 id="in-closed-conversations-are-the-recommendations-that-were-offered-shown">In closed conversations, are the recommendations that were offered shown?</h4>

<p>No, they aren't.</p>

<h4 id="why-arent-my-knowledge-base-answers-formatted">Why aren’t my knowledge base answers formatted?</h4>

<p>Currently, only hyperlinks are supported.</p>

<h3 id="agent-feedback-thumbs-up-thumbs-down">Agent feedback (thumbs up, thumbs down)</h3>

<h4 id="is-the-feedback-of-my-agents-captured-in-the-reports-that-are-available-for-download">Is the feedback of my agents captured in the reports that are available for download?</h4>

<p>Yes! <a href="conversation-assist-reporting.html#use-agent-feedback-reports-to-tune-answers-and-bots">Learn about agent feedback reports.</a></p>

<h4 id="agents-can-provide-feedback-on-botanswer-recommendations-by-clicking-thumbs-up-or-thumbs-down-on-the-recommendation-they-can-also-edit-recommended-answers-and-send-the-edited-answers-to-consumers-do-these-actions-influence-what-recommendations-are-subsequently-offered">Agents can provide feedback on bot/answer recommendations by clicking “thumbs up” or “thumbs down” on the recommendation. They can also edit recommended answers and send the edited answers to consumers. Do these actions influence what recommendations are subsequently offered?</h4>

<p>No, not at this time.</p>

<h4 id="in-the-case-of-recommended-answers-does-editing-the-answer-before-sending-it-or-clicking-thumbs-up-or-thumbs-down-on-the-recommended-answer-influence-the-knowledge-base-in-knowledgeai">In the case of recommended answers, does editing the answer before sending it, or clicking “thumbs up” or “thumbs down” on the recommended answer influence the knowledge base in KnowledgeAI?</h4>

<p>No, not at this time.</p>

<h4 id="is-agent-feedback-used-to-enhance-the-underlying-recommendation-engine">Is agent feedback used to enhance the underlying recommendation engine?</h4>

<p>No, not at this time.</p>

<h3 id="metrics-and-reporting">Metrics and reporting</h3>

<h4 id="on-the-home-page-in-the-recommendations-widget-the-summary-data-does-not-align-with-the-graph-data-why-is-this">On the Home page, in the Recommendations widget, the Summary data does not align with the graph data. Why is this?</h4>

<p>There’s a bug in the Summary information in this widget. It should show the number of used recommendations “over” the number of offered recommendations, where the latter (the denominator) reflects the recommendations that were and weren’t used.</p>

<p>Currently, the denominator is incorrect. It reflects only the recommendations that weren’t used.</p>
]]></description>
      <!-- <pubDate>Wed, 17 Sep 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Reporting</title>
      <link>https://developers.liveperson.com/conversation-assist-reporting.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-reporting.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="report-descriptions">Report descriptions</h3>

<p>Conversation Assist automatically generates a series of reports on the performance of your solution.</p>

<p><img class="fancyimage" style="width:800px" alt="List of reports" src="img/agentassist/reports1.png" /></p>

<p>The reports include:</p>

<ul>
  <li><strong>Agent Summary</strong>: Use this report to understand how often answer and bot recommendations are being offered in conversations, and how often your agents are using them. This gives you high-level insight into the adoption rate of recommendations by your agents. <em>Your call to action</em>: Use the report to evaluate trends over time and look for opportunities for either agent training, answer/bot tuning, or both.</li>
  <li><strong>KB Agent Feedback</strong>: Use this report to understand when your agents are submitting feedback on specific answer recommendations. Was the feedback positive or negative? Was the recommendation used? Was the answer modified, and, if so, how? This report answers all of these questions. <em>Your call to action</em>: Zero in on the negative feedback and answer modifications made by your agents to learn where opportunities exist for tuning the answers to improve their relevancy or accuracy.</li>
  <li><strong>KB Summary</strong>: This report gives you overall insight into the performance of a knowledge base in your Conversation Assist solution. Learn which articles were offered as answer recommendations the most. And of those, which were used by agents the most. <em>Your call to action</em>: Use the report to understand which articles have a high adoption rate, which is likely due to strong relevancy and accuracy. Invest time and resources in keeping these articles current.</li>
  <li>
    <p><strong>KB Usage</strong>: This is a great report for understanding which answer recommendations were offered (inline) in conversations or in the On-Demand Recommendations widget, and whether they were used by your agents. The report also indicates whether the agent modified the answer. <em>Your call to action</em>: Use the report to learn whether the answers were recommended based on the consumer’s query or the agent’s on-demand query. Consumer queries give you insight into what your consumers are asking. On-demand queries give you insight into which answers are explicitly sought by agents.</p>

    <p>If you’re <a href="conversation-assist-key-terms-concepts-answer-recommendations.html#user-queries-contextualize">enhancing the consumer’s query using conversation context</a> prior to searching the knowledge base for an answer, use the info in the report to understand if the knowledge base is returning the right answer recommendations based on those enhanced queries.</p>

    <p>If you’re using <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">answers that are enriched via an LLM</a>, use the report to understand whether the enriched answers were used as is, and compare them to unenriched answers that were and weren’t modified by the agent. This helps you to evaluate the effectiveness of your Generative AI solution.</p>
  </li>
  <li><strong>Bot Agent Feedback</strong>: Use this report to understand when your agents are submitting feedback on specific bot recommendations. Was the feedback positive or negative? Was the recommendation used? This report answers these questions. <em>Your call to action</em>: Zero in on the negative feedback submitted by your agents to learn where opportunities exist for tuning the bots to improve their relevancy or accuracy.</li>
  <li><strong>Bot Summary</strong>: This report gives you overall insight into the performance of a bot in your Conversation Assist solution. Learn which bots were offered as recommendations the most. And of those, which were used by agents the most. <em>Your call to action</em>: Use the report to understand which bots have a high adoption rate, which is likely due to strong relevancy and accuracy. Invest time and resources in keeping these bots current and stable.</li>
  <li><strong>Bot Usage</strong>: This is a great report for understanding which bot recommendations were offered (inline) in conversations or in the On-Demand Recommendations widget. <em>Your call to action</em>: Use the report to learn whether the bots were recommended based on the consumer’s utterance or the agent’s on-demand query. On-demand queries give you insight into which bots are explicitly sought by agents.</li>
</ul>

<p>While the Home dashboard is great for getting a high-level view of performance, the reports are designed to let you dive deep into the data. Use them to learn more about agent usage and the effectiveness of your knowledge bases and bots.</p>

<p>For example, assume you see from the dashboard that your agents aren’t using recommendations that much. If so, the <strong>Agent Summary</strong> report in particular is of use to you: Use it to see which agents are using recommendations and how frequently.</p>

<p>Overall, if you manage agent operations or you manage the recommendations from your bots and knowledge bases, you’ll find the reports of interest. Daily, weekly, and monthly reports are available. The weekly reports likely mirror your brand’s weekly operational metrics, so they might be most helpful. The daily reports give you the chance to dig deeper into a specific point in time.</p>

<h3 id="report-retention">Report retention</h3>

<ul>
  <li>Daily reports are stored for 14 days.</li>
  <li>Weekly reports are stored for 12 weeks.</li>
  <li>Monthly reports are stored for 13 months.</li>
</ul>

<h3 id="access-and-download-reports">Access and download reports</h3>

<p class="attn-note">Only users with the Admin role can download reports.</p>

<ol>
  <li><a href="conversation-assist-overview.html#access-conversation-assist">Access Conversation Assist</a>, and click <strong>Reports</strong> from the menu at the top.</li>
  <li>
    <p>Use the filters on the left to display the reports you want.</p>

    <p><img class="fancyimage" style="width:300px" alt="Filter options" src="img/agentassist/reports2.png" /></p>
  </li>
  <li>Do either of the following:
    <ul>
      <li>To download a single report, click its <strong>Download</strong> link.</li>
      <li>To download multiple reports, select them and click the <strong>Download all</strong> link at the top of the table.</li>
    </ul>
  </li>
</ol>

<h3 id="use-agent-feedback-reports-to-tune-answers-and-bots">Use agent feedback reports to tune answers and bots</h3>

<p>Feedback from your agents is vital to help you optimize your Conversation Assist solution. You need it to help you to tune your underlying recommendation sources (knowledge bases and bots) as needed.</p>

<p>The "agent feedback" reports capture the thumbs up and thumbs down feedback of your agents on recommended answers and bots. When your agents do this:</p>

<p><img class="fancyimage" style="width:600px" alt="A snapshot of an example KB Usage report with a callout to the three mentioned columns" src="img/agentassist/agent_feedback1.png" /></p>

<p>You’ll see this feedback in the agent feedback reports, along with other useful data. Use the info to help you tune your supporting knowledge base articles and bots.</p>

<p>Here’s an example of an agent feedback report on recommended answers:</p>

<p><img class="fancyimage" style="width:800px" alt="A snapshot of an example KB Usage report with a callout to the three mentioned columns" src="img/agentassist/agent_feedback2.png" /></p>

<p>And here’s an example of an agent feedback report on recommended bots:</p>

<p><img class="fancyimage" style="width:800px" alt="A snapshot of an example KB Usage report with a callout to the three mentioned columns" src="img/agentassist/agent_feedback3.png" /></p>

<p><a href="conversation-assist-setup-configure-settings.html#agent-feedback">Learn how to turn on the agent feeback feature.</a></p>
]]></description>
      <!-- <pubDate>Mon, 08 Sep 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Predefined Content as Answer Recommendations</title>
      <link>https://developers.liveperson.com/conversation-assist-key-terms-concepts-predefined-content-as-answer-recommendations.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-key-terms-concepts-predefined-content-as-answer-recommendations.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>Predefined content is a subset of content that’s typically stored in your CMS or KMS. They’re ready-made responses that you’ve vetted and categorized to address common consumer queries in conversations. Here are some examples:</p>

<ul>
  <li><strong>Greeting</strong>: Hello, how can I assist you?</li>
  <li><strong>Conversational</strong>: Thank you for waiting.</li>
  <li><strong>Research Required</strong>: Sure thing! Let me just grab a bit more info to give you the best answer. Hang tight for a couple of minutes—I’ll be right back!</li>
  <li><strong>Privacy</strong>: This chat service collects only standard website data before starting. Once you accept, chats are monitored for quality assurance and used internally only.</li>
  <li><strong>Abuse</strong>: I’m here to assist you, but please use respectful language. Inappropriate language may result in ending the chat. Thank you for understanding.</li>
  <li><strong>Closing</strong>: Thank you for visiting. Please contact us again at any time.</li>
</ul>

<h3 id="benefits-of-predefined-content">Benefits of predefined content</h3>

<p>Maintaining predefined content is valuable because it saves your agents time during conversations. It also helps to ensure their responses are consistent, error-free, match your brand’s voice, and meet your brand’s compliance regulations. What’s more, predefined content helps you to onboard new agents more quickly.</p>

<p><a href="knowledgeai-key-terms-concepts-predefined-content.html#benefits-of-storing-predefined-content-in-knowledgeai">Learn about the benefits of storing predefined content in KnowledgeAI.</a></p>

<h3 id="approaches-to-exposing-predefined-content">Approaches to exposing predefined content</h3>

<p>Predefined content is made available to agents in the Agent Workspace.</p>

<p>There are three different ways that you can expose it:</p>

<ul>
  <li>Option 1 <strong>(Recommended)</strong> - In the <strong>Answers &amp; Bots</strong> tab of Conversation Assist’s On-Demand Recommendations widget</li>
  <li>Option 2 - In the <strong>Replies</strong> tab of Conversation Assist’s On-Demand Recommendations widget</li>
  <li>Option 3 - In the Predefined Content widget</li>
</ul>

<p>LivePerson recommends option 1, as options 2 and 3 have several challenges:</p>

<ul>
  <li><strong>Static content</strong>: The predefined content doesn’t adapt to evolving conversations.</li>
  <li><strong>Manual selection</strong>: The agent must search for responses, which adds friction to their workflow.</li>
  <li><strong>Lack of personalization</strong>: The responses can’t be tailored to the conversation’s context or the consumer’s intent or sentiment.</li>
  <li><strong>Lack of reporting and insights</strong>: This is fragmented across different tools, making it more difficult to assess the effectiveness of the content.</li>
  <li><strong>Can’t optimize or update easily</strong>: There are no tools to assess how well the content is working or to check for redundant (similar) content.</li>
</ul>

<h3 id="option-1-answers--bots-tab-in-conversation-assist-widget">Option 1: Answers &amp; Bots tab in Conversation Assist widget</h3>

<p>This option is the most powerful and flexible. As such, it’s the one recommended by LivePerson.</p>

<p>With option 1, there are even more choices for where the predefined responses are exposed to agents:</p>

<ul>
  <li><strong>Exposure in the conversation</strong>: You can offer predefined responses as <a href="conversation-assist-key-terms-concepts-basic-concepts.html">answer recommendations</a> right in the conversation. Use LivePerson AI to automatically recommend predefined responses based on the <em>consumer’s query</em>.</li>
  <li><strong>Exposure in Conversation Assist’s On-Demand Recommendations widget</strong>: Sometimes, your agents need to be able to look up predefined responses on demand, regardless of what the consumer just said. You can offer predefined responses as answer recommendations based on the <em>agent’s query</em>. In this case, your agents find and use them on the <a href="conversation-assist-key-terms-concepts-basic-concepts.html#two-places-in-the-conversation-versus-in-the-widget">Bots &amp; Answers tab in the widget</a>.</li>
</ul>

<h4 id="why-migrate-to-option-1">Why migrate to Option 1?</h4>

<p>Take advantage of the following:</p>

<ul>
  <li>Set up highly flexible Conversation Assist rules that govern the behavior: You can <a href="conversation-assist-key-terms-concepts-answer-recommendations.html#user-queries-contextualize">enhance the consumer’s query using conversation context</a>, <a href="conversation-assist-key-terms-concepts-answer-recommendations.html#answers-enrich-via-generative-ai">enrich the answer recommendation</a> (i.e., the predefined response) via Generative AI, and more.</li>
  <li>Retrieve the predefined content using KnowledgeAI’s powerful <a href="knowledgeai-key-terms-concepts-search-methods.html">AI Search</a>.</li>
  <li>Offer predefined content in conversations, in Conversation Assist’s On-Demand Recommendations widget, or both.</li>
  <li>Use Conversation Assist’s <a href="conversation-assist-reporting.html">reports</a> to measure success.</li>
</ul>

<h4 id="setup-for-option-1">Setup for Option 1</h4>

<ol>
  <li><strong>In KnowledgeAI</strong>: <a href="knowledgeai-key-terms-concepts-predefined-content.html#add-predefined-content-to-a-knowledge-base">Store the predefined content in a knowledge base</a> (<a href="knowledgeai-internal-knowledge-bases-integrate-a-kms-or-cms.html">learn how to integrate your CMS</a>).</li>
  <li><strong>In Conversation Assist</strong>: <a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">Create flexible and powerful rules</a> that determine when the predefined responses are offered, whether they’re enriched via Generative AI, where they’re offered, and more.</li>
</ol>

<h4 id="reporting-on-option-1">Reporting on Option 1</h4>

<p>Review reporting on “predefined content” answer recommendations just like you do other answer recommendations:</p>

<ul>
  <li><strong>In KnowledgeAI</strong>: Review the <a href="knowledgeai-optimizing-your-content-optimize-via-dashboard-analysis.html">dashboard on the home page</a> to understand overall knowledge base and article performance. Then dive into the dashboard for the individual knowledge base that contains the predefined content for more specific usage info.</li>
  <li><strong>In Conversation Assist</strong>: Review the <em>Agent Summary</em> report and all of the <a href="conversation-assist-reporting.html">“KB”-specific reports</a> to learn whether and how much your agents are using the answer recommendations. You can also coach your agents and actively solicit their feedback on content quality and accuracy, and then analyze that feedback in the KB Agent Feedback report. Agents’ input has proven instrumental for many brands in optimizing their content and strengthening agent training programs.</li>
</ul>

<h3 id="option-2-replies-tab-in-conversation-assist-widget">Option 2: Replies tab in Conversation Assist widget</h3>

<p>This option is well-suited for brands that <strong>already</strong> have their predefined content stored in Campaign Builder but are using Conversation Assist too. In this case, you don’t want to use 2 different widgets, as you want to conserve space in the Agent Workspace used by your agents.</p>

<p>With this option, you expose Conversation Assist’s On-Demand Recommendations widget to your agents. If your predefined content is stored in Campaign Builder, the content is automatically made available on the <strong>Replies</strong> tab.</p>

<p><img width="800" src="img/agentassist/ca_repliestab.png" alt="The Replies tab in the On-Demand Recommendations widget" /></p>

<h4 id="limitations-of-option-2">Limitations of Option 2</h4>

<p>This option doesn’t leverage AI to suggest responses to agents. A simple keyword search is used. Also, there’s no reporting that captures agent usage.</p>

<h4 id="setup-for-option-2">Setup for Option 2</h4>

<ol>
  <li>Ensure your existing predefined content is already in Campaign Builder.</li>
  <li>In Conversation Assist, <a href="conversation-assist-setup-configure-settings.html#on-demand-recommendations-widget">turn on display of the On-Demand Recommendations widget</a> in the Agent Workspace.</li>
</ol>

<h3 id="option-3-predefined-content-widget-legacy">Option 3: Predefined Content widget (legacy)</h3>

<p>Historically, brands have made their predefined content available to agents <strong>via the Predefined Content widget</strong>. But with the introduction of LivePerson’s AI solution a while back—namely, Conversation Assist’s answer recommendations powered by KnowledgeAI™—the <a href="https://knowledge.liveperson.com/customizing-predefined-content">Predefined Content widget</a> is now a legacy widget.</p>

<p>LivePerson intends to continue to enhance <strong>only</strong> the On-Demand Recommendations widget, which is a key feature in our Copilot Assist solution. So, if you’re not already using the Predefined Content widget, we don’t recommend that you start.</p>

<h4 id="setup-for-option-3">Setup for Option 3</h4>

<p>To learn more about this option, including info on setup, see the <a href="https://knowledge.liveperson.com/customizing-predefined-content">Predefined Content widget article</a>.</p>

<h3 id="faqs">FAQs</h3>

<h4 id="can-i-offer-predefined-content-to-my-agents-via-both-conversation-assist-and-the-predefined-content-widget">Can I offer predefined content to my agents via both Conversation Assist and the Predefined Content widget?</h4>

<p>Using both approaches at the same time is not supported. To do so, you must maintain the content in two, different sources (KnowledgeAI and Campaign Builder), and this isn’t desirable for many reasons:</p>

<ul>
  <li><strong>Cost</strong>: Maintaining the content in two locations costs you more in terms of time and resources.</li>
  <li><strong>Accuracy</strong>: Dual maintenance is error-prone.</li>
  <li><strong>Agent experience</strong>: You don’t want to present to your agents multiple instances of predefined content for a single topic. This increases their cognitive load when they should be focusing on your consumer.</li>
  <li><strong>Adoption tracking and reporting</strong>: You want consolidated reporting on your agents’ use of your predefined content. If you use both approaches, the info is available across multiple reports: There are reports for Conversation Assist, and there are reports for the Predefined Content widget. Disparate reports make it hard to analyze the data and glean actionable insights.</li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 08 Sep 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Copilot Assist - Offer Enriched Answer Recommendations</title>
      <link>https://developers.liveperson.com/conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note">Not ready to make use of Generative AI and LLMs? No problem. You don't need to incorporate these technologies into your solution. The choice is yours: Use Conversation Assist with or without Generative AI.</p>

<h3 id="introduction">Introduction</h3>

<p>If you’re using Conversation Assist to offer answer recommendations to your agents, you can offer ones that are enriched by KnowledgeAI's LLM-powered answer enrichment service. We call this offering Copilot Assist. The resulting answers, formulated via Generative AI, are:</p>

<ul>
  <li>Grounded in knowledge base content</li>
  <li>Contextually aware</li>
  <li>Natural-sounding</li>
</ul>

<p><img width="800" src="img/agentassist/genai_agentexp.png" alt="An example of enriched answers being offered to an agent inline in a conversation, as well as via the On-Demand Recommendations widget" /></p>

<h3 id="language-support">Language support</h3>

<p><a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#language-support">Learn about language support.</a></p>

<h3 id="get-started">Get started</h3>

<ol>
  <li><a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Learn about KnowledgeAI's answer enrichment service.</a></li>
  <li><a href="https://community.liveperson.com/kb/articles/1502-get-started-with-our-solution">Activate this Generative AI feature.</a></li>
</ol>

<h3 id="turn-on-enriched-answers">Turn on enriched answers</h3>

<p>You turn on enriched answers within the <a href="conversation-assist-setup-set-up-knowledge-bases.html#rule-elements---add-ons">add-on of a rule</a>. This means you can turn it on for some scenarios but not others.</p>

<p class="attn-tip">Before you begin creating knowledge base rules, <a href="conversation-assist-setup-before-you-begin.html">review important setup concepts</a>.</p>

<h3 id="default-prompt">Default prompt</h3>

<p>To get you up and running quickly, Conversation Assist makes use of a default <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#enrichment-prompts">Enrichment prompt</a>. An Enrichment prompt is required, and we don't want you to have to spend time on selecting one when you're just getting started and exploring.</p>

<p>Here's the default prompt that Conversation Assist passes to KnowledgeAI when requesting enriched answers:</p>

<p><img width="800" src="img/agentassist/genai_defaultprompt.png" alt="The default prompt for knowledge recommendation sources in Conversation Assist" /></p>

<p class="attn-note">In your <a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">knowledge base-related rules</a>, use the default prompt for a short time during exploration. But be aware that LivePerson can change it without notice, altering the behavior of your solution accordingly. To avoid this, at your earliest convenience, duplicate the prompt and use the copy, or select another prompt from the Prompt Library.</p>

<p class="attn-tip">You can learn more about the default prompt by reviewing its description in the Prompt Library.</p>

<h3 id="select-a-prompt">Select a prompt</h3>

<p>You select the prompt to use within the <a href="conversation-assist-setup-set-up-knowledge-bases.html#rule-elements---add-ons">add-on of a rule</a>. This means you can use one prompt in one scenario but a different prompt in another.</p>

<p>The process of selecting or changing a prompt is the same for the <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#enrichment-prompts">Enrichment prompt</a> (required) and <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#no-article-match-prompts">No Article Match prompt</a> (optional).</p>

<ol>
  <li>In the add-on of the rule, select the existing prompt to open the Prompt Library.</li>
  <li>
    <p>Do one of the following:</p>

    <ul>
      <li>If you're currently using the default system prompt, click <strong>Select from library</strong> in the lower-right corner.</li>
      <li>If you're using one of your own prompts, click <strong>Go to library</strong> in the lower-left corner.</li>
    </ul>

    <p>By default, your prompts are listed in the Select Prompt window.</p>
  </li>
  <li>In <strong>My Prompts</strong>, select the prompt that you want to use.</li>
  <li>Click <strong>Select</strong>.</li>
</ol>

<p><img style="width:800px" src="img/agentassist/promptSelect.gif" alt="Changing the prompt to use in the interaction" /></p>

<p class="attn-note">Since you're accessing the Prompt Library from Conversation Assist, the system filters the available prompts to just those where the client type is "Conversation Assist."</p>

<h3 id="create-or-edit-a-prompt">Create or edit a prompt</h3>

<p class="attn-alert">When you need to create or edit a prompt, make sure to open the Prompt Library via the <a href="conversation-assist-setup-set-up-knowledge-bases.html#rule-elements---add-ons">add-on of a rule</a> within Conversation Assist. Don’t open the Prompt Library via another application like Conversation Builder or KnowledgeAI. If you do, your new or updated prompt won’t be available for use back in Conversation Assist. This is because Conversation Assist isn’t yet fully updated to reflect recent enhancements to the Prompt Library. But stay tuned; soon this constraint won’t exist!</p>

<p><a href="trustworthy-generative-ai-prompt-library-manage-prompts.html">Learn about creating, editing, and copying prompts.</a></p>

<h3 id="agent-experience">Agent experience</h3>

<p><img width="800" src="img/agentassist/genai_agentexp.png" alt="An example of enriched answers being offered to an agent inline in a conversation, as well as via the On-Demand Recommendations widget" /></p>

<h3 id="hallucination-handling">Hallucination handling</h3>

<p><a href="trustworthy-generative-ai-prompt-library-key-terms-concepts.html#hallucinations">Hallucinations</a> in LLM-generated responses happen from time to time, so a Generative AI solution that’s trustworthy requires smart and efficient ways to handle them.</p>

<p>When returning answers to Conversation Assist, by default, KnowledgeAI takes advantage of our LLM Gateway’s ability to <a href="trustworthy-generative-ai-llm-gateway.html#how-hallucinations-are-handled">mark hallucinated URLs, phone numbers, and emails</a>. This is done so that the client application—in this case, Conversation Assist—can understand where the hallucination is located in the response and handle it as required.</p>

<p>For its part, when Conversation Assist receives a recommended answer that contains a marked hallucination (URL, phone number, or email address), it automatically masks the hallucination and replaces it with a placeholder for the right info. These placeholders are visually highlighted for agents, so they can quickly see where to take action and fill in the right info.</p>

<p><img width="500" alt="A hallucinate that's been removed with the placeholder highlighted for the agent" src="img/agentassist/hallucinationHandling1.png" /></p>

<p>Check out our animated example below: A hallucinated URL has been detected and masked. The agent sees the placeholder, enters the right URL, and sends the fixed response to the consumer.</p>

<iframe src="https://player.vimeo.com/video/1077413353?h=85eef75331" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p class="attn-tip">To make quick work of filling in placeholders, make your contact info available as <a href="https://community.liveperson.com/kb/articles/1382-predefined-content-overview">predefined content</a>. This exposes the content on the <strong>Replies</strong> tab in the On-Demand Recommendations widget. The agent can copy the info with a single click and paste it where needed. We’ve illustrated this in our animation above.</p>

<h3 id="best-practices">Best practices</h3>

<h4 id="train-your-agents">Train your agents</h4>

<p>Train your agents on the difference between regular answer recommendations and enriched answer recommendations, the need to review the latter with care, and the reasons why. Similar important guidance is offered in the UI:</p>

<p><img width="450" src="img/agentassist/genai_trainagents1.png" alt="The tooltip for an enriched answer that guides the agent to review for accuracy and appropriateness before sending the answer" /></p>

<p>Your agents are able to edit enriched answers before sending them to consumers.</p>

<p><img width="400" src="img/agentassist/genai_trainagents2.png" alt="The tooltip for an enriched answer offered via the On-Demand Recommendations widget, where the tooltip indicates the agent can edit the answer before sending" /></p>

<h4 id="more-best-practices">More best practices</h4>

<p>See the general <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#best-practices">KnowledgeAI best practices on using our enrichment service</a>.</p>

<h3 id="reporting">Reporting</h3>

<p>Use the <strong>Generative AI Dashboard</strong> in Conversational Cloud's Report Center to make data-driven decisions that improve the effectiveness of your Generative AI solution.</p>

<p><img style="width:800px" src="img/ConvoBuilder/genai_reportingdashboard.png" alt="A view of the Generative AI Reporting dashboard" /></p>

<p>The dashboard helps you answer these important questions: </p>

<ul>
  <li><em>How is the performance of Generative AI in my solution?</em> </li>
  <li><em>How much is Generative AI helping my agents and bots?</em></li>
</ul>

<p>The dashboard draws conversational data from all channels across Voice and Messaging, producing actionable insights that can drive business growth and improve consumer engagement.</p>

<p class="attn-tip">Access Report Center by clicking <strong>Optimize &gt; Manage</strong> on the left-hand navigation bar.</p>

<h3 id="limitations">Limitations</h3>

<h4 id="limitations-on-rule-setup">Limitations on rule setup</h4>

<p>A single rule can't contain a mix of knowledge bases that enrich answers via Generative AI and knowledge bases that don't do this. Don't set up a rule this way, not even if you put one type in one add-on and another type in another add-on within the same rule. Instead, set up different rules assigned to different skills to support your use case.</p>

<h4 id="limitations-on-rich-answers">Limitations on rich answers</h4>

<p>Answer recommendations that are enriched via Generative AI can be plain answers, or they can be rich answers that contain an image and links (<a href="conversation-assist-setup-configure-settings.html#rich-content">see an example</a>).</p>

<p>Rich answers that are also enriched via Generative AI are supported. However, be aware that sometimes the generated answer from the LLM might not perfectly align with the image/links associated with the highest-scoring article, which are what are used.</p>

<p class="attn-note"><a href="conversation-assist-setup-configure-settings.html#rich-content">Rich content</a> only appears in an enriched answer when the generated answer is based on an article that has specified content links: content URL, audio URL, image URL, or video URL.</p>

<h3 id="faqs">FAQs</h3>

<h4 id="what-llm-is-used">What LLM is used?</h4>

<p>To learn which LLM is used by default, open the prompt in the Prompt Library, and check the prompt's <strong>Advanced</strong> settings.</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/genai_kai_bot1.png" alt="The LLM setting on the Advanced tab in a prompt" /></p>

<h4 id="im-offering-bot-recommendations-to-my-agents-and-i-want-those-bots-to-send-answers-that-are-enriched-via-generative-ai-how-do-i-turn-this-on">I'm offering bot recommendations to my agents, and I want those bots to send answers that are enriched via Generative AI. How do I turn this on?</h4>

<p>This configuration is done at the interaction level in the bot, so you do this in LivePerson Conversation Builder, not in Conversation Assist. <a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html">Learn about automating enriched answers.</a></p>

<h4 id="is-there-any-change-to-how-answer-recommendations-are-presented-to-agents">Is there any change to how answer recommendations are presented to agents?</h4>

<p>Yes. For a consistent agent experience, in the Agent Workspace you can always find enriched answers offered first, followed by answers that aren’t enriched, and bots listed last. Within each grouping, the recommendations are then ordered by their confidence scores.</p>

<p>The confidence score shown for the enriched answer recommendation is the confidence score of the highest-scoring article that was retrieved from the knowledge base.</p>

<h4 id="do-hallucinations-affect-the-confidence-scores-of-recommended-answers">Do hallucinations affect the confidence scores of recommended answers?</h4>

<p>No. The answer, i.e., the article, is matched to the consumer’s query and given a confidence score for that match before the answer is enriched by the LLM service. (<a href="#search-flowknowledgeai-key-terms-concepts-search-methods.html#search-flow">Learn about KnowledgeAI’s search flow.</a>)</p>

<p>Enrichment of the answer via Generative AI doesn’t affect the assigned confidence score for the match. Similarly, hallucinations detected in the enriched answer don’t affect the score either.</p>

<h4 id="more-faqs">More FAQs</h4>

<p>See the general <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#faqs">KnowledgeAI FAQs on our enrichment service</a>.</p>

<h3 id="related-articles">Related articles</h3>

<ul>
  <li><a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Enriched Answers via Generative AI</a> (KnowledgeAI)</li>
  <li><a href="trustworthy-generative-ai-prompt-library-overview.html">Prompt Library Overview</a></li>
  <li><a href="conversation-builder-generative-ai-knowledgeai-agents-automate-enriched-answers.html">Automate Enriched Answers via Generative AI</a> (Conversation Builder)</li>
  <li><a href="https://community.liveperson.com/kb/articles/1501-trustworthy-generative-ai-for-the-enterprise">Trustworthy Generative AI for the Enterprise</a></li>
  <li><a href="trustworthy-generative-ai-bring-your-own-llm.html">Bring Your Own LLM</a></li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 08 Sep 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Configure Settings</title>
      <link>https://developers.liveperson.com/conversation-assist-setup-configure-settings.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-setup-configure-settings.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>The <strong>Settings</strong> page in Conversation Assist contains settings that are shared by all recommendation sources, or by all recommendation sources of a given type (bots or knowledge bases).</p>

<p class="attn-note">After changing settings, <a href="conversation-assist-setup-clear-the-recommendations-cache.html">clear the recommendations cache</a>. Additionally, your agents might need to refresh the browser or log in again.</p>

<h3 id="suspendresume-recommendations">Suspend/Resume recommendations</h3>

<p>This setting applies to all recommendation sources.</p>

<p><img width="600" alt="Suspend setting" src="img/agentassist/settings_general2.png" /></p>

<p>When this setting is on (blinking green), Conversation Assist recommends answers and bots inline in conversations. Click the toggle to suspend or resume recommendations globally.</p>

<h3 id="max--of-recommendations">Max # of recommendations</h3>

<p>Set the maximum number of recommendations (answers <strong>plus</strong> bots) that Conversation Assist offers at one time. The default value is 3.</p>

<p><img width="600" alt="Max number of recommendations setting" src="img/agentassist/settings_general.png" /></p>

<p><a href="conversation-assist-key-terms-concepts-basic-concepts.html#how-recommendations-are-offered">Learn how recommendations are made.</a></p>

<h3 id="on-demand-recommendations-widget">On-Demand Recommendations widget</h3>

<p>Your agents can <a href="conversation-assist-agent-experience-messaging.html">use this widget</a> to look up bots, knowledge answers, and <a href="https://community.liveperson.com/kb/articles/1382-predefined-content-overview">predefined content</a> (replies to greetings, closings, etc.) on demand in the Agent Workspace. The widget respects the <a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">knowledge base-level configuration rules</a> and <a href="conversation-assist-setup-set-up-bots.html#step-4-create-bot-level-recommendation-rules">bot-level configuration rules</a> that you’ve set up.</p>

<p><img width="800" alt="On-Demand Recommendation on and off setting" src="img/agentassist/settings_ondemandrecs.png" /></p>

<h4 id="configure-the-widgets-visibility">Configure the widget's visibility</h4>

<ul>
  <li>To show the widget in the Agent Workspace, select “On.” To hide it, select “Off.”</li>
</ul>

<p>If you turn on the widget:</p>

<ul>
  <li>It’s likely you will want to hide the Predefined Content widget, so it doesn’t appear in the Agent Workspace. This is because the Predefined Content widget also makes available predefined content, so it’s redundant. Consider the On-Demand Recommendations widget your one-stop shop that assists agents with their conversations.</li>
  <li>Have your Conversational Cloud admin reposition this widget based on the needs of your agents.</li>
</ul>

<h4 id="limit-visibility-to-specific-skills">Limit visibility to specific skills</h4>

<ul>
  <li>Configure which of your agents see the widget: To show the widget to agents assigned to all skills, leave the skill-selection field empty; it’s empty by default. To show the widget only to specific skills, select those skills.</li>
</ul>

<h4 id="show-or-hide-predefined-content">Show or hide predefined content</h4>

<p>This setting shows or hides the <strong>Replies</strong> tab in the On-Demand Recommendations widget. The <strong>Replies</strong> tab offers <a href="conversation-assist-key-terms-concepts-predefined-content-as-answer-recommendations.html">predefined content</a> in response to the agent’s query. Predefined content is a set of canned responses (replies) for common use cases: greetings, closings, and so on.</p>

<p>If you don’t have any predefined content to show to agents, we recommend that you set this to HIDE. It simplifies the UI for your agents.</p>

<p>If you do have predefined content and it’s stored and managed via knowledge bases in KnowledgeAI, set this to HIDE. There’s no need to show the <strong>Replies</strong> tab, as your predefined content is offered via the <strong>Answers &amp; Bots</strong> tab according to the (highly flexible) knowledge base rules that you’ve set up in Conversation Assist.</p>

<p>Conversely, if your predefined content is stored and managed elsewhere in Conversational Cloud, and you want to offer it to agents via the On-Demand Recommendations widget, set this to SHOW.</p>

<p><a href="conversation-assist-key-terms-concepts-predefined-content-as-answer-recommendations.html">Learn more about using predefined content in Conversation Assist.</a></p>

<h3 id="inline-recommendations">Inline recommendations</h3>

<p>Turn on this setting to offer recommended bots and answers "in line" <strong>in conversations</strong> with consumers. The default value is On.</p>

<p><img width="500" alt="On and off setting named Inline recommendations" src="img/agentassist/settings_inlinerecs.png" /></p>

<h3 id="agent-feedback">Agent feedback</h3>

<p>Turn on this setting to allow your agents to <a href="conversation-assist-agent-experience-messaging.html#provide-feedback-on-inline-recommendations">provide "thumbs up" and "thumbs down" feedback on recommendations</a>.</p>

<p><img width="600" alt="On and off setting named Agent Feedback" src="img/agentassist/settings_agentfeedback.png" /></p>

<h3 id="answer-recommendations">Answer recommendations</h3>

<h4 id="rich-content">Rich content</h4>

<p>Consider turning on the <strong>Rich content</strong> setting if you’re using knowledge bases as recommendation sources.</p>

<p><img width="600" alt="Rich content on and off setting" src="img/agentassist/settings_richcontent.png" /></p>

<p>When this setting is Off, the agent can send a plain text answer that includes just the article’s summary.</p>

<p>When this setting is On, the agent can choose the type of answer to send: plain or rich. A rich answer includes the article’s image, summary, content link, video link, and audio link, as available in the article.</p>

<p class="attn-note">Currently, rich answer recommendations are supported only on the Web and Mobile SDK channels.</p>

<h5 id="recommended-rich-answer-offered-in-line-in-the-conversation">Recommended rich answer offered in-line in the conversation</h5>

<p><img width="700" alt="Rich answers being offered to the agent along with plain answers, inline in a conversation" src="img/agentassist/richcontent_inline.png" /></p>

<h5 id="recommended-rich-answer-offered-on-demand">Recommended rich answer offered on demand</h5>

<p><img width="500" alt="Rich answers being offered to the agent along with plain answers, via the On-Demand Recommendations widget" src="img/agentassist/richcontent_ondemand.png" /></p>

<h5 id="important-info-about-rich-answer-recommendations">Important info about rich answer recommendations</h5>

<ul>
  <li>Considering supporting rich answers. Their multimedia nature makes them much more engaging than plain answers, leading to a best-in-class experience for the consumer.</li>
  <li>The above said, if you’re using <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">answer recommendations that are enriched via Generative AI</a>, be aware that answers that are <em>both</em> rich (have multimedia) and enriched (generated via Generative AI) are <em>supported but not recommended</em>. This is because the generated answer might not align well substantively with the rich content associated with the highest scoring article, which is what is used.</li>
  <li>Currently, rich answer recommendations are supported only on the Web and Mobile SDK channels.</li>
  <li>The decision to turn on support is made at the account level, not at the recommendation source level. In other words, you can’t turn on support for knowledge base A but not for knowledge base B.</li>
  <li>Before you turn on support, <strong>whitelist the domains</strong> in all URLs for the images, videos, and audio files in the articles that might be served as answers. Contact LivePerson Support to assist with this.</li>
  <li>After you turn on support, answer recommendations are shown in both plain and rich format. (There are some <a href="#limitationsconversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html#limitations">limitations</a> if the answers are enriched via Generative AI.) The agent can view both formats and make a proper choice about which to send.</li>
  <li>All plain answers can be edited before sending them. The text in rich answers offered via the On-Demand Recommendations widget can also be <a href="conversation-assist-agent-experience-messaging.html#edit-a-rich-answer-offered-on-demand">edited</a>. The text in rich answers offered inline in conversations isn't editable.</li>
  <li>In a rich answer:
    <ul>
      <li>The link text isn’t editable, nor is the order of the links.</li>
      <li>The language of the link text depends on the language being used by the agent. It’s the language that is set in their Conversational Cloud profile.</li>
    </ul>
  </li>
</ul>

<h3 id="bot-recommendations">Bot recommendations</h3>

<h4 id="bot-messages">Bot messages</h4>

<p>Customize the <strong>bot messages</strong> if you’re using bots as recommendation sources. The messages are sent to the consumer when the bot is added to and removed from a conversation. They help consumers to understand when a bot is involved in a conversation.</p>

<p><img width="800" alt="The settings for customizing the two messages that are sent when a bot is added to and removed from a conversation" src="img/agentassist/settings_botmessages.png" /></p>

<p class="attn-note">There is no option to disable these automatic messages.</p>

<h4 id="sound-notifications-for-private-messages-only">Sound notifications for private messages only</h4>

<p>In automated conversations, you only want your agents to hear the sound notifications that matter. Turn this on to reduce the noise and surface important ones.</p>

<p><img width="800" alt="The on off setting named Sound notifications for private messages only" src="img/agentassist/settings_privmsgnotifications.png" /></p>

<p>If On, sound notifications are sent only for private messages to agents. If Off, they're sent for all messages sent by the bot and the consumer.</p>
]]></description>
      <!-- <pubDate>Mon, 08 Sep 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Bot Recommendations</title>
      <link>https://developers.liveperson.com/conversation-assist-key-terms-concepts-bot-recommendations.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-key-terms-concepts-bot-recommendations.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>Bot recommendations are relevant automations that agents can use to resolve consumer queries.</p>

<p><img width="800" alt="Example conversation with agent, showing two recommendations offered, one an answer, the other a bot, with a callout to the bot recommendation" src="img/agentassist/recs_types_bot.png" /></p>

<p>When bot recommendations are used, the agent is freed up to handle other queries that require a human touch. Agent productivity is thereby improved, as are conversational outcomes and overall operational metrics for the contact center.</p>

<p>This topic discusses important concepts related to bot recommendations.</p>

<h3 id="delegating-conversations-to-bots">Delegating conversations to bots</h3>

<p>When a bot is recommended to an agent, the agent can delegate the conversation to the bot. The agent stays in the conversation, so they can monitor the bot’s progress and remove the bot if needed.</p>

<p><img width="550" alt="The conversation flow when a bot is joined to the conversation" src="img/agentassist/use_bot.png" /></p>

<p>When the agent delegates the conversation to the bot, <strong>the query that triggered the bot recommendation</strong> is passed to the bot in order to start the most relevant dialog. That utterance is checked against <strong>both</strong> the patterns and intents in the bot's dialog starters. A dialog is triggered according to the <a href="conversation-builder-interactions-dialog-starter.html#faqs">rules for dialog starters in Conversation Builder bots</a>.</p>

<p>The above is the case regardless of whether the bot was recommended in the conversation or in the On-Demand Recommendations widget.</p>
]]></description>
      <!-- <pubDate>Mon, 08 Sep 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Basic Concepts</title>
      <link>https://developers.liveperson.com/conversation-assist-key-terms-concepts-basic-concepts.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-key-terms-concepts-basic-concepts.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="two-types-answer-recommendations-and-bot-recommendations">Two types: answer recommendations and bot recommendations</h3>

<p>Two types of recommendations can be offered to your agents:</p>

<ul>
  <li><strong>Answer recommendations</strong>: This is an article in a knowledge base that matches the consumer's query. The agent can send the answer to the consumer.</li>
  <li><strong>Bot recommendations</strong>: This is a bot that matches the consumer's query. The agent can delegate the conversation to the bot.</li>
</ul>

<p><img width="800" alt="Example conversation with agent, showing two recommendations offered, one an answer, the other a bot" src="img/agentassist/recs_types.png" /></p>

<h3 id="two-places-in-the-conversation-versus-in-the-widget">Two places: in the conversation versus in the widget</h3>

<p>Recommendations can be offered in two places:</p>

<ul>
  <li>In the conversation window</li>
  <li>In the On-Demand Recommendations widget</li>
</ul>

<p><strong>In-conversation recommendations</strong> are answers and bots offered automatically, in real time, and in line within the conversation with consumer. They're offered based on the consumer's query or message.</p>

<p><img width="800" alt="Animation showing the agent being offered an answer and a bot to respond to the consumer's query, where the agent selects the answer and sends it to the consumer" src="img/agentassist/recs_inline.gif" /></p>

<p>However, sometimes your agents need more flexibility when handling conversations. Sometimes, they need to be able to look up answers and bots on demand, regardless of what the consumer just said. <strong>On-demand recommendations</strong> offered in the On-Demand Recommendations widget meet this need. These recommendations are offered based on the agent's query, not the consumer's query or message.</p>

<p><img width="800" alt="Animation showing the agent searching on-demand for a recommendation to a particularly consumer query, where the agent selects the answer and sends it to the consumer" src="img/agentassist/recs_ondemand.gif" /></p>

<p>You can offer in-conversation recommendations, on-demand recommendations, or both.</p>

<p><a href="conversation-assist-agent-experience-messaging.html">Learn more about the agent experience.</a></p>

<h3 id="recommendations-are-intent-based">Recommendations are intent-based</h3>

<p>Conversation Assist offers recommendations based on the intent that’s detected. For an in-conversation recommendation, this is the intent detected in the <strong>consumer’s query</strong>. For an on-demand recommendation, this is the intent detected in the <strong>agent's query</strong>.</p>

<p><img width="800" alt="View of the agent workspace with two recommendations being offered to the agent" src="img/agentassist/example.png" /></p>

<h3 id="recommendations-are-skill-based">Recommendations are skill-based</h3>

<p>Recommendations aren’t just intent-based, they’re skill-based too.</p>

<p>When Conversation Assist offers a recommendation, it always does so based on not just the detected intent, but also the <strong>conversation’s assigned skill</strong>. This means you can align your knowledge content and bots to desired skills.</p>

<p class="attn-tip">You also have the option to further limit recommendations to agent groups and/or profiles.</p>

<p class="attn-alert">When in-conversation recommendations are offered to an agent in a conversation assigned to skill A, if the conversation is subsequently transferred to skill B, those recommendations remain available to any agent that picks up that conversation on skill B. This is the case even though recommendations shouldn’t be offered to conversations assigned to skill B, i.e., no configuration rule for skill B exists in Conversation Assist. The recommendations remain available for 24 hours, as the cache of recommendations stored in memory is cleared automatically every 24 hours. We’re actively working on a fix for this issue, so stay tuned!</p>

<h3 id="how-many-recommendations-to-offer">How many recommendations to offer</h3>

<p>You can specify the <a href="conversation-assist-setup-configure-settings.html#max--of-recommendations">maximum number of recommendations</a> (answers <strong>plus</strong> bots) offered by Conversation Assist at one time. You can offer up to 5. The default value is 3.</p>

<p><img width="600" alt="Max number of recommendations setting" src="img/agentassist/settings_general.png" /></p>

<h3 id="how-recommendations-are-offered">How recommendations are offered</h3>

<p><img width="800" alt="Illustration that shows candidate answers and bots being retrieved, sorted by confidence score, and chosen based on the setting that specifies the number of recommendations to offer" src="img/agentassist/process_offer_recs.png" /></p>

<h4 id="step-1-concurrently-retrieve-answers-and-bots">Step 1: Concurrently retrieve answers and bots</h4>

<p><strong>Retrieve answers</strong></p>

<p>The system retrieves answers according to the <a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">rules specified for knowledge bases</a> (min. confidence, etc.).</p>

<p>Answers are retrieved from a knowledge base using the <a href="knowledgeai-key-terms-concepts-search-methods.html#knowledgeai-option">KnowledgeAI search offering</a> to match answers to the query. The number of answers that are returned is as follows:</p>

<ul>
  <li>If you aren't using an LLM to generate answers enriched via Generative AI, Conversation Assist always retrieves (from the results received from KnowledgeAI) just <strong>one, top matched</strong> answer (article) <strong>per</strong> knowledge base.</li>
  <li>If you are using an LLM to generate enriched answers, the system sends the number of articles that you specify in the knowlege base rule to the LLM for an enriched response. In turn, Conversation Assist always retrieves (from the results received from KnowledgeAI) just <strong>one</strong> enriched answer <strong>per</strong> knowledge base. This answer is stored in the <code class="language-html highlighter-rouge">summary</code> of the <strong>top matched</strong> article.</li>
</ul>

<p>The answers that are retrieved are added to a list of candidate recommendations.</p>

<p><strong>Retrieve bots</strong></p>

<p>The system retrieves bots according to the <a href="conversation-assist-setup-set-up-bots.html#step-4-create-bot-level-recommendation-rules">rules specified for bots</a>.</p>

<p>Bots that match the consumer’s (or agent’s) query are retrieved as follows:</p>

<ul>
  <li><strong>LivePerson Conversation Builder bots</strong>: These are retrieved by checking the patterns and intents in the bots’ <a href="conversation-builder-interactions-dialog-starter.html">dialog starters</a> for matches to the query. Intent matches have scores that can and do vary. Conversation Assist filters the results to include only those that meet the <strong>min. confidence</strong> threshold specified in the bot rule.</li>
  <li><strong>Third-party bots</strong>: These are retrieved by checking for a bot that matches the query. Different providers provide different score ranges for intent matches, so Conversation Assist converts them to a universal score range. It then filters the results to include only those that meet the <strong>min. confidence</strong> threshold specified in the bot rule. Be aware that some third-party bots don’t provide intent match scores at all; in such cases, filtering to exclude any bots based on <strong>min. confidence</strong> is not applied.</li>
</ul>

<p>The bots that are retrieved are added to a list of candidate recommendations.</p>

<h4 id="step-2-determine-the-recommendations-to-offer">Step 2: Determine the recommendations to offer</h4>

<p>The system evaluates the candidate lists of answers and bots and chooses those ranked highest by relevance score. The rules for this are as follows:</p>

<ol>
  <li>
    <p><strong>Which recommendations are evaluated?</strong> First, include all answer recommendations. Second, include all bot recommendations. <em>This means that answers are included before bots even when the answer scores are lower than that of the top bot recommendation</em>.</p>
  </li>
  <li>
    <p><strong>How are the recommendations ordered?</strong> Within each subgroup of recommendations (answers, bots), sort the recommendations by confidence score in descending order so that the higher the score, the higher the recommendation.</p>
  </li>
  <li>
    <p><strong>Which recommendations to offer?</strong> Choose the recommendations to offer to the agent based on how the <a href="conversation-assist-setup-configure-settings.html#max--of-recommendations">Maximum number of recommendations</a> setting is configured.</p>
  </li>
</ol>

<p>For example, assume the system has compiled the following final candidate list, sorted below by confidence score:</p>

<ul>
  <li>Answer in knowledge base 1 = 90%</li>
  <li>Answer in knowledge base 2 = 60%</li>
  <li>Bot 1 = 100%</li>
  <li>Bot 2 = 80%</li>
</ul>

<p>If <a href="conversation-assist-setup-configure-settings.html#max--of-recommendations">Maximum number of recommendations</a> is set to 2, then only the answers are recommended to the agent. The agent doesn’t see any bot recommendations because answer recommendations are always included first. But if <a href="conversation-assist-setup-configure-settings.html#max--of-recommendations">Maximum number of recommendations</a> is set to 3, then the two answers and the top-scoring bot are recommended.</p>

<h3 id="how-rules-are-evaluated">How rules are evaluated</h3>

<p>There are two types of rules:</p>

<ul>
  <li><strong>Knowledge base rules</strong>: These determine when answers from a knowledge base are offered as recommendations to agents.</li>
  <li><strong>Bot rules</strong>: These determine when bots are offered as recommendations to agents.</li>
</ul>

<p>In a rule, the add-on completes the rule’s definition. Think of it as the rule’s “predicate.” Adds-on are evaluated in the order listed in the rule, and the first one that’s matched is executed. So it’s important to order the add-ons as you require.</p>

<p>Add-on evaluation works as follows:</p>

<ol>
  <li>
    <p>During the conversation, get some necessary data about the conversation:</p>

    <p>a. What’s the <strong>skill</strong> assigned to the conversation? Retrieve this.<br />
 b. Which <strong>agent groups</strong> and <strong>profiles</strong>, if any, are assigned to the agent? Retrieve these.<br />
 c. Are <a href="conversation-assist-key-terms-concepts-basic-concepts.html#two-places-in-the-conversation-versus-in-the-widget">in-conversation or on-demand</a> recommendations needed? If the agent just entered a message in the On-Demand Recommendations widget, consider it a request for the latter. Otherwise, consider it a request for the former.</p>
  </li>
  <li>
    <p>Use the data retrieved in steps 1 - 3 to find a matching <strong>knowledge base</strong> rule and add-on, if any; retrieve the first match. Also find a matching <strong>bot</strong> rule and add-on, if any; retrieve the first match.</p>
  </li>
</ol>

<p>Once add-on evaluation is done, the retrieved rules are executed: Their add-ons are used to retrieve answers or bots. Finally, the “candidate” answers and/or bots are used to determine which recommendations to offer to the agent. This is described in the preceding section.</p>
]]></description>
      <!-- <pubDate>Mon, 08 Sep 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>User Queries - Custom Process via Generative AI</title>
      <link>https://developers.liveperson.com/knowledgeai-key-terms-concepts-user-queries-custom-process-via-generative-ai.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-key-terms-concepts-user-queries-custom-process-via-generative-ai.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>To make sure consumers get the most accurate and helpful answers, intelligent systems often start by carefully understanding the question or query. The initial processing of the user's query plays a vital role in refining and preparing the input before it's used to search the knowledge base. This process can involve using a Large Language Model (LLM).</p>

<h3 id="how-it-works">How it works</h3>

<p>Custom processing of the user’s query refines and prepares the input before it’s used to search the knowledge base. This ensures that the search is as precise and effective as possible.</p>

<p>You can perform any kind of processing that you require. Use an LLM made available via LivePerson or <a href="trustworthy-generative-ai-bring-your-own-llm.html">use your own</a>.</p>

<p><a href="knowledgeai-key-terms-concepts-search-methods.html#search-flow">Learn where custom processing of the user’s query fits into the overall search flow.</a></p>

<h3 id="use-cases">Use cases</h3>

<p>One great use case for this is if you’re supporting cross-lingual queries (for example, the query is in Spanish, but your knowledge base is in English). In this case, you might want to translate the query into the language of the knowledge base that will be searched for answers. Doing so can improve the search results significantly.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/kai_process_user_query.png" alt="An answer recommendation offered to an agent via Conversation Assist, where the consumer query is in Spanish" /></p>

<h3 id="key-benefits">Key benefits</h3>

<ul>
  <li>Boost the accuracy and relevancy of answers.</li>
  <li>Support a global reach with multi-lingual capabilities.</li>
</ul>

<h3 id="applications-using-this">Applications using this</h3>

<p>Currently, custom processing of the user’s query via Generative AI is only supported by Conversation Assist. <a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">Learn how to turn this on in a knowledge base rule</a> within Conversation Assist.</p>

<h3 id="prompt-templates">Prompt templates</h3>

<p>LivePerson makes available the following related prompt templates in the Prompt Library:</p>

<ul>
  <li>Query Translation - Conversation Assist (Messaging)</li>
  <li>Query Translation - Conversation Assist (Voice)</li>
</ul>

<h3 id="prompt-customization">Prompt customization</h3>

<p>Customizing the prompt? <a href="trustworthy-generative-ai-prompt-library-variables-for-solutions.html#variables-for-solutions-that-custom-process-user-queries">Learn about the variables used in custom processing of user queries.</a></p>

<h3 id="faqs">FAQs</h3>

<h4 id="the-language-of-my-knowledge-base-is-other-how-do-i-handle-this">The language of my knowledge base is “Other.” How do I handle this?</h4>

<p>When creating a knowledge base, there’s a long list of <a href="knowledgeai-key-terms-concepts-language-support.html">available languages</a> that you can choose from. But if the content is in a language that isn’t available, you can select “Other” as the language.</p>

<p>In this case, you’ll need to manually edit the prompt for the LLM so that it explicitly specifies the language of the knowledge base. You can’t use the <a href="trustworthy-generative-ai-prompt-library-variables-for-solutions.html#variables-for-solutions-that-custom-process-user-queries">kb_language variable</a> that’s resolved at runtime.</p>
]]></description>
      <!-- <pubDate>Tue, 26 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Set Up Knowledge Bases</title>
      <link>https://developers.liveperson.com/conversation-assist-setup-set-up-knowledge-bases.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-setup-set-up-knowledge-bases.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note">Just getting started? Complete the <a href="tutorials-use-conversation-assist-overview.html">Using Conversation Assist</a> tutorial.<br /><br />It takes up to 3 hours for changes in Conversation Assist configuration to take effect.</p>

<h3 id="limitations">Limitations</h3>

<p>You can use any type of knowledge base in KnowledgeAI™ as a recommendation source in Conversation Assist. However, keep in mind the following limitations:</p>

<ul>
  <li>"Rich content" answer recommendations aren't supported if the knowledge base is <a href="knowledgeai-external-knowledge-bases-external-kbs-without-liveperson-ai.html">external (without LivePerson AI)</a>.</li>
  <li><a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">LLM-enriched answers</a>: A single rule can't contain a mix of knowledge bases that enrich answers via Generative AI and knowledge bases that don't do this. Don't set up a rule this way, not even if you put one type in one add-on and another type in another add-on within the same rule. Instead, set up different rules assigned to different skills to support your use case.</li>
</ul>

<h3 id="step-1-create-the-kb-and-articles">Step 1: Create the KB and articles</h3>

<p><a href="knowledgeai-overview.html#access-knowledgeai">Access KnowledgeAI</a> and create at least one knowledge base (KB) from your <a href="knowledgeai-key-terms-concepts-basic-concepts.html#content-sources">content source</a> or from scratch. You can create and use any type of knowledge base, and the knowledge base can be public or private.</p>

<p>Also create at least one article therein, so you can verify that your setup is complete and working. You can continue to add more articles at any time after setup.</p>

<p class="attn-note">High-quality knowledge content is critical for ensuring the successful adoption of answer recommendations by your agents. During setup of your knowledge bases, take care to follow our <a href="knowledgeai-best-practices.html">best practices on structuring knowledge bases and adding articles</a>.</p>

<p>At this point, in KnowledgeAI verify that the desired articles are active.</p>

<p class="attn-tip">New to KnowledgeAI and knowledge bases? Check out the <a href="tutorials-bot-groups-other-techniques-meta-intents-knowledge-bases.html">Meta Intents &amp; Knowledge Bases</a> tutorial.</p>

<h3 id="step-2-create-kb-level-recommendation-rules">Step 2: Create KB-level recommendation rules</h3>

<p>In this step, you create the rules that determine when answers from the knowledge base are offered as recommendations to agents.</p>

<ol>
  <li><a href="conversation-assist-overview.html#access-conversation-assist">Access Conversation Assist</a>, and click <strong>Recommendation Sources</strong>.</li>
</ol>

<p>The <strong>Knowledge Bases</strong> tab is displayed by default.</p>

<ol>
  <li>Click <strong>Add rule</strong>.</li>
  <li>Define the rule that determines when answers from the knowledge base(s) are recommended to agents. Each rule element is described farther below.</li>
  <li>Click <strong>Save and activate</strong>.</li>
  <li>Add additional rules as you require.</li>
</ol>

<h4 id="rule-elements---general">Rule elements - general</h4>

<p><img width="800" alt="The section of a knowledge base rule that contains general settings" src="img/agentassist/kb_rule_general.png" /></p>

<ul>
  <li><strong>Name</strong>: Enter a short, meaningful, and unique name that highlights the rule’s basic function and purpose. It's important to name the rule well, so you can leverage reporting effectively.</li>
  <li><strong>Description</strong>: If desired, provide a more in-depth description of the rule: rationale, approach, i.e., anything that’s useful.</li>
  <li>
    <p><strong>Skills</strong>: Select the Conversational Cloud skills that you want this rule to apply to. You must specify at least one skill. A skill can be used in only one knowledge base rule.</p>

    <p>In conversations routed to these skills, articles in the knowledge bases specified in this rule are returned by KnowledgeAI™ to Conversation Assist. (A conversation is routed to the skills assigned to the campaign's engagement.)</p>

    <p>When specifying the skills, <a href="conversation-assist-setup-before-you-begin.html">carefully consider which sets of knowledge you want to expose through each skill serviced by human agents</a>.</p>
  </li>
</ul>

<h4 id="rule-elements---add-ons">Rule elements - add-ons</h4>

<p>A rule add-on completes the rule’s definition. You must define at least one rule add-on because, at a minimum, that’s where you specify the knowledge bases to use in the rule.</p>

<p>If you define multiple add-ons, the order of the add-ons matters: At runtime, the add-ons are evaluated in order, and only the first one that’s matched is executed. So, order the add-ons as you require.</p>

<p><img width="800" alt="An example add-on in a knowledge base rule" src="img/agentassist/kb_rule_addon1.png" /></p>

<p>Each setting is discussed below:</p>

<h5 id="for-agents-belonging-to">For agents belonging to</h5>

<p>You assigned a skill to the rule, but you can further limit recommendations from the knowledge base to specific Conversational Cloud agent groups and/or profiles. Carefully consider which sets of knowledge you want to expose to specific groups and/or profiles. Or, if the rule will be only skill-based, leave these blank.</p>

<h5 id="offer-recommendations">Offer recommendations</h5>

<p>Select where the recommendations should be offered. You can select one of:</p>

<ul>
  <li>In conversations only</li>
  <li>In On-demand widget only</li>
  <li>In conversations and in On-demand widget</li>
</ul>

<p>Keep in mind that agents only receive recommendations in conversations if the <strong>Inline recommendations</strong> setting on Conversation Assist's <strong>Settings</strong> page is turned on. That setting takes precedence over all knowledge base rules.</p>

<h5 id="retrieve-best-articles-from">Retrieve best articles from</h5>

<p>Specify here the knowledge bases to search for matched articles.</p>

<p>Ensure your knowledge bases follow our <a href="knowledgeai-best-practices.html">best practices</a> in terms of both structure and content.</p>

<p>Also specify the minimum confidence score that articles must have to be retrieved. Keep in mind that the higher the score, the more relevant the match. To increase the likelihood of a matched article, try a lower score.</p>

<p>If you don’t intend to use the articles to generate an answer that’s enriched via an LLM and Generative AI, then only <strong>1</strong> article is retrieved from <strong>each</strong> knowledge base. (Enriched answers are discussed farther below.)</p>

<p class="attn-note">The next set of options are for processing the user’s query to improve the search results. Processing of the options is done in the order represented in the UI.</p>

<h5 id="user-query---enhance-rephrase-using-conversational-context-liveperson-slm">User query - Enhance (rephrase) using conversational context (LivePerson SLM)</h5>

<p>Often the user’s query doesn’t include enough context to retrieve a high-quality answer from a knowledge base. To solve this, you can turn on this setting if you want the system to gather additional conversation context (conversation turns) and use it to rephrase the user’s query before searching the knowledge base. Rephrasing is done using <a href="knowledgeai-key-terms-concepts-user-queries-contextualize.html">KnowledgeAI’s Query Contextualization feature</a>.</p>

<p>As mentioned in the article at the link above, queries that are <strong>not in English</strong> are not enhanced. So, if your solution is not in English, it doesn’t make sense to turn on this setting because queries that aren’t in English are never enhanced. However, some brands support <strong>multi-lingual</strong> queries, such as English and Spanish queries against English knowledge bases. In such a case, go ahead and turn on this setting, so you can take advantage of query enhancement in cases where the query is in English.</p>

<h5 id="user-query---custom-processing-via-generative-ai-translate-etc">User query - Custom processing via Generative AI (translate, etc.)</h5>

<p>Use this option to perform any custom processing of the user query that you require. The processing is done via an LLM.</p>

<p>For example, if you’re supporting cross-lingual queries (say the query is in Spanish, but your knowledge base is in English), you might want to translate the query into the language of the knowledge base that will be searched for answers. Doing so can improve the search results significantly.</p>

<p>To enable this option, <a href="https://community.liveperson.com/kb/articles/1502-get-started-with-our-solution">activate our Generative AI features</a> in the <strong>Management Console</strong>.  Then turn on this toggle, and specify the customization prompt to use.</p>

<p>Learn more about <a href="knowledgeai-key-terms-concepts-user-queries-custom-process-via-generative-ai.html">custom processing of user queries</a> in our KnowledgeAI docs.</p>

<p class="attn-note">The next set of options are for processing the answers to improve their quality. Here again, processing of the options is done in the order represented in the UI.</p>

<h5 id="answers---generate-one-enriched-answer-via-generative-ai">Answers - Generate one enriched answer via Generative AI</h5>

<p>Not ready to use Generative AI and LLMs? No problem. You can leave this setting off if you choose.</p>

<p>However, if you want to <a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">offer your agents recommended answers that are enriched via Generative AI</a>, you can enable this toggle by <a href="https://community.liveperson.com/kb/articles/1502-get-started-with-our-solution">activating our Generative AI features</a> in the <strong>Management Console</strong>. Then turn on the toggle here.</p>

<p>You must also select the number of articles to retrieve from <strong>each</strong> knowledge base and send to the LLM for an enriched response. Providing more knowledge coverage (not just a single article) to the LLM for an enriched answer often results in a response that's superior. The system always returns <strong>1</strong> enriched answer per knowledge base.</p>

<p>You must also specify the prompt(s) to use:</p>

<ul>
  <li><strong>Enrichment prompt</strong>: Select an <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#enrichment-prompts">enrichment prompt</a> from the Prompt Library.</li>
  <li><strong>No Article Match prompt</strong>: Optionally, select a <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#no-article-match-prompts">No Article Match prompt</a> from the Prompt Library.</li>
</ul>

<h5 id="answers---custom-processing-via-generative-ai-translate-etc">Answers - Custom processing via Generative AI (translate, etc.)</h5>

<p>Use this option to perform any <a href="knowledgeai-key-terms-concepts-answers-custom-process-via-generative-ai.html">custom processing of the answers</a> that you require. The processing is done via an LLM.</p>

<p>One great use case for turning on this toggle is to rephrase the answers so that they reflect your brand’s voice. Another use case involves supporting cross-lingual queries (for example, the query is in Spanish, but your knowledge base is in English): you might need to translate the answers into the user’s language. (Learn more about processing user queries and answers.)</p>

<p>To enable this option, <a href="https://community.liveperson.com/kb/articles/1502-get-started-with-our-solution">activate our Generative AI features</a> in the <strong>Management Console</strong>.  Then turn on this toggle, and specify the customization prompt to use.</p>

<h4 id="example-rule">Example rule</h4>

<p>Our example rule below is for a fictitious, national automotive brand named Acme Auto. The rule is for a single skill named <code class="language-html highlighter-rouge">Support</code>, which the brand assigns to all of its customer support agents.</p>

<p><img width="800" alt="An example add-on in a knowledge base rule" src="img/agentassist/kb_rule_example.png" /></p>

<p>Acme Auto agents are highly specialized, so the brand divides its agents into two Conversational Cloud agent groups:</p>

<ul>
  <li><code class="language-html highlighter-rouge">ICE Support</code> for handling FAQs about cars with an internal combustion engine (ICE)</li>
  <li><code class="language-html highlighter-rouge">EV Support</code> for handling FAQs about electric vehicles (EV)</li>
</ul>

<p>Thus, the rule shown above includes two add-ons: The first add-on is for offering answer recommendations from the <code class="language-html highlighter-rouge">ICE FAQs</code> knowledge base to agents in the <code class="language-html highlighter-rouge">ICE Support</code> agent group. The second add-on is for offering answer recommendations from the <code class="language-html highlighter-rouge">EV FAQs</code> knowledge base to agents in the <code class="language-html highlighter-rouge">EV Support</code> agent group.</p>

<p>So, for example, for an agent to receive answer recommendations from <code class="language-html highlighter-rouge">EV FAQs</code>, the following must happen:</p>

<ul>
  <li>The agent must pick up a conversation that is routed to the <code class="language-html highlighter-rouge">Support</code> skill. (A conversation is routed to the skills assigned to the campaign's engagement.)</li>
  <li>The agent must be in the <code class="language-html highlighter-rouge">EV Support</code> agent group.</li>
</ul>

<p>As mentioned earlier, the order of the add-ons matters: At runtime, the add-ons are evaluated in order, and the first one that’s matched is executed. Therefore, in this example, an agent belonging to both the <code class="language-html highlighter-rouge">ICE Support</code> and <code class="language-html highlighter-rouge">EV Support</code> groups would only receive recommendations from the <code class="language-html highlighter-rouge">ICE FAQs</code> knowledge base. This is because the first add-on (for <code class="language-html highlighter-rouge">ICE Support</code>) evaluates to true first, and subsequent add-ons are not processed.</p>

<h3 id="step-3-configure-settings">Step 3: Configure settings</h3>

<ol>
  <li><a href="conversation-assist-overview.html#access-conversation-assist">Access Conversation Assist</a>, and click <strong>Settings</strong>.</li>
  <li>Configure relevant <a href="conversation-assist-setup-configure-settings.html">settings</a>.</li>
</ol>

<h3 id="faqs">FAQs</h3>

<h4 id="can-i-change-the-order-of-operations-when-processing-user-queries-andor-answers">Can I change the order of operations when processing user queries and/or answers?</h4>

<p>No, currently this isn’t possible.</p>

<h3 id="related-articles">Related articles</h3>

<ul>
  <li><a href="conversation-assist-key-terms-concepts-basic-concepts.html#how-rules-are-evaluated">Learn how a rule's add-ons are evaluated.</a></li>
  <li><a href="conversation-assist-key-terms-concepts-basic-concepts.html#how-recommendations-are-offered">Learn how answer recommendations are made.</a></li>
</ul>
]]></description>
      <!-- <pubDate>Tue, 26 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Answers - Custom Process via Generative AI</title>
      <link>https://developers.liveperson.com/knowledgeai-key-terms-concepts-answers-custom-process-via-generative-ai.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-key-terms-concepts-answers-custom-process-via-generative-ai.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>You want the answers sent to your consumers to be optimized to align with both your brand's objectives and the specific needs of each consumer. Custom processing powered by Generative AI is a vital tool in achieving this, enabling tailored responses that enhance the consumer experience and strengthen brand engagement.</p>

<p>Custom processing of the answers refines them before they’re returned to the client application that requested them. This can ensure the answers align with your brand’s voice, are in the right language, and more.</p>

<p>You can perform any kind of processing of the answers that you require. Use an LLM made available via LivePerson or <a href="trustworthy-generative-ai-bring-your-own-llm.html">use your own</a>.</p>

<h3 id="use-cases">Use cases</h3>

<p>A popular use case for custom processing of the answers is to rephrase the answers so that they better conform to your brand’s voice.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/kai_process_answers1.png" alt="An answer recommendation offered to an agent via Conversation Assist, where the voice is friendly and helpful" /></p>

<p>Or, if you’re supporting cross-lingual queries (say the query is in Spanish, but your knowledge base is in English), you might want to translate the answers into the consumer’s language.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/kai_process_answers2.png" alt="An answer recommendation offered to an agent via Conversation Assist, where the answer is translated into Spanish" /></p>

<h3 id="benefits">Benefits</h3>

<ul>
  <li>Promote smarter conversations via optimized answers.</li>
  <li>Ensure brand compliance by aligning communications with your brand’s voice.</li>
  <li>Support a global reach with multi-lingual capabilities.</li>
  <li>Save agents time and reduce manual edits.</li>
</ul>

<h3 id="applications-using-this">Applications using this</h3>

<p>Currently, custom processing of the answers via Generative AI is only supported by Conversation Assist. <a href="conversation-assist-setup-set-up-knowledge-bases.html#step-2-create-kb-level-recommendation-rules">Learn how to turn this on in a knowledge base rule</a> within Conversation Assist.</p>

<h3 id="how-it-works">How it works</h3>

<p>Before KnowledgeAI returns the answers to the client application that requested them, the answers are processed using an LLM. The output from the LLM must be a <strong>JSON</strong> that contains a list of answers; instruction on this must be provided in the prompt. (Check out the prompts provided by LivePerson for more understanding.)</p>

<p><a href="knowledgeai-key-terms-concepts-search-methods.html#search-flow">Learn where custom processing of answers fits into the overall search flow.</a></p>

<p>If a failure occurs during the LLM’s custom processing of the answers, or if the required output (a JSON list of answers) is not returned by the LLM, then KnowledgeAI will return the <strong>unprocessed</strong> answers to the client application. That is, it will return the answers that were sent to the LLM for processing. A failure might occur for a few reasons:</p>

<ul>
  <li>The LLM is unavailable.</li>
  <li>The LLM doesn’t return the list of answers in JSON format.</li>
  <li>Etc.</li>
</ul>

<p>Testers will be able to see such failures in KnowledgeAI’s <a href="knowledgeai-optimizing-your-content-tune-a-knowledge-base.html">Answer Tester</a>, but no error is returned to the client application that made the request for answers. This is by design so that answers are returned even if they’re unprocessed for refinement.</p>

<h3 id="prompt-templates">Prompt templates</h3>

<p>LivePerson makes available the following related prompt templates in the Prompt Library:</p>

<ul>
  <li>Answer Translation - Conversation Assist (Messaging)</li>
  <li>Answer Translation - Conversation Assist (Voice)</li>
</ul>

<h3 id="prompt-customization">Prompt customization</h3>

<p>Customizing the prompt? <a href="trustworthy-generative-ai-prompt-library-variables-for-solutions.html#variables-for-solutions-that-custom-process-answers">Learn about the variables used in custom processing of answers</a> from KnowlegeAI.</p>

<p>As mentioned above, the output from the LLM must be a <strong>JSON</strong> that contains a list of answers, so <strong>don’t</strong> change the instructions in the prompt regarding this; they’ve been tested by LivePerson.</p>
]]></description>
      <!-- <pubDate>Tue, 26 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Integrate a KMS or CMS</title>
      <link>https://developers.liveperson.com/knowledgeai-internal-knowledge-bases-integrate-a-kms-or-cms.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-internal-knowledge-bases-integrate-a-kms-or-cms.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>As a company or organization with a strong, online presence, it’s likely that you’ve invested heavily in a tool to manage your knowledge and content. This knowledge management system (KMS) or content management system (CMS) helps keep your content organized for easy updates. You’ve set up the system, trained your users on it, and socialized processes to make sure the content is complete, accurate, and follows your branding rules. So, it's naturally important to you that KnowledgeAI™ connect with this system, so you can leverage your vast knowledge and content in your Conversational AI solution. The good news is that all this is possible.</p>

<p>If your KMS or CMS has a public API for retrieving knowledge articles, you can integrate it with KnowledgeAI using LivePerson’s Integration Hub (iHub) application. iHub <strong>embeds Workato</strong>, a leading third-party enterprise automation platform, inside Conversational Cloud. What’s so special about Workato? Power. Flexibility. And a no-code/low-code approach to integration and automation.</p>

<p>In iHub, you can create a Workato recipe to sync the content in your external KMS/CMS into KnowledgeAI. Sync the content using a trigger, such as an automated schedule, or sync it on demand whenever you require it.</p>

<h3 id="terms-and-concepts">Terms and concepts</h3>

<h4 id="internal-knowledge-bases">Internal knowledge bases</h4>

<p>At LivePerson (and in this documentation), we classify a knowledge base that you integrate with an external KMS/CMS via a Workato integration in iHub as an “internal knowledge base.” This is because the content is stored internally within KnowledgeAI.</p>

<p>In the knowledge base’s settings, you’ll see “internal knowledge base” as the <strong>Knowledge base type</strong>.</p>

<p><img style="width:600px" src="img/ConvoBuilder/kai_extCMS_intKB.png" alt="The Knowledge base type setting in the knowledge base's settings" /></p>

<p>The term “internal knowledge base” isn’t used elsewhere in the UI. However, because there is also such a thing as an external knowledge base, we use the term to make the documentation simpler and communication faster and easier.</p>

<p>Be aware that you can also create an internal knowledge base by <a href="knowledgeai-internal-knowledge-bases-import-content.html">importing a Google sheet or a CSV file</a>, or by <a href="knowledgeai-internal-knowledge-bases-articles.html#add-an-article">adding articles manually</a> within KnowledgeAI. These too are internal knowledge bases because the content is stored internally within KnowledgeAI.</p>

<h4 id="projects">Projects</h4>

<p>In Workato, a project is a container for a set of related workflows, recipes, and automation tasks. Create a project to store assets related to your KnowledgeAI integration.</p>

<p><img style="width:400px" src="img/ConvoBuilder/kai_extCMS_projects.png" alt="Example projects" /></p>

<p class="attn-note">LivePerson recommends that you create one project to store all your KnowledgeAI-related assets. But it’s up to you. Organize things however is easiest for you.</p>

<h4 id="recipes">Recipes</h4>

<p>In Workato, a recipe is a pre-built automation workflow that connects different applications and systems to perform specific tasks or processes. It consists of triggers that initiate the workflow, actions that define what should happen, and conditions or logic to control the flow of data and information between connected applications.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_recipes.png" alt="Example recipe" /></p>

<p>Recipes simplify integration and automation by providing a structured way to create and manage workflows without the need for extensive coding or development expertise.</p>

<p>At a high level, to integrate your KMS/CMS with KnowledgeAI, you must create a recipe that:</p>

<ol>
  <li>Retrieves the content from your KMS/CMS</li>
  <li>Maps it to our LivePerson data schema for articles</li>
  <li>Imports the content into a knowledge base in KnowledgeAI</li>
</ol>

<h4 id="templates-and-customization">Templates and customization</h4>

<p>LivePerson offers both generic and vendor-specific templates to make integration with KnowledgeAI easier.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_templates.png" alt="Example templates" /></p>

<p>Take advantage of a template; don’t start from scratch. That said, feel free to customize and extend the recipe however you need. For example, you might want to alter it to send an email to an email address whenever a job fails.</p>

<p>To help you quickly understand how a template works, all of the templates are self-documenting. That is, they include comments that describe the various triggers and actions.</p>

<h3 id="watch-the-video">Watch the video</h3>

<p>Check out our short video on integrating a Zendesk KMS in under 15 minutes.</p>

<iframe src="https://player.vimeo.com/video/1077413879?h=f4307ad246" width="640" height="360" frameborder="0" allowfullscreen=""></iframe>

<p class="attn-note">While this video walks through the process of integrating a Zendesk KMS in specific, most (if not all steps) apply regardless of the vendor and KMS.</p>

<h3 id="integrate-the-kms-or-cms">Integrate the KMS or CMS</h3>

<h4 id="prerequisite-steps">Prerequisite steps</h4>

<p>New to embedded Workato in the Integration Hub (iHub)? Get acquainted by reviewing the <a href="https://community.liveperson.com/kb/articles/1293-ihub-overview">overview in our Community Center</a>.</p>

<h4 id="step-1-in-knowledgeai-create-the-knowledge-base">Step 1: In KnowledgeAI, create the knowledge base</h4>

<ol>
  <li><a href="knowledgeai-overview.html#access-knowledgeai">Open KnowledgeAI</a>, and click <strong>Add knowledge base</strong> in the upper-right corner.</li>
  <li>
    <p>Fill out the form, and select “External KMS/CMS” for <strong>Content source</strong>.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_createKB1.png" alt="The Add Knowledge Base form, with a callout to the Content Source setting" /></p>
  </li>
  <li>Click <strong>Save</strong>.</li>
  <li>
    <p>In the window that appears, use the <strong>Copy</strong> icon to copy your account ID, the knowledge base ID, and the client secret to the clipboard. (The client secret is used by Workato to authenticate with KnowledgeAI.) Paste the info somewhere for easy reference. You'll need it later in this process.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_createKB2.png" alt="The window that contains the info to copy: Account ID, Knowledge base ID, and client secret" /></p>
  </li>
  <li>Click <strong>Go to iHub</strong>.</li>
</ol>

<h4 id="step-2-in-ihub-activate-embedded-workato">Step 2: In iHub, activate embedded Workato</h4>

<p>This is a step that you only perform once in iHub. It creates the Workato tenant for your account within the mult-tenancy Workato architecture. It also creates an admin user for your account. More users are created on the fly as needed. Learn more about all of this in the iHub Workato user guide in our Community Center.</p>

<ol>
  <li>On the left navigation bar, click <strong>Manage &gt; Integration Hub</strong>.</li>
  <li>Click <strong>Workflows</strong> in the menu in the upper-left corner.</li>
  <li>
    <p>Click <strong>Activate</strong> to activate our embedded Workato workspace inside Conversational Cloud.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_activateWorkato1.png" alt="The Activate button" /></p>
  </li>
  <li>
    <p>Review and accept the terms of service by clicking the available checkbox. Then click <strong>Accept</strong>.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_activateWorkato2.png" alt="The window on which to review and accept terms" /></p>
  </li>
  <li>
    <p>Click <strong>Enter Workato</strong>.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_activateWorkato3.png" alt="The Enter Workato button" /></p>
  </li>
</ol>

<h4 id="step-3-in-ihub-create-a-project">Step 3: In iHub, create a project</h4>

<p class="attn-note">LivePerson recommends that you create one project to store all your KnowledgeAI-related assets. But it’s up to you. Organize things however is easiest for you.</p>

<ol>
  <li>Under <strong>Workflows</strong>, select <strong>Assets</strong>.</li>
  <li>Beside <strong>PROJECTS</strong> on the left, click the “ + “ sign.</li>
  <li>
    <p>Enter a name and description for the project.</p>

    <p><img style="width:700px" src="img/ConvoBuilder/kai_extCMS_createProject.png" alt="The form to fill out to create a project" /></p>
  </li>
  <li>Click <strong>Create project</strong>.</li>
</ol>

<h4 id="step-5-in-ihub-create-the-workato-recipe">Step 5: In iHub, create the Workato recipe</h4>

<p>In this step, you create the Workato recipe that imports content from your external KMS/CMS into the knowledge base that you created in KnowledgeAI.</p>

<ol>
  <li>Click <strong>Community Library</strong> on the menu bar.</li>
  <li>Enter the search term "liveperson" to search for the KnowledgeAI recipe templates.</li>
  <li>
    <p>Select "LivePerson Knowledge Articles Import."</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_LPoffering.png" alt="Example templates" /></p>
  </li>
  <li>
    <p>Select the recipe you need.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_templates.png" alt="Example templates" /></p>
  </li>
  <li>
    <p>Click <strong>Use this recipe</strong> in the upper-right corner.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_createRecipe1.png" alt="The Use this recipe button" /></p>
  </li>
  <li>
    <p>Select the project in which to copy the recipe, and click <strong>Copy and save</strong>.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_createRecipe2.png" alt="The Copy and save button" /></p>
  </li>
  <li>
    <p>Click <strong>Customize recipe</strong> to begin customization.</p>

    <p><img style="width:600px" src="img/ConvoBuilder/kai_extCMS_createRecipe3.png" alt="The Customize recipe button" /></p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_createRecipe4.png" alt="Customizing a recipe" /></p>
  </li>
  <li>
    <p>Before you get too far along with customization, change the recipe name to something descriptive and meaningful to your brand.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_changeRecipeName.png" alt="The recipe name field" /></p>
  </li>
</ol>

<h4 id="key-customization-points">Key customization points</h4>

<p>The comments in the elements in the recipe guide you through customization. However, the following are the key customization points. Vendor-specific recipes vary slightly.</p>

<h5 id="trigger---specify-a-schedule">Trigger - Specify a schedule</h5>

<p>Below <strong>TRIGGER</strong>, click the “Trigger on a custom schedule” element. Edit it to specify the schedule on which to run the recipe.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_customizeTrigger.png" alt="Specifying the trigger for running the recipe" /></p>

<h5 id="action---get-the-content-from-the-kmscms">Action - Get the content from the KMS/CMS</h5>

<p>Below <strong>ACTIONS</strong>, locate and click the “Select an app and action” element (or similarly named element depending on the template).  Edit the element:</p>

<ol>
  <li>Select the application (KMS or CMS) to connect to.</li>
  <li>Select the action that retrieves the content from the KMS or CMS.</li>
  <li>Create the new connection to the KMS or CMS.</li>
  <li>Configure any extra settings as required.</li>
</ol>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_actionExtractContentFromCMS.png" alt="Configuring the element that retrieves the content from the CMS" /></p>

<h5 id="action---map-the-content-to-the-liveperson-article-schema">Action - Map the content to the LivePerson article schema</h5>

<p>Locate and click the “Add items to articles list” element (or similarly named element depending on the template). In the element, map the KMS/CMS article schema to the KnowledgeAI fields provided.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_actionMapToKAISchema.png" alt="Configuring the element that maps the retrieved article content to the KnowledgeAI article schema" /></p>

<h5 id="action---add-the-content-to-the-knowledge-base-in-knowledgeai">Action - Add the content to the knowledge base in KnowledgeAI</h5>

<p>Locate and click the “Add all articles to LivePerson KnowledgeAI” element (or similarly named element depending on the template). This element binds the recipe to the content source in KnowledgeAI.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_actionImportToKAI3.png" alt="A callout to the element named Add all articles to LivePerson KAI" /></p>

<p>Edit the element to fill in all required info.</p>

<p>On the <strong>Connection</strong> tab, you’ll use the info that you recorded earlier when you created the knowledge base in KnowledgeAI. This takes care of:</p>

<ul>
  <li><strong>Brand/Account ID</strong></li>
  <li><strong>Knowledge Base ID</strong></li>
  <li><strong>Client Secret</strong></li>
</ul>

<p>Also on the <strong>Connection</strong> tab, specify the <strong>Workato recipe ID</strong>. You can get this from the URL in the browser window, like so:</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_actionImportToKAI4.png" alt="A callout to the recipe ID that's in the URL in the browser window" /></p>

<p>Still in the same element, switch to the <strong>Setup</strong> tab:</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_actionImportToKAI5.png" alt="A partial view of the Setup tab" /></p>

<p>On the <strong>Setup</strong> tab, there are three settings to take care of:</p>

<ul>
  <li><strong>deleteUnrepresentedArticlesFromKB</strong>: If you set this to "Yes," articles that exist in the knowledge base in KnowledgeAI—but <em>are not</em> represented (included) in the current import request from the external CMS/KMS—are deleted from the knowledge base in KnowledgeAI. So adds, updates, and deletes can all occur in the knowledge base. If you set this to "No," then those unrepresented articles remain, as is, in the knowledge base in KnowledgeAI.</li>
  <li>
    <p><strong>workatoUserId</strong>: To set this field, first click inside of it, and then get the ID from the recipe data like so:</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_actionImportToKAI6.gif" alt="A short animation that shows the user clicking the field, scrolling to the top of the Recipe Data window that opens, expanding Properties, and selecting the user ID" /></p>
  </li>
  <li><strong>jobId</strong>: You set the job ID just like you set Workato recipe ID: Click in the field, and then get it from the properties in the recipe data.</li>
</ul>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_actionImportToKAI7.png" alt="A view of the Job ID field in the Properties in the Recipe Data" /></p>

<p class="attn-note">The API enables all new articles, so ensure the content is suitable before the recipe is run.</p>

<h4 id="step-6-in-ihub-test-and-debug-the-recipe">Step 6: In iHub, test and debug the recipe</h4>

<p>In the upper-right corner, click <strong>Test recipe</strong> to test the recipe.</p>

<p class="attn-note">The test performs an actual run of the recipe, so this results in updates to the knowledge base in KnowledgeAI.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_testRecipe1.png" alt="The Test Recipe button" /></p>

<p>If you don’t get a success message, debug the recipe and try again after fixing it.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_testRecipe2.png" alt="A success message after testing the recipe" /></p>

<h4 id="step-7-in-knowledgeai-verify-the-articles">Step 7: In KnowledgeAI, verify the articles</h4>

<p>As a final step, go to the knowledge base in KnowledgeAI, and verify the articles are there and look as expected.</p>

<h3 id="payloads-and-status-codes">Payloads and status codes</h3>

<h4 id="request-payload">Request payload</h4>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
    </span><span class="nl">"articles"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
        </span><span class="p">{</span><span class="w">
            </span><span class="nl">"title"</span><span class="p">:</span><span class="w"> </span><span class="s2">"title"</span><span class="p">,</span><span class="w">
            </span><span class="nl">"summary"</span><span class="p">:</span><span class="w"> </span><span class="s2">"summary"</span><span class="p">,</span><span class="w">
            </span><span class="nl">"deleteRequest"</span><span class="p">:</span><span class="w"> </span><span class="s2">"true/false"</span><span class="w">
            </span><span class="err">//....</span><span class="w">
        </span><span class="p">}</span><span class="w">
    </span><span class="p">],</span><span class="w">
    </span><span class="nl">"pruneNonIncludedArticles"</span><span class="p">:</span><span class="w"> </span><span class="s2">"true/false"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"kbId"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"&lt;&lt;kbId&gt;&gt;"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"correlationId"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"&lt;&lt;workatoUserId::recipeId&gt;&gt;"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"jobId"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"&lt;&lt;recipe-jobId&gt;&gt;"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p class="attn-note"><code class="language-html highlighter-rouge">pruneNonIncludedArticles</code> is a reference to the <strong>deleteUnrepresentedArticlesFromKB</strong> value/setting, described earlier.</p>

<h4 id="success-response-payload">Success response payload</h4>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
   </span><span class="nl">"success"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
   </span><span class="nl">"errorCode"</span><span class="p">:</span><span class="w"> </span><span class="s2">"200"</span><span class="p">,</span><span class="w">
   </span><span class="nl">"successResult"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
       </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"STARTED"</span><span class="p">,</span><span class="w">
       </span><span class="nl">"correlationId"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"xxxxxxxxx"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="response-statuses">Response statuses</h4>

<p class="attn-note">There is no response body for non-200 status codes.</p>

<table>
  <thead>
    <tr>
      <th>Status code</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>200</td>
      <td>Success response</td>
    </tr>
    <tr>
      <td>400</td>
      <td>Bad request; request validation failures</td>
    </tr>
    <tr>
      <td>401</td>
      <td>Not authorized to access the resource</td>
    </tr>
    <tr>
      <td>404</td>
      <td>Requested response not found; knowledge base data source is not found for the given ID; no content source of KMS type found for a given knowledge base ID; invalid recipe ID/Workato user ID/job ID</td>
    </tr>
    <tr>
      <td>429</td>
      <td>Too many requests</td>
    </tr>
    <tr>
      <td>500</td>
      <td>Internal server error</td>
    </tr>
  </tbody>
</table>

<h3 id="start-or-stop-the-recipes-schedule">Start or stop the recipe's schedule</h3>

<p>To start a recipe so that it runs on its schedule, click the corresponding action button on the <strong>Sources</strong> page in KnowledgeAI:</p>

<p><img style="width:500px" src="img/ConvoBuilder/kai_extCMS_scheduleStart.png" alt="The action button for starting the recipe to run on its schedule" /></p>

<p>You stop a recipe from running on its schedule in a similar way:</p>

<p><img style="width:500px" src="img/ConvoBuilder/kai_extCMS_scheduleStop.png" alt="The action button for stopping the recipe from running on its schedule" /></p>

<h3 id="manually-run-the-recipe">Manually run the recipe</h3>

<p>You can run a recipe on demand at any time. To do so, click the recipe name link on the <strong>Sources</strong> page in the knowledge base in KnowledgeAI. This takes you directly to the recipe in iHub, where you can do this.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_runRecipe2.png" alt="The recipe name link on the Sources page, which takes you directly to iHub where you can run the recipe on demand" /></p>

<p>In iHub, the option to run the recipe manually (click "Test recipe" not "Start recipe") is available in several prominent spots, like this one below:</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_runRecipe.png" alt="The Start recipe button" /></p>

<h3 id="delete-content">Delete content</h3>

<p>On the <strong>Sources</strong> page in the knowledge base in KnowledgeAI, there's a <strong>Delete</strong> action available for deleting an individual content source.</p>

<p><img style="width:400px" src="img/ConvoBuilder/kai_extCMS_deleteSource.png" alt="The Delete button for an individual content source on the Sources page within a knowledge base" /></p>

<p>Deleting a content source does two things:</p>

<ul>
  <li>Deletes the articles associated with the recipe from the knowledge base.</li>
  <li>Disassociates the recipe from the knowledge base. That is, the content source is removed from the list on the page.</li>
</ul>

<p>However, the recipe <em>remains available</em> in iHub.</p>

<p>On the other hand, if you first delete a recipe in iHub, you'll still see the content source (the recipe) listed on the <strong>Sources</strong> page within the knowledge base in KnowledgeAI. And you'll still see a corresponding <strong>Delete</strong> action available there too. In this case, it works the same: It deletes the associated articles and disassociates the recipe (which doesn't exist in iHub anymore).</p>

<p class="attn-note">Since two different applications are involved (KnowledgeAI and iHub), when performing deletes, ensure things are aligned across the applications as you expect. And take care because the operations aren't reversible.</p>

<h3 id="reporting">Reporting</h3>

<p>To check the results of jobs, use the <strong>Sources</strong> page in the knowledge base in KnowledgeAI:</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_reporting2.png" alt="The Sources page showing that the last recipe run was successful from a job status standpoint and a content status standpoint" /></p>

<p>If you encounter errors, scroll way to the right, and click the <strong>View errors</strong> link. This opens a window with info on the errors.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_reporting3.png" alt="The Sources page showing the Content Status as Errors and a callout to the View Errors link" /></p>

<p>Finally, from the <strong>Sources</strong> page, you can quickly get to the recipe in iHub by clicking the recipe name. More detailed reporting on jobs is available in iHub.</p>

<h3 id="best-practices">Best practices</h3>

<ul>
  <li>
    <p><strong>Solutions</strong>: Keep it simple, not complicated.</p>

    <ul>
      <li>Strive for a “one recipe per knowledge base” approach.</li>
      <li>Don’t use one recipe to sync from multiple external KMS/CMS.</li>
    </ul>

    <p class="attn-note">KnowledgeAI can run only one recipe per knowledge base at a time. Set each recipe’s schedule accordingly.</p>
  </li>
  <li><strong>Connections</strong>: Never reuse an existing connection. If you copy (clone) a recipe, in the copy always create and configure a new connection. This is necessary because the recipe ID is bound in the connection.</li>
  <li><strong>Importing articles into KnowledgeAI</strong>: Always use the available “Add all articles to LivePerson KnowledgeAI” connector element; don't set up a custom HTTP request.</li>
  <li><strong>Monitoring</strong>: Check the <strong>Sources</strong> page in KnowledgeAI on a regular basis to verify that your jobs are running successfully. It’s also a best practice to regularly verify that the content in KnowledgeAI looks as expected.</li>
  <li><strong>Minor changes</strong>: Go ahead and make these directly in the relevant recipe.</li>
  <li><strong>Major changes</strong>: To make these, we recommend that you clone the recipe, make the changes in the copy, and then replace the original recipe after testing has proven to be successful.</li>
</ul>

<p class="attn-note"><a href="knowledgeai-best-practices.html">Learn more best practices for using KnowledgeAI.</a></p>

<h3 id="troubleshooting">Troubleshooting</h3>

<p>Within a recipe, use the <strong>Jobs</strong> page to drill down to errors that occurred:</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_troubleshooting1.png" alt="The Jobs page" /></p>

<p>On the <strong>Jobs</strong> page, click the error to navigate to the problematic element.</p>

<p>Then use the <strong>Input</strong>, <strong>Error</strong>, and <strong>Debug</strong> panels to help you understand and solve the problem.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_troubleshooting2.png" alt="The Input panel" /></p>

<p class="attn-tip">If you're discussing an issue with us, provide us with the <code class="language-html highlighter-rouge">correlationId</code> that was received in the response. We'll use that to check our internal logs.</p>

<h3 id="faqs">FAQs</h3>

<h4 id="can-i-further-customize-the-recipe">Can I further customize the recipe?</h4>

<p>Certainly. Validation, pre-processing, post-processing is all up to you. Configure this as you require.</p>

<h4 id="is-the-client-secret-shared-across-knowledge-bases">Is the client secret shared across knowledge bases?</h4>

<p>No, a client secret isn’t shared across knowledge bases. However, it is shared across all content sources (recipes) within the same knowledge base.</p>

<h4 id="ive-lost-the-client-secret-for-a-knowledge-base-how-do-i-retrieve-it">I've lost the client secret for a knowledge base. How do I retrieve it?</h4>

<p>On the knowledge base's <strong>Sources</strong> page, click <strong>Add recipe</strong> in the upper-right corner. This opens a window where you can copy it again.</p>

<h4 id="can-i-use-knowledgeai-to-manually-add-articles-to-the-internal-knowledge-base">Can I use KnowledgeAI to manually add articles to the internal knowledge base?</h4>

<p>Yes, you can. But be aware that those articles aren’t updated when the recipe runs.</p>

<p>The impact to manually added articles depends on the recipe’s configuration. For example, if you intend to add articles manually, it's likely that you'll want to set <strong>deleteUnrepresentedArticlesFromKB</strong> (discussed above) to "No" so that such articles aren't deleted when a sync operation occurs.</p>

<h4 id="can-i-add-multiple-content-sources-in-a-single-knowledge-base">Can I add multiple content sources in a single knowledge base?</h4>

<p>Yes, you can. But in this case, in all of the recipes, set <strong>deleteUnrepresentedArticlesFromKb</strong> (discussed above) to “No” in the connector element that imports the articles into KnowledgeAI. Otherwise, articles from one source will be deleted by the recipe run for another source.</p>

<h4 id="can-i-use-a-single-recipe-across-multiple-knowledge-bases">Can I use a single recipe across multiple knowledge bases?</h4>

<p>You can, but we don't recommend this. Strive for a “one recipe per knowledge base” approach.</p>

<p>If you proceed and use a single recipe across multiple knowledge bases, the recipe must have multiple connections, each of which must use a different client secret.</p>

<h4 id="my-kmscms-isnt-listed-by-vendor-name-it-says-custom-why-is-that">My KMS/CMS isn't listed by vendor name. It says, "Custom." Why is that?</h4>

<p>Your KMS/CMS is still supported. It's just that we haven't yet added the vendor name to our back-end list of known names. Contact your LivePerson representative to get it added.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_extCMS_providerNameFAQ.png" alt="A callout to the Provider name column" /></p>

<h4 id="i-dont-see-my-recipes-listed-on-the-sources-page-of-the-knowledge-base-why-is-that">I don't see my recipes listed on the Sources page of the knowledge base. Why is that?</h4>

<p>If you have a knowledge base that you integrated with a CMS/KMS <em>prior to our February 2024 release</em>, you won’t initially see its associated recipes listed on the <strong>Sources</strong> page. To resolve this:</p>

<ol>
  <li>In Conversational Cloud, navigate to iHub, and open the recipe.</li>
  <li>If the recipe is running, stop it.</li>
  <li>In the recipe, navigate to the “Add all articles to LivePerson KnowledgeAI” element, select it, and click <strong>Edit</strong>.</li>
  <li>In the panel on the right, click <strong>Connection</strong>, and add a new connection. (Deleting the existing connection is optional, but we recommend you do so.) Make sure all required fields in the new connection have info, including but not limited to <strong>Workato recipe ID</strong>, which is a new field as of our February 2024 release. (For help with setting these fields, see the discussion farther above on this element.) Then click <strong>Connect</strong>.</li>
  <li>Switch from the <strong>Connection</strong> tab to the <strong>Setup</strong> tab. Make sure all required fields have info, including but not limited to <strong>Workato user ID</strong> and <strong>Job ID</strong>. These are new fields too as of our February 2024 release.</li>
</ol>

<p>Once the new connection is established, the recipes are shown on the <strong>Sources</strong> page.</p>
]]></description>
      <!-- <pubDate>Mon, 25 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Web View Integration API</title>
      <link>https://developers.liveperson.com/conversation-builder-integrations-web-view-integration-api.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-integrations-web-view-integration-api.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>The Web View Integration API was designed to allow an external system to post information back to a bot. For example, if a user is directed to an external web form to collect data (e.g., for lead generation or payment), this API can be used by that external form to send the data back to the bot.</p>

<p><img style="width:550px" src="img/ConvoBuilder/web_view_api_flow.png" alt="The flow of the Web View integration API" /></p>

<p>The Web View API can be used by the external system to:</p>

<ul>
  <li>Set session-scoped variables in the bot runtime</li>
  <li>Post a message to the chat client</li>
  <li>Invoke a dialog starter to trigger a dialog flow</li>
</ul>

<h3 id="limitations">Limitations</h3>

<p class="attn-note">Don’t use this API to post Personally Identifiable Information (PII) or Payment Card Industry (PCI) data because the data is not masked.</p>

<p>If you use this API to post a message back to the bot, there’s a time restriction: That message must be sent within 24 hours of receipt of the consumer’s most recent message via the channel. Otherwise, the message sent via the API is ignored by the bot, which means the bot won't respond to it.</p>

<h3 id="getting-started">Getting started</h3>

<h4 id="retrieve-the-domain">Retrieve the domain</h4>

<p>Use the <a href="domain-api.html">LivePerson Domain API</a> to retrieve the domain, providing your account ID and the <code class="language-html highlighter-rouge">cbExternalIntegrations</code> service name.</p>

<h4 id="review-the-api-terms-of-use">Review the API terms of use</h4>

<p>Review our <a href="https://www.liveperson.com/policies/apitou/">API terms of use</a>.</p>

<h3 id="requirements">Requirements</h3>

<p class="attn-note">If you have <a href="https://community.liveperson.com/kb/articles/1321-ip-restriction">IP restrictions</a> in place, you'll need to do some <a href="conversation-builder-networking-security.html">whitelisting</a> before using this API.</p>

<p>The API requires three fields that the external system must obtain from the conversation:</p>
<ul>
  <li><strong>userId</strong>: The user ID can be retrieved using the <a href="conversation-builder-scripting-functions-get-user-data.html#get-user-platform-id-and-platform-type">getUserPlatformId</a> function.</li>
  <li><strong>botId</strong>: The bot ID can be retrieved from the <a href="conversation-builder-bots-bot-basics.html#configure-bot-settings">bot settings</a>; see the <strong>Bot ID</strong> field.</li>
  <li><strong>conversationId</strong>: The conversation ID can be retrieved using the <a href="conversation-builder-scripting-functions-get-set-session-data.html#get-conversation-id">getConversationId</a> function.</li>
</ul>

<h3 id="request">Request</h3>

<p>Use the POST method to set session-scoped variables in the bot runtime.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>URL</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>POST</td>
      <td>https://{domain}/thirdparty-services-0.1/webview</td>
    </tr>
  </tbody>
</table>

<h4 id="headers">Headers</h4>

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Value</th>
      <th>Notes</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Content-Type</td>
      <td>application/json</td>
      <td> </td>
    </tr>
    <tr>
      <td>Authorization</td>
      <td>The API access key  that you need to pass; originally retrieved from the conversation</td>
      <td>This is an SHA authorization token that is a combination of the conversationId and the botId. It should be generated by creating a sha256 hash: <br /><br /><code class="language-html highlighter-rouge">auth = sha256hex(conversationId + “ || “ + botId)</code> <br /><br />For example: <code class="language-html highlighter-rouge">sha256hex(“abcd || xyz”)</code> <br /><br />Note the space, two pipe characters, and space after the conversationId.</td>
    </tr>
  </tbody>
</table>

<h4 id="bodypost-parameters">BODY/POST parameters</h4>

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
      <th>Type/Value</th>
      <th>Required</th>
      <th>Notes</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>botId</td>
      <td>The bot ID</td>
      <td>string</td>
      <td>Required</td>
      <td> </td>
    </tr>
    <tr>
      <td>conversationId</td>
      <td>The conversation ID</td>
      <td>string</td>
      <td>Required</td>
      <td> </td>
    </tr>
    <tr>
      <td>userId</td>
      <td>The consumer's user ID</td>
      <td>string</td>
      <td>Required</td>
      <td> </td>
    </tr>
    <tr>
      <td>message</td>
      <td>The message to send to the bot runtime</td>
      <td>string</td>
      <td>Optional</td>
      <td>If set, this message is posted to the chat client. <br /><br />To also trigger a dialog starter, this message must match to a Dialog Starter interaction in one of the bot’s dialogs. <br /><br />If unset, the Web View service only posts the variables.</td>
    </tr>
    <tr>
      <td>contextVariables</td>
      <td>The key/value pairs that can be passed to the bot platform</td>
      <td>object:list of strings</td>
      <td>Optional</td>
      <td>These key/value pairs can be used in the bot runtime using the <a href="conversation-builder-scripting-functions-get-set-session-data.html#get-web-view-variables">Get Web View Variables</a> JavaScript functions.</td>
    </tr>
  </tbody>
</table>

<h4 id="example">Example</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="nx">curl</span> <span class="o">-</span><span class="nx">X</span> <span class="nx">POST</span> <span class="o">\</span>
  <span class="nx">https</span><span class="p">:</span><span class="c1">//{domain}/thirdparty-services-0.1/webview \</span>
  <span class="o">-</span><span class="nx">H</span> <span class="dl">'</span><span class="s1">Authorization: F8488E6143818BB0364717A91F235F7F7F0FE91C464EC6FAC7ECF0D3393EBBAF</span><span class="dl">'</span> <span class="o">\</span>
  <span class="o">-</span><span class="nx">H</span> <span class="dl">'</span><span class="s1">Content-Type: application/json</span><span class="dl">'</span> <span class="o">\</span>
  <span class="o">-</span><span class="nx">d</span> <span class="dl">'</span><span class="s1">{
    "botId": "795bb1534e34fc89050304e6f6827c41c50410d7",
    "conversationId": "a845678d-fe5a-429e-bc46-b25d524b9fa7",
    "message":"webrequest",
    "userId": "b849678d-fe4a-439e-bc46-b25d524b9fa7",
    "contextVariables": [{"name": "PaymentId","value": "534e34fc89050304e6f6827c41c50410d7"}, {"name": "PaymentStatus","value": "PROCESSED"}]}</span><span class="dl">'</span>
</code></pre></div></div>

<h3 id="retrieving-the-web-view-variables">Retrieving the Web View variables</h3>
<p>Use the <a href="conversation-builder-scripting-functions-get-set-session-data.html#get-web-view-variables">Get Web View Variables</a> JavaScript functions to retrieve the variables set via the Web View API from the bot runtime.</p>

<h3 id="example-guide">Example guide</h3>

<p>This guide provides a sample implementation for this API.</p>

<h4 id="step-1-information-needed">Step 1: Information needed</h4>

<p>In order to call the Web View Integration API, the following data is needed:</p>

<ul>
  <li>Bot ID</li>
  <li>Conversation ID</li>
  <li>User ID</li>
  <li>Message (optional)</li>
  <li>Context variables (actual data to be passed)</li>
  <li>A hosted form with the API integrated (detailed below)</li>
</ul>

<p>The Bot ID can be found in LivePerson Conversation Builder in the bot's <a href="conversation-builder-bots-bot-basics.html#configure-bot-settings">Bot Settings</a> (expand <strong>More Settings</strong>).</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/guideWebView_botID.png" alt="The Bot ID setting in Bot Settings" /></p>

<p>The conversation ID can be retrieved with the <a href="conversation-builder-scripting-functions-get-set-session-data.html#get-conversation-id">botContext.getConversationId()</a> method in bot code.</p>

<p>The user ID can be retrieved with the <a href="conversation-builder-scripting-functions-get-user-data.html#get-user-platform-id-and-platform-type">botContext.getUserPlatformId()</a> method in bot code.</p>

<p><strong>Note:</strong> If you're using a platform that already has access to the conversation ID and/or user ID (such as <a href="liveperson-functions-overview.html">LivePerson Functions</a>), you can simply take them from there.</p>

<h4 id="step-2-set-up-the-form-link-in-conversation-builder">Step 2: Set up the form link in Conversation Builder</h4>

<p>In this guide, we'll be passing the required data to a URL with the bot ID, conversation ID, and user ID in the query string. The URL format will look like this:</p>

<p><a href="http://{formUrl}?userId={userId}&amp;convId={convId}&amp;botId={botId">http://{formUrl}?userId={userId}&amp;convId={convId}&amp;botId={botId</a>}</p>

<p>We'll use the methods mentioned above to construct the URL.</p>

<p>In the Global Functions of our bot, we’ll use the code below to retrieve the necessary data and then set the URL in the bot variable <strong>formURL</strong>, which we’ll use later to provide a link to the user to fill out the form.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">function</span> <span class="nx">__initConversation</span><span class="p">()</span> <span class="p">{</span>
 <span class="kd">var</span> <span class="nx">userId</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getUserPlatformId</span><span class="p">();</span>
 <span class="kd">var</span> <span class="nx">convId</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getConversationId</span><span class="p">();</span>
 <span class="kd">var</span> <span class="nx">botId</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">7a4e10287a6b90cee1de9910f0b5010985eef16a</span><span class="dl">'</span><span class="p">;</span>
 <span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="dl">'</span><span class="s1">formURL</span><span class="dl">'</span><span class="p">,</span> <span class="dl">'</span><span class="s1">https://static-assets.dev.fs.liveperson.com/cb_test/web_view_test/web_view/index.html?userId=</span><span class="dl">'</span> <span class="o">+</span> <span class="nx">userId</span> <span class="o">+</span> <span class="dl">'</span><span class="s1">&amp;convId=</span><span class="dl">'</span> <span class="o">+</span> <span class="nx">convId</span> <span class="o">+</span> <span class="dl">'</span><span class="s1">&amp;botId=</span><span class="dl">'</span> <span class="o">+</span> <span class="nx">botId</span><span class="p">,</span> <span class="kc">true</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<h4 id="step-3-send-the-form-link-to-the-visitor">Step 3: Send the form link to the visitor</h4>

<p>In the bot, we have a simple dialog to present the form link to the visitor. The dialog has a simple pattern match for triggering.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/guideWebView_formLink.png" alt="A dialog to send a form link to the consumer" /></p>

<p>The dialog also has a single Button Question interaction with a single button. This button uses the <strong>formURL</strong> bot variable that was created in the Global Functions as the <strong>Callback</strong>. This way, when the visitor clicks the button, they will be directed to the form URL.</p>

<p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/guideWebView_buttonConfig.png" alt="A button question with a single button that uses the callback to direct the user to the form URL when the user clicks it" /></p>

<h4 id="step-4-call-the-api-from-the-browser">Step 4: Call the API from the browser</h4>

<p>For the purposes of this guide, we created a simple HTML page, with a basic form, in order to submit some collected information back to the bot. We are not performing any validation, but you might want to do so in your form.</p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/guideWebView_form.png" alt="A simple example form to collect some info, e.g., what is your name" /></p>

<p>After the user fills out the form, the method below is called to submit the data back to the bot. We retrieve the data from the query string, then retrieve the form data, then set the domain and authorization, and finally post data to the bot.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// Post data when form is submitted</span>
<span class="nx">submitForm</span> <span class="o">=</span> <span class="k">async</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
 <span class="c1">// Get data from query string</span>
 <span class="kd">const</span> <span class="nx">queryParams</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">URLSearchParams</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">search</span><span class="p">);</span>
 <span class="kd">const</span> <span class="nx">userId</span> <span class="o">=</span> <span class="nx">queryParams</span><span class="p">.</span><span class="kd">get</span><span class="p">(</span><span class="dl">'</span><span class="s1">userId</span><span class="dl">'</span><span class="p">);</span>
 <span class="kd">const</span> <span class="nx">conversationId</span> <span class="o">=</span> <span class="nx">queryParams</span><span class="p">.</span><span class="kd">get</span><span class="p">(</span><span class="dl">'</span><span class="s1">convId</span><span class="dl">'</span><span class="p">);</span>
 <span class="kd">const</span> <span class="nx">botId</span> <span class="o">=</span> <span class="nx">queryParams</span><span class="p">.</span><span class="kd">get</span><span class="p">(</span><span class="dl">'</span><span class="s1">botId</span><span class="dl">'</span><span class="p">);</span>

 <span class="c1">// Get data from form</span>
 <span class="kd">const</span> <span class="nx">name</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">querySelector</span><span class="p">(</span><span class="dl">'</span><span class="s1">input[name="user_name"]</span><span class="dl">'</span><span class="p">).</span><span class="nx">value</span><span class="p">;</span>
 <span class="kd">const</span> <span class="nx">color</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">querySelector</span><span class="p">(</span><span class="dl">'</span><span class="s1">input[name="favorite_color"]</span><span class="dl">'</span><span class="p">).</span><span class="nx">value</span><span class="p">;</span>
 <span class="kd">const</span> <span class="nx">swallow</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">querySelector</span><span class="p">(</span><span class="dl">'</span><span class="s1">input[name="unladen_swallow"]</span><span class="dl">'</span><span class="p">).</span><span class="nx">value</span><span class="p">;</span>

 <span class="c1">// use correct domain for your region</span>
 <span class="kd">const</span> <span class="nx">domain</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">https://va.bc-intg.liveperson.net/thirdparty-services-0.1/webview</span><span class="dl">'</span><span class="p">;</span>
  <span class="c1">// encode auth string</span>
 <span class="kd">const</span> <span class="nx">authString</span> <span class="o">=</span> <span class="s2">`</span><span class="p">${</span><span class="nx">conversationId</span><span class="p">}</span><span class="s2"> || </span><span class="p">${</span><span class="nx">botId</span><span class="p">}</span><span class="s2">`</span><span class="p">;</span>
 <span class="kd">const</span> <span class="nx">auth</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">sha256</span><span class="p">(</span><span class="nx">authString</span><span class="p">);</span>

 <span class="kd">const</span> <span class="nx">res</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">postData</span><span class="p">(</span><span class="nx">domain</span><span class="p">,</span> <span class="nx">auth</span><span class="p">,</span> <span class="p">{</span>
   <span class="nx">botId</span><span class="p">,</span>
   <span class="nx">conversationId</span><span class="p">,</span>
   <span class="nx">userId</span><span class="p">,</span>
   <span class="na">message</span><span class="p">:</span> <span class="dl">"</span><span class="s2">request successful</span><span class="dl">"</span><span class="p">,</span> <span class="c1">// optional</span>
   <span class="na">contextVariables</span><span class="p">:</span> <span class="p">[</span>
     <span class="p">{</span><span class="dl">"</span><span class="s2">name</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">name</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">value</span><span class="dl">"</span><span class="p">:</span> <span class="nx">name</span><span class="p">},</span>
     <span class="p">{</span><span class="dl">"</span><span class="s2">name</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">color</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">value</span><span class="dl">"</span><span class="p">:</span> <span class="nx">color</span><span class="p">},</span>
     <span class="p">{</span><span class="dl">"</span><span class="s2">name</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">swallow</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">value</span><span class="dl">"</span><span class="p">:</span> <span class="nx">swallow</span><span class="p">}</span>
   <span class="p">],</span>
 <span class="p">});</span>
<span class="p">}</span>
</code></pre></div></div>

<p><strong>Note:</strong> The authorization for the bot <em>must</em> be in the format of “{conversationId} || {botId}”, then sha256 encoded. You will need to do this in whatever method your platform supports.</p>

<p>The postData method referenced above looks like this:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// Post data to Web View API</span>
<span class="k">async</span> <span class="kd">function</span> <span class="nx">postData</span><span class="p">(</span><span class="nx">url</span> <span class="o">=</span> <span class="dl">''</span><span class="p">,</span> <span class="nx">auth</span><span class="p">,</span> <span class="nx">data</span> <span class="o">=</span> <span class="p">{})</span> <span class="p">{</span>
 <span class="kd">const</span> <span class="nx">response</span> <span class="o">=</span> <span class="k">await</span> <span class="nx">fetch</span><span class="p">(</span><span class="nx">url</span><span class="p">,</span> <span class="p">{</span>
   <span class="na">method</span><span class="p">:</span> <span class="dl">'</span><span class="s1">POST</span><span class="dl">'</span><span class="p">,</span>
   <span class="na">mode</span><span class="p">:</span> <span class="dl">'</span><span class="s1">cors</span><span class="dl">'</span><span class="p">,</span>
   <span class="na">headers</span><span class="p">:</span> <span class="p">{</span>
     <span class="dl">'</span><span class="s1">Authorization</span><span class="dl">'</span><span class="p">:</span> <span class="nx">auth</span><span class="p">,</span>
     <span class="dl">'</span><span class="s1">Content-Type</span><span class="dl">'</span><span class="p">:</span> <span class="dl">'</span><span class="s1">application/json</span><span class="dl">'</span><span class="p">,</span>
   <span class="p">},</span>
   <span class="na">body</span><span class="p">:</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">data</span><span class="p">),</span>
 <span class="p">});</span>
 <span class="k">return</span> <span class="k">await</span> <span class="nx">response</span><span class="p">.</span><span class="nx">json</span><span class="p">();</span>
<span class="p">};</span>
</code></pre></div></div>

<h4 id="step-5-react-to-the-submitted-data-in-the-bot">Step 5: React to the submitted data in the bot</h4>

<p>When we called the Web View Integration API upon submitting the form, we passed a “message” parameter with a value of “request successful.” This “message” can be used in the dialog flow. You can see in the images below that we have a custom rule to pattern match the message that we sent.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/guideWebView_react_a.png" alt="The Custom Rule button on the button question" />
<img class="fancyimage" style="width:800px" src="img/ConvoBuilder/guideWebView_react_b.png" alt="The configuration of the custom rule, which pattern matches request successful" />
<img class="fancyimage" style="width:800px" src="img/ConvoBuilder/guideWebView_react_c.png" alt="The configured custom rule as it appears directly on the button interaction" /></p>

<p>In the pre-process code for the interaction, we have the following code to retrieve the visitor’s name that was sent in the API payload. This value is then assigned to a bot variable, which we can use in the text interaction.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">visitor_name</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getWebViewVariable</span><span class="p">(</span><span class="dl">'</span><span class="s1">name</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">visitor_color</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getWebViewVariable</span><span class="p">(</span><span class="dl">'</span><span class="s1">color</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">visitor_swallow</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getWebViewVariable</span><span class="p">(</span><span class="dl">'</span><span class="s1">swallow</span><span class="dl">'</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="dl">'</span><span class="s1">visitor_name</span><span class="dl">'</span><span class="p">,</span> <span class="nx">visitor_name</span><span class="p">,</span> <span class="kc">true</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="dl">'</span><span class="s1">visitor_color</span><span class="dl">'</span><span class="p">,</span> <span class="nx">visitor_color</span><span class="p">,</span> <span class="kc">true</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="dl">'</span><span class="s1">visitor_swallow</span><span class="dl">'</span><span class="p">,</span> <span class="nx">visitor_swallow</span><span class="p">,</span> <span class="kc">true</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
</code></pre></div></div>

<p>There's an <a href="https://static-assets.dev.fs.liveperson.com/cb_test/web_view_test/index.html">end-to-end demo</a>. Simply type “web view” to trigger the appropriate dialog. Click the link to access the form, fill it in, and then submit the form. The bot will then respond, confirming that the form was filled.</p>

<p><img class="fancyimage" style="width:300px" src="img/ConvoBuilder/guideWebView_chat.png" alt="Testing the conversation using the Messaging test page" /></p>
]]></description>
      <!-- <pubDate>Thu, 07 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Articles</title>
      <link>https://developers.liveperson.com/knowledgeai-internal-knowledge-bases-articles.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-internal-knowledge-bases-articles.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="best-practices">Best practices</h3>

<p>Review our <a href="knowledgeai-best-practices.html">best practices for writing articles</a>.</p>

<h3 id="add-an-article">Add an article</h3>

<p>An article is a focused piece of content (a message) on a single topic that you want to serve to consumers.</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/kb_articles.png" alt="An example of two articles in a list" /></p>

<p class="attn-note">Learn about article <a href="knowledgeai-best-practices.html#adding-articles">best practices</a> and <a href="knowledgeai-limits.html#article-level-limits-for-internal-knowledge-bases">limits</a>.</p>

<p><strong>To add an article to an internal knowledge base</strong></p>

<ol>
  <li>Open the knowledge base.</li>
  <li>Click <strong>Articles</strong> in the menu in the upper-left corner.</li>
  <li>Click <strong>Add article</strong> in the upper-right corner.</li>
  <li>Specify the following basic settings:
    <ul>
      <li><strong>Title</strong>: Enter a complete sentence or question, e.g., "I can't remember my password." or, "Do we have a company org chart?"</li>
      <li><strong>Intent Qualifiers</strong>: This field is only shown if you're using <a href="knowledgeai-internal-knowledge-bases-introduction.html#domain-intents-versus-knowledge-base-intents">Knowledge Base intents</a>. Intent qualifiers are alternative ways that people ask for the article, i.e., alternative ways to communicate the same intent. An intent qualifier can't be used more than once, i.e., in more than one article.</li>
      <li><strong>Intent</strong>: This field is only shown if the knowledge base is using <a href="knowledgeai-internal-knowledge-bases-introduction.html#domain-intents-versus-knowledge-base-intents">Domain intents</a>. If you're using intent matching to find and serve answers (see <a href="knowledgeai-key-terms-concepts-search-methods.html">Search Methods</a>), select the intent to associate with the article. If needed, you can use the <strong>Create intent</strong> option in the drop-down list to create the intent in Intent Manager from this location. Similarly, there's an <strong>Update training phrases</strong> link for updating the training phrases in Intent Manager from here. <strong>Note:</strong> An intent can't be used more than once, i.e., in more than one article. Also note that you don’t need to link your articles to intents right away, as the <strong>Intent</strong> field is optional. This is deliberate because it allows you to get started with a knowledge base by adding just the articles first. Then, you can create intents for the content you care about the most, and link those to the relevant articles. This means you can focus on specific content areas in your knowledge base, and manage the content overall with varying levels of effort on your part. The approach gives you flexibility as you maintain the knowledge base over time.</li>
      <li>
        <p><strong>Summary</strong>: Enter a short response or message to be sent to the user.</p>

        <p>You can include web links, although depending on the Messaging channel they might not display correctly. For example, for SMS, you might need to show the URL by itself, not wrapped in HTML, since the HTML will be sent as plain text over this channel. For the Voice channel, keep your URLs as short as possible too. They should take the form of “www.mysite.com,” i.e., without the “http://” that doesn’t convey well in a voice conversation.</p>

        <p>Additionally, in this field you can use <a href="knowledgeai-internal-knowledge-bases-articles.html#format-text-in-an-article">a subset of HTML</a>, but not <a href="conversation-builder-bots-voice-bots.html#human-like-experiences-via-ssml">SSML</a> for use in the Voice channel.</p>
      </li>
      <li><strong>Detail</strong>: This field can be used to include longer messages to the user, though we recommend that you keep the responses as brief as possible. The considerations regarding Web links, HTML, and SSML described above for the <strong>Summary</strong> apply here too.</li>
      <li><strong>Category</strong>: To assign the article to a category, enter the category name. This lets you subsequently filter and find articles based on category in the KnowledgeAI application. Additionally, during a search, <a href="knowledgeai-key-terms-concepts-search-methods.html#how-does-ai-search-work">AI Search checks the input query against the category</a>. Use only alphanumeric and underscore characters in the category name; only these are permitted.</li>
      <li><strong>Tags</strong>: Tags are keywords, <em>not</em> sentences, that highlight the key noun(s) or word(s) in the title and intent qualifiers/training phrases. Tags can also be <a href="intent-manager-key-terms-concepts.html#entities">entities</a> that you've defined in a domain in Intent Manager. To increase the accuracy of Knowledge Base search results, add tags. For example, for an article about health insurance, the tags should be "health", “insurance”, “benefits”. These should be words, not sentences. During a search, <a href="knowledgeai-key-terms-concepts-search-methods.html#how-does-ai-search-work">AI Search checks the input query against tags</a>.</li>
    </ul>
  </li>
  <li>If desired, click <strong>Advanced Settings</strong>, and specify the following:
    <ul>
      <li><strong>Valid From</strong> and <strong>Valid To</strong>: If desired, specify in <a href="https://www.timeanddate.com/worldclock/timezone/utc">UTC</a> the dates and times during which the article is active. To specify a finite time period, use both date settings. To specify an open-ended date range, omit the <strong>Valid To</strong> date. To activate an article immediately after you add it, omit the <strong>Valid From</strong> date. These settings work with the <strong>Enable Article</strong> setting to determine if and when the article is <a href="knowledgeai-internal-knowledge-bases-introduction.html#active-versus-inactive-articles">active</a>.</li>
      <li><strong>Content</strong>: Use this field to send a <em>hyperlink</em>. Enter the URL here, and then configure the bot with the Knowledge Base integration accordingly. For help, see the next section.</li>
      <li><strong>Audio</strong>:  Use this field to send an <em>audio</em> file. Enter the URL here, and then configure the bot with the Knowledge Base integration accordingly. For help, see the next section.</li>
      <li><strong>Image</strong>: Use this field to send an <em>image</em>. Enter the URL here, and then configure the bot with the Knowledge Base integration accordingly. For help, see the next section.</li>
      <li><strong>Video</strong>: Use this field to send a <em>video</em>. Enter the URL here, and then configure the bot with the Knowledge Base integration accordingly. For help, see the next section.</li>
    </ul>
  </li>
  <li>
    <p>Click <strong>Save</strong>.</p>

    <p>By default, the article is disabled, which means it isn't returned in knowledge base searches in KnowledgeAI™ integrations. This is done to give you the opportunity to test the article before enabling it.</p>
  </li>
</ol>

<h3 id="add-content-links">Add content links</h3>

<p>You can use the content links in the <strong>Advanced Settings</strong> of an article to send rich content (hyperlink, audio, image, and/or video) along with an article.</p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/kb_advSettings0.png" alt="Content Links settings" /></p>

<p>Details on how to set this up follow below.</p>

<h4 id="configure-the-article">Configure the article</h4>

<p>First, in the <strong>Advanced Settings</strong> of the article, enter the URLs to send <strong>(1)</strong>.</p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/kb_advSettings1.png" alt="Entering the URL in the Content field and entering the image in the Image field" /></p>

<p class="attn-note">The remainder of this information below is for the benefit of bot developers using a KnowledgeAI integration in a bot. However, there's a more powerful and simpler alternative that doesn't require a KnowledgeAI integration, namely, use of the <a href="conversation-builder-interactions-integrations.html#knowledge-ai-interactions">Knowledge AI interaction</a> in LivePerson Conversation Builder.</p>

<h4 id="configure-the-knowledgeai-integration-in-the-bot">Configure the KnowledgeAI integration in the bot</h4>

<p>Next, open Conversation Builder and navigate to the <a href="conversation-builder-integrations-knowledgeai-integrations.html">KnowledgeAI integration</a> inside the bot that uses the knowledge base.</p>

<p>Verify that the appropriate knowledge base is selected <strong>(2)</strong>, and then add custom data fields for the content links that you're using <strong>(3)</strong>.</p>

<p>The "article" custom data field is added automatically when you add the Knowledge Base integration, but in this step you need to manually add additional custom data fields for the content links. For the values, specify the paths to the URL nodes in the JSON, like we've done in the image below.</p>

<p><img class="fancyimage" style="width:700px" src="img/ConvoBuilder/kb_advSettings2.png" alt="A well-configured KnowledgeAI integration" /></p>

<p class="attn-note">For the names of the JSON nodes for the content links, see the JSON reference farther below in this topic.</p>

<h4 id="configure-the-dialog-in-the-bot">Configure the dialog in the bot</h4>

<p>Next, still in Conversation Builder, build out the applicable dialog to make use of the additional content <strong>(4)</strong>, i.e., use the custom data fields as you require. (For help on displaying variables in interactions, see <a href="conversation-builder-interactions-interaction-basics.html#display-variables-in-interactions">this section</a>.)</p>

<p><img class="fancyimage" style="width:550px" src="img/ConvoBuilder/kb_advSettings3.png" alt="An example of an FAQ Search integration" />
<img class="fancyimage" style="width:550px" src="img/ConvoBuilder/kb_advSettings3b.png" alt="The interactions that send the result, i.e., the article's image and content" />
<img class="fancyimage" style="width:550px" src="img/ConvoBuilder/kb_advSettings3c.png" alt="The interaction that sends the result, i.e., the content URL and the interaction that sends a message when no results are found" /></p>

<h4 id="preview-the-conversation">Preview the conversation</h4>

<p>Use Conversation Builder's Preview tool to preview the conversation and verify the content is returned and rendered as you expect.</p>

<p><img class="fancyimage" style="width:400px" src="img/ConvoBuilder/kb_advSettings5.png" alt="The conversation with the consumer as it renders in the Preview tool" /></p>

<h4 id="useful-techniques">Useful techniques</h4>

<p>Continuing our example, we've added some JavaScript so that, if there's a content link that is returned by the integration call, it is displayed. And if there isn't one, the conversation ends after the article is sent.</p>

<p>To accomplish this, in the Display Article interaction, we've configured the next action to be "End Interaction." Then, we've added some Post-Process code to that same interaction. The code (shown below) checks whether the content link (URL) exists, and, if it does, it changes the interaction's next action to be the following interaction.</p>

<p><img class="fancyimage" style="width:500px" src="img/ConvoBuilder/kb_advSettings6.png" alt="Example post-process code" /></p>

<h3 id="enable-or-disable-an-article">Enable or disable an article</h3>

<p>Enabled articles are returned by knowledge base searches in KnowledgeAI integrations, while disabled articles are not. That said, keep in mind that an enabled article is returned only if the article is <a href="knowledgeai-internal-knowledge-bases-introduction.html#active-versus-inactive-articles">active</a>, i.e., if the current date and time in UTC falls within the time period specified by the article's <strong>Valid From</strong> and/or <strong>Valid To</strong> dates, if specified.</p>

<p><strong>To enable or disable an article</strong></p>

<ol>
  <li>Open the knowledge base, find the article, and click its title.</li>
  <li>In the Edit Article window, scroll down to <strong>Enable Article</strong>.</li>
  <li>
    <p>Do either of the following:</p>

    <ul>
      <li>Turn on (enable) the setting to enable the article.</li>
      <li>Turn off (disable) the setting to disable the article.</li>
    </ul>
  </li>
</ol>

<h3 id="format-text-in-an-article">Format text in an article</h3>

<p>In the Summary and Detail fields of an article in an <a href="knowledgeai-internal-knowledge-bases-introduction.html">internal knowledge base</a>, you can use the following subset of HTML tags:</p>

<ul>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;p&gt;</span></code> and <code class="language-html highlighter-rouge"><span class="nt">&lt;br&gt;</span></code></li>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;strong&gt;</span></code>, <code class="language-html highlighter-rouge"><span class="nt">&lt;b&gt;</span></code> and <code class="language-html highlighter-rouge"><span class="nt">&lt;i&gt;</span></code></li>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;ul&gt;</span></code>, <code class="language-html highlighter-rouge"><span class="nt">&lt;ol&gt;</span></code> and <code class="language-html highlighter-rouge"><span class="nt">&lt;li&gt;</span></code></li>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">""</span><span class="nt">&gt;</span></code>, with support for HTTP, HTTPS, phone (<code class="language-html highlighter-rouge">tel</code>) and email (<code class="language-html highlighter-rouge">mailto</code>)</li>
</ul>

<p>Examples of valid anchor tags:</p>

<ul>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"https://example.com/test.jpg"</span><span class="nt">&gt;</span>click here<span class="nt">&lt;/a&gt;</span></code></li>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"https://example.com/1$2324%342523"</span><span class="nt">&gt;</span>click here<span class="nt">&lt;/a&gt;</span></code></li>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">”tel:+123456789”</span><span class="nt">&gt;</span>phone<span class="nt">&lt;/a&gt;</span></code></li>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">”mailto:a.b@example.com”</span><span class="nt">&gt;</span>email<span class="nt">&lt;/a&gt;</span></code></li>
</ul>

<p>Examples of invalid anchor tags:</p>

<ul>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"javascript: alert(’test’)"</span><span class="nt">&gt;</span>click here<span class="nt">&lt;/a&gt;</span></code></li>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"https://example.com/test.jpg"</span> <span class="na">onmouseover=</span><span class="s">"alert('test')”&gt;click here&lt;/a&gt;</span></code></li>
  <li><code class="language-html highlighter-rouge"><span class="nt">&lt;a</span> <span class="na">onmouseover=</span><span class="s">"alert('test')"</span> <span class="na">href=</span><span class="s">"https://example.com/test.jpg"</span><span class="nt">&gt;</span>click here<span class="nt">&lt;/a&gt;</span></code></li>
</ul>

<p class="attn-note">If you're using an <a href="knowledgeai-external-knowledge-bases-introduction.html">external knowledge base</a>, where your content developers are authoring content in an external CMS, you can use the same HTML tags listed above.</p>

<p>The HTML tags render in Conversation Builder's <a href="conversation-builder-testing-deployment-preview-the-bot.html">Preview</a> tool and in the Web messaging/chat window based on the capability of the respective tool, window, and channel in use. Be sure to test in the target channel to verify support.</p>

<h3 id="find-an-article-to-edit">Find an article to edit</h3>

<ol>
  <li>Open the knowledge base, and click <strong>Articles</strong> in the menu in the upper-left corner.</li>
  <li>
    <p>In the Search box at the top of the page, enter a word or phrase that’s contained in the article's content (title, summary, detail, tags).</p>

    <p class="attn-note">If you enter a string and press Enter, the search is performed against only the title. However, if you enter a string and wait for the list of results to appear, that list of results reflects a search of the string against all article content fields (title, summary, detail, tags).</p>

    <p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/kb_findarticle.png" alt="Using the Search box to find an article" /></p>
  </li>
  <li>
    <p>In the list that appears, select the article.</p>
  </li>
  <li>Select the article title. This opens the article for editing.</li>
</ol>

<h3 id="restore-an-earlier-version-of-an-article">Restore an earlier version of an article</h3>

<p>In an <a href="knowledgeai-internal-knowledge-bases-introduction.html">internal knowledge base</a> or an <a href="knowledgeai-legacy-features-external-kbs-with-liveperson-ai.html">external knowledge that uses LivePerson AI</a>, whenever someone changes an article’s content — that is, the title, the summary, the detail or a content URL — a back-up of the previous version of the article is automatically created. The system stores the three, most recent back-up versions that have been created, and you can restore one of these if desired.</p>

<p>Note the following:</p>

<ul>
  <li>You can only restore an earlier version of the article’s <em>content</em> (title, summary, detail and content URLs). To change any other article property, you must modify the article directly.</li>
  <li>When applicable, a back-up version is also created due to a sync of updated content.</li>
</ul>

<h4 id="to-restore-an-earlier-version-of-an-article">To restore an earlier version of an article</h4>

<ol>
  <li>
    <p>Open the knowledge base, and use the Search box at the top of the page to find the article.</p>
  </li>
  <li>
    <p>Click the <img class="inlineimage" style="width:25px" src="img/ConvoBuilder/kb_3dot_icon.png" alt="Three-dot icon" /> icon that's displayed on the right, and select <strong>Content Versions</strong> from the menu that appears.</p>

    <p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/kb_restore_article5.png" alt="Content Versions menu option for an article" /></p>

    <p>The system displays the current version and the previous version of the article’s content. The date shown for each version reflects when it was created. The name shown is the user who created that version of the article.</p>

    <p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/kb_restore_article.png" alt="The Article Content Versions window tht displays the current version and the previous version" /></p>

    <p>To display a different, earlier version (the last three are available), click the dropdown arrow beside <strong>Previous Version</strong>, and select the version from the list.</p>
  </li>
  <li>
    <p>Review the earlier version. To restore it, click <strong>Restore</strong>.</p>

    <p>This changes the current version so that it’s now the most recent back-up version, and the back-up version that you selected now becomes the current version of the article.</p>
  </li>
</ol>

<h3 id="json-reference">JSON reference</h3>

<p>The following table identifies the JSON node for article information that's often needed when you're integrating the knowledge base with a bot.</p>

<table>
  <thead>
    <tr>
      <th>Name of UI field</th>
      <th>Name of JSON node</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Title</td>
      <td>title</td>
    </tr>
    <tr>
      <td>Summary</td>
      <td>summary</td>
    </tr>
    <tr>
      <td>Detail</td>
      <td>detail</td>
    </tr>
    <tr>
      <td>Content Links → Content</td>
      <td>contentURL</td>
    </tr>
    <tr>
      <td>Content Links → Image</td>
      <td>imageURL</td>
    </tr>
    <tr>
      <td>Content Links → Video</td>
      <td>videoURL</td>
    </tr>
    <tr>
      <td>Content Links → Audio</td>
      <td>audioURL</td>
    </tr>
  </tbody>
</table>
]]></description>
      <!-- <pubDate>Wed, 06 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Methods v2</title>
      <link>https://developers.liveperson.com/conversation-orchestrator-next-actions-api-methods-v2.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-orchestrator-next-actions-api-methods-v2.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>There are two ways to use the Next Actions functionality:</p>

<ul>
  <li>The REST API can directly access policies. A primary use case for this is to retrieve policy routing decisions when using <a href="third-party-bots-getting-started.html">external, third-party bots</a>, such as Watson or DialogFlow.</li>
  <li>A JavaScript function wraps the REST API for easy use in LivePerson Conversation Builder. If you want to save and delete properties in Conversation Builder, use the Javascript wrapper functions.</li>
</ul>

<h3 id="javascript-wrapper">JavaScript wrapper</h3>
<p>See the <a href="conversation-builder-scripting-functions-askmaven.html">discussion on the built-in askMaven function</a> in Conversation Builder.</p>

<h3 id="rest-api">REST API</h3>

<h4 id="overview">Overview</h4>
<p>{domain}/{api}?access_token=</p>

<h4 id="retrieving-the-domain">Retrieving the domain</h4>

<p>Use the <a href="domain-api.html">LivePerson Domain API</a> to retrieve the domain, providing your account ID and the <code class="language-html highlighter-rouge">ccs</code> service name.</p>

<p class="attn-note">See also the <a href="conversation-orchestrator-api-authorization.html#api-authorization-for-v2">discussion on generating the secure token</a>.</p>

<h4 id="get-next-actions">Get Next Actions</h4>
<p>Gets a routing decision based on Conversation Orchestrator configured policies.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>POST</td>
      <td>/v2​/policy​/nextaction</td>
    </tr>
  </tbody>
</table>

<h5 id="request-body">Request body</h5>

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Type</th>
      <th>Description</th>
      <th>Required?</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>accountId</td>
      <td>String</td>
      <td>The account ID of the brand</td>
      <td>Required</td>
    </tr>
    <tr>
      <td>conversationId</td>
      <td>String</td>
      <td>The conversation ID of the current conversation</td>
      <td>Optional</td>
    </tr>
    <tr>
      <td>customerId</td>
      <td>String</td>
      <td>LivePerson customer ID of the current conversation</td>
      <td>Optional. However, this parameter is required if you're using authenticated SDEs to route in your dynamic policy.</td>
    </tr>
    <tr>
      <td>visitorId</td>
      <td>String</td>
      <td>LivePerson visitor ID of the current conversation</td>
      <td>Optional. However, this parameter is required if you're using unauthenticated SDEs to route in your dynamic policy.</td>
    </tr>
    <tr>
      <td>sessionId</td>
      <td>String</td>
      <td>The group ID associated with the session store variable call to set values. If no session is specified, then the conversationId is used to associate with the session store variables.</td>
      <td>Optional</td>
    </tr>
    <tr>
      <td>lpToken</td>
      <td>String</td>
      <td>Bearer {bearer token}</td>
      <td>Optional</td>
    </tr>
    <tr>
      <td>policyId</td>
      <td>String</td>
      <td>The ID of the policy</td>
      <td>Optional</td>
    </tr>
  </tbody>
</table>

<h5 id="request-payload-example">Request payload example</h5>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "accountId": "le12345678",
  "customerId": "myCustomerId",
  "visitorId": "myVisitorId",
  "sessionId": "mySessionId",
  "conversationId": "myConversationId",
  "lpToken": "Bearer myToken",
}
</code></pre></div></div>

<h5 id="request-example">Request example</h5>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> POST <span class="s2">"https://{domain}/v2/policy/nextaction?access_token={Token}"</span> <span class="nt">-H</span>  <span class="s2">"accept: application/json"</span> <span class="nt">-H</span>  <span class="s2">"Content-Type: application/json"</span> <span class="nt">-d</span> <span class="s2">"{</span><span class="se">\"</span><span class="s2">accountId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">le12345678</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">customerId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">myCustomerId</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">visitorId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">myVisitorId</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">sessionId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">mySessionId</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">conversationId</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">myConversationId</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">lpToken</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">Bearer myToken</span><span class="se">\"</span><span class="s2">}"</span>
</code></pre></div></div>

<h5 id="response-payload-example">Response payload example</h5>
<p>If you call the v2 API directly:</p>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
   "policyId":"myPolicyId",
   "policyName":"myPolicyName",
   "actions":[
      {
         "payload":{
            "message":"TEST Hello World"
         },
         "type":"SEND_MESSAGE"
      }
   ]
}
</code></pre></div></div>

<p>If you call the v2 API from a bot, the payload conforms to v1 and returns:</p>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>[
  {
    "payload": {
      "message": "TEST Hello World"
    },
    "type": "SEND_MESSAGE"
  }
]
</code></pre></div></div>

<p>status code = 200</p>
]]></description>
      <!-- <pubDate>Tue, 05 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Methods v1</title>
      <link>https://developers.liveperson.com/conversation-orchestrator-next-actions-api-methods-v1.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-orchestrator-next-actions-api-methods-v1.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>There are two ways to use the Next Actions functionality:</p>

<ul>
  <li>The REST API that can directly access CCS. A primary use case for this is to retrieve policy routing decisions when using <a href="third-party-bots-getting-started.html">external, third-party bots</a>, such as Watson or DialogFlow.</li>
  <li>A JavaScript function that wraps the REST API for easy use in LivePerson Conversation Builder. If you want to save and delete properties in Conversation Builder, use the Javascript wrapper functions.</li>
</ul>

<h3 id="javascript-wrapper">JavaScript wrapper</h3>
<p>See the <a href="conversation-builder-scripting-functions-askmaven.html">discussion on the built-in askMaven function</a> in Conversation Builder.</p>

<h3 id="rest-api">REST API</h3>
<p>Every API call to the Conversation Context Service requires the following auth headers to be accepted:</p>
<ul>
  <li>content-Type: application/json</li>
  <li>maven-api-key: {YOUR API KEY}</li>
</ul>

<h4 id="retrieving-the-domain">Retrieving the domain</h4>

<p>Use the <a href="domain-api.html">LivePerson Domain API</a> to retrieve the domain, providing your account ID and the <code class="language-html highlighter-rouge">askMaven</code> service name.</p>

<p class="attn-note">The API key in the example that follows is fake; replace it with the developer key that you generated.</p>

<h4 id="get-next-actions">Get Next Actions</h4>
<p>Get a routing decision based on Conversation Orchestrator configured policies.</p>

<h5 id="uri">URI</h5>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>/v1/account/{accountId}/next-actions?conversationId={conversationId}&amp;consumerId={consumerId}&amp;groupId={groupId}</td>
    </tr>
  </tbody>
</table>

<h5 id="query-parameters">Query parameters</h5>

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Type</th>
      <th>Description</th>
      <th>Required?</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>accountId</td>
      <td>string</td>
      <td>The accountId of the brand</td>
      <td>Required</td>
    </tr>
    <tr>
      <td>conversationId</td>
      <td>string</td>
      <td>The conversation ID of the current conversation</td>
      <td>Optional</td>
    </tr>
    <tr>
      <td>consumerId</td>
      <td>string</td>
      <td>LivePerson consumer ID of the current conversation</td>
      <td>Optional</td>
    </tr>
    <tr>
      <td>groupId</td>
      <td>string</td>
      <td>The group ID associated with the session store variable call to set values. If no groupId is specified, then the conversationId is used to associate with the session store variables.</td>
      <td>Optional</td>
    </tr>
  </tbody>
</table>

<h5 id="request-payload">Request payload</h5>
<p>N/A</p>

<h5 id="request-example">Request example</h5>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v1/account/{accountId}/next-actions?conversationId=myconversationId&amp;consumerId=myconsumerId&amp;groupId=mygroupId"</span> <span class="nt">-H</span>  <span class="s2">"accept: */*"</span> <span class="nt">-H</span>  <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<h5 id="response-example">Response example</h5>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
    nextActionId: 'UUID', // some uuid
    rule: {
        "id": "12345",
        "name": "This is VIP rule"
        actions: [
            {
                "type": "TRANSFER_TO_AGENT",
                "payload": {
                    agentId: 'g23hasd234',
                    fallbackSkillId: '12345'
                }
            },
            {
                "type": "SEND_MESSAGE",
                "payload": {
                    text: 'hello from maven"
                }
            }
        ]
    },
    noMatchReason: "NO_MATCHED_RULES" // only added if no rules are matches, rule will be null
    noMatchReason: "NO_POLICIES_ENABLED"
}
</code></pre></div></div>
]]></description>
      <!-- <pubDate>Tue, 05 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Methods v1</title>
      <link>https://developers.liveperson.com/conversation-orchestrator-conversation-context-service-methods-v1.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-orchestrator-conversation-context-service-methods-v1.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>There are two ways to manage properties in the Conversation Context Service (CCS):</p>

<ul>
  <li>REST APIs can directly access the CCS outside of Conversational Cloud. Use the REST APIs when you want to retrieve information from external data sources.</li>
  <li>A Javascript function wraps the REST API for easy use within Conversational Cloud. If you want to save and delete properties in LivePerson Conversation Builder, use the Javascript wrapper functions.</li>
</ul>

<h3 id="upgrade-to-v2-apis">Upgrade to v2 APIs</h3>

<p>LivePerson is gradually upgrading all accounts from v1 to v2, as the v1 APIs will be deprecated in the future. (Stay tuned for the date!) If you haven't been contacted yet, but you want to be upgraded to v2 as soon as possible, please contact your LivePerson representative.</p>

<h3 id="important-notes">Important notes</h3>

<p>Note the following when using the v1 API:</p>

<ul>
  <li>For optimal performance, Conversation Context Service default and session-level properties have a character limit of 800,000 (800 kb), which includes spaces, punctuation, and other visible characters. If the stored value exceeds 800,000 characters, the API will return an HTTP status of 413 with a message body of "document too large." Data will not be saved for that call or subsequent ones until the character count falls below the imposed limit.</li>
</ul>

<h3 id="javascript-wrapper">JavaScript wrapper</h3>

<p>See the <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html">discussion on scripting functions for managing the Conversation Context Service</a> in the Conversation Builder documentation.</p>

<h3 id="rest-apis-overview">REST APIs overview</h3>

<p>If the Conversation Context Service(CCS) is summarized in one sentence, it is a service that manages properties in a key-value relationship. So, most APIs are for storing, reading, and deleting properties, and there are some additional APIs.</p>

<p>Every API call to the CCS requires the following auth headers to be accepted:</p>

<ul>
  <li>content-Type : application/json</li>
  <li>maven-api-key : {YOUR API KEY}</li>
</ul>

<h4 id="retrieving-the-domain">Retrieving the domain</h4>

<p>Use the <a href="domain-api.html">LivePerson Domain API</a> to retrieve the domain, providing your account ID and the <code class="language-html highlighter-rouge">mavenContext</code> service name.</p>

<p class="attn-note">The API keys in the examples that follow are fake; replace them with the developer key that you generated.</p>

<h3 id="rest-namespace-api">REST Namespace API</h3>

<h4 id="create-a-custom-namespace">Create a custom namespace</h4>
<p>This API creates a new namespace in the Conversation Context Service.</p>

<p class="attn-note">Saving properties to a namespace that has not been previously created using this method will create the new namespace automatically</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>POST</td>
      <td>/v1​/account​/{accountId}​</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
<code class="language-html highlighter-rouge">{ "name”: “myNamespace”}</code></p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> POST <span class="s2">"https://{domain}/v1/account/{accountId}"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span> <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="nt">-d</span> <span class="s2">"{</span><span class="se">\"</span><span class="s2">name</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">myNamespace</span><span class="se">\"</span><span class="s2">}"</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="get-a-list-of-namespaces-created">Get a list of namespaces created</h4>
<p>This API provides the name and creation date of all namespaces that exist for your account in the Conversation Context Service.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>​/v1​/account​/{accountId}​</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v1/account/{accountId}"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br /></p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>[
{"name":"myCoolNamespace","createdAt":"2019-08-02T19:41:52.017Z"},
{"name":"myTestNamepsace","createdAt":"2019-08-08T06:12:23.204Z"}
]
</code></pre></div></div>

<h4 id="delete-a-custom-namespace">Delete a custom namespace</h4>
<p>This API completely removes a namespace and all of its underlying properties from the Conversation Context Service.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>DELETE</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> DELETE <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h3 id="rest-property-api">REST Property API</h3>

<h4 id="save-properties">Save properties</h4>

<h4 id="save-namespace-properties">Save namespace properties</h4>
<p>This is an API for saving one or several namespace properties. This API overwrites existing properties and inserts non-existing properties.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>PATCH</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/properties</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
<code class="language-html highlighter-rouge">{ "myProperty1": "myValue1", "myProperty2": 2, "myProperty3": { "name": "myValue3" } }</code></p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> PATCH <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/properties"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span> <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="nt">-d</span> <span class="s2">"{</span><span class="se">\"</span><span class="s2">myProperty1</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">myValue1</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">myProperty2</span><span class="se">\"</span><span class="s2">:2,</span><span class="se">\"</span><span class="s2">myProperty3</span><span class="se">\"</span><span class="s2">:{</span><span class="se">\"</span><span class="s2">name</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">myValue3</span><span class="se">\"</span><span class="s2">}}"</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="save-a-namespace-property">Save a namespace property</h4>
<p>This is an API for saving one namespace property. This API overwrites an existing property and inserts a non-existing property.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>PUT</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/properties​/{property}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
<code class="language-html highlighter-rouge">"value4"</code></p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> PUT <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/properties/myProperty4"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span> <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="nt">-d</span> <span class="s2">"</span><span class="se">\"</span><span class="s2">value4</span><span class="se">\"</span><span class="s2">"</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="save-session-properties">Save session properties</h4>
<p>This is an API for saving one or several session properties. This API overwrites existing properties and inserts non-existing properties.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>PATCH</td>
      <td>​/v1​/account​/{accountId}​/{customNamespace}​/{sessionId}​/properties</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
<code class="language-html highlighter-rouge">{ "myProperty1": ["value1", "value2", "value3"] }</code></p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> PATCH <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/mySessionId/properties"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span> <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="nt">-d</span> <span class="s2">"{</span><span class="se">\"</span><span class="s2">myProperty1</span><span class="se">\"</span><span class="s2">:[</span><span class="se">\"</span><span class="s2">value1</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">value2</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">value3</span><span class="se">\"</span><span class="s2">]}"</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="save-a-session-property">Save a session property</h4>
<p>This is an API for saving one session property. This API overwrites an existing property and inserts a non-existing property.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>PUT</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/{sessionId}​/properties​/{property}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
<code class="language-html highlighter-rouge">{ "name": "value2", "items": ["A", "B", "C"] }</code></p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> PUT <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/mySessionId/properties/myProperty2"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span> <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="nt">-d</span> <span class="s2">"{</span><span class="se">\"</span><span class="s2">name</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">value2</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">items</span><span class="se">\"</span><span class="s2">:[</span><span class="se">\"</span><span class="s2">A</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">B</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">C</span><span class="se">\"</span><span class="s2">]}"</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="read-properties">Read properties</h4>

<h4 id="read-namespace-properties">Read namespace properties</h4>
<p>This API takes a namespace as a parameter and returns all properties belonging to the namespace.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/properties</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/properties"</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br /></p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "myProperty1": "myValue1",
  "myProperty2": 2,
  "myProperty3": {
    "name": "myValue3"
  }
}
</code></pre></div></div>

<h4 id="read-a-namespace-property">Read a namespace property</h4>
<p>This API takes a namespace and a property as a parameter and returns the value of the namespace property.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/properties​/{property}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/properties/myProperty1"</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br />
<code class="language-html highlighter-rouge">myValue1</code></p>

<h4 id="read-session-properties">Read session properties</h4>
<p>This API takes a namespace and a session as a parameter and returns all session properties belonging to the namespace and session.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/{sessionId}​/properties</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/mySessionId/properties"</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br /></p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>{
  "myProperty1": [
    "value1",
    "value2",
    "value3"
  ]
}
</code></pre></div></div>

<h4 id="read-a-session-property">Read a session property</h4>
<p>This API takes a namespace, a session and a property as a parameter and returns the value of the session property.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/{sessionId}​/properties​/{property}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/mySessionId/properties/myProperty1"</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br /></p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>[
  "value1",
  "value2",
  "value3"
]
</code></pre></div></div>

<h4 id="delete-properties">Delete properties</h4>

<p>There are three ways to delete properties. First, it is automatically deleted by setting the TTL. Second, all properties belonging to the Namespace or Session are deleted at once by specifying the Namespace and Session. Third, explicitly designate and delete specific properties.</p>

<h4 id="delete-all-namespace-properties-belonging-to-the-namespace-with-ttl-setting">Delete all namespace properties belonging to the namespace with TTL setting</h4>
<p>This API takes a namespace as a parameter and deletes all namespace properties belonging to the namespace. It also removes the TTL applied to the namespace.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>DELETE</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> DELETE <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="delete-all-properties-belonging-to-namespace-without-ttl-setting">Delete all properties belonging to Namespace without TTL setting</h4>

<p class="attn-note">Currently, this feature is not supported.</p>

<h4 id="delete-all-properties-belonging-to-session-with-ttl-setting">Delete all properties belonging to Session with TTL setting</h4>

<p class="attn-note">Currently, this feature is not supported.</p>

<!--
This API takes a namespace and a session as a parameter and deletes all session properties belonging to the namespace and session. It also removes the TTL applied to the session.

| Method | Path |
| --- | --- |
| DELETE | ​/v1​/account​/{accountId}​/namespace​/{customNamespace}​/session​/{sessionId} |

Request payload example:<br>
N/A

Example:
```bash
curl -X DELETE "https://{domain}/v1/account/{accountId}/namespace/myNamespace/session/mySessionId" -H "accept: */*" -H "maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="
```

Response payload example:<br>
Empty body; status code = 204
-->

<h4 id="delete-all-properties-belonging-to-session-without-ttl-setting">Delete all properties belonging to Session without TTL setting</h4>
<p>This API takes a namespace and a session as a parameter and deletes all session properties belonging to the namespace and session. However, it does not remove the TTL applied to the session.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>DELETE</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/{sessionId}​/properties</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> DELETE <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/mySessionId/properties"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="delete-a-namespace-property">Delete a namespace property</h4>
<p>This API takes a namespace and a property name as a parameter and deletes the namespace property.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>DELETE</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/properties​/{property}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> DELETE <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/properties/myProperty1"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="delete-a-session-property">Delete a session property</h4>
<p>This API takes a namespace, a session and a property name as a parameter and deletes the session property.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>DELETE</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/{sessionId}​/properties​/{property}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> DELETE <span class="s2">"https://{domain}/v1/account/{accountId}/myNamespace/mySessionId/properties/myProperty1"</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="get-all-variables">Get all variables</h4>
<p>The APIs described here are to show a list of sessionIds that have any properties. There are two APIs: The first is to return the SessionIds, and the second is to return the properties with SessionIds.</p>

<p>Because the number of sessions can be quite large, the API supports pagination. There are two optional parameters for this:</p>

<p>page</p>
<ul>
  <li>This sets the index of the page to be returned. Index starts at 0.</li>
  <li>Type: int</li>
  <li>Default value: 0</li>
  <li>Range: A number greater than or equal to zero.</li>
</ul>

<p>perPage</p>
<ul>
  <li>This sets the number of rows returned per page</li>
  <li>Type: int</li>
  <li>Default value : 100</li>
  <li>Range: A number between 1 and 1000</li>
</ul>

<h4 id="get-all-sessionids">Get all sessionIds</h4>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/session-ids</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v1/account/{accountId}/ns1/session-ids?page=0&amp;perPage=100"</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br /></p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>[
   "__default__",
  "mySessionId",
   …
]
</code></pre></div></div>

<h4 id="get-all-properties-within-a-session">Get all properties within a session</h4>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>/v1​/account​/{accountId}​/{customNamespace}​/session-properties</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v1/account/{accountId}/ns1/session-properties?page=0&amp;perPage=100"</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br /></p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>[
  {
    "sessionId": "ss1",
    "property": {
      "key1": "val1",
      "key2": "val2",
    }
  },
  …
]
</code></pre></div></div>

<h3 id="rest-ttl-api">REST TTL API</h3>

<h4 id="set-ttl-on-namespace">Set TTL on Namespace</h4>
<p>This API takes a namespace and ttlSeconds as parameters, and then sets the TTL of the namespace to ttlSeconds. The TTL of all namespace properties created or updated afterwards has the value of ttlSeconds automatically. One thing to note is that the TTL of an existing namespace property does not change until it is updated.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>POST</td>
      <td>/v1/account/{accountId}?ttlSecond={ttlSecond}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
<code class="language-html highlighter-rouge">{ "name": "someCustomNamespace" }</code></p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">--request</span> POST <span class="se">\</span>
<span class="nt">--url</span> https://<span class="o">{</span>domain<span class="o">}</span>/v1/account/<span class="o">{</span>accountId<span class="o">}</span>?ttlSecond<span class="o">=</span>100 <span class="se">\</span>
<span class="nt">--header</span> <span class="s1">'content-type: application/json'</span> <span class="se">\</span>
<span class="nt">--header</span> <span class="s1">'maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=='</span> <span class="se">\</span>
<span class="nt">--data</span> <span class="s1">'{
  "name": "myNamespace"
  }'</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="set-ttl-on-session">Set TTL on Session</h4>
<p>This API takes a namespace, session and ttlSeconds as parameters, and then sets the TTL of the session to ttlSeconds. The TTL of all session properties created or updated afterwards has the value of ttlSeconds automatically. One thing to note is that the TTL of an existing session property does not change until it is updated.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>POST</td>
      <td>/v1/account/{accountId}/namespace/{customNamespace}/session?ttlSecond={ttlSecond}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
<code class="language-html highlighter-rouge">{ "sessionId": "someSessionId" }</code></p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> POST <span class="s1">'https://{domain}/v1/account/{accountId}/namespace/myNamespace/session?ttlSecond=100'</span> <span class="nt">-H</span> <span class="s2">"accept: */*"</span> <span class="nt">-H</span> <span class="s1">'maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=='</span> <span class="nt">-H</span> <span class="s1">'Content-Type: application/json'</span> <span class="nt">-d</span> <span class="s1">'{"sessionId":"mySessionId"}'</span>
</code></pre></div></div>

<p>Response payload example:<br />
Empty body; status code = 204</p>

<h4 id="get-ttl-list-on-namespaces">Get TTL list on Namespaces</h4>
<p>You can use this API to retrieve the list of TTLs applied to a namespace. Please note that this API is not intended to look up all namespaces in use. Even if you are actively using namespaces, they will be excluded from the list unless you have set the TTL.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>​/v1​/account​/{accountId}</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v1/account/{accountId}"</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br /></p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>[
  {
    "name": "myNamespace",
    "createdAt": "2021-02-26T02:46:38.220Z",
    "ttlSecond": 100
  },
  …
]
</code></pre></div></div>

<h4 id="get-ttl-list-on-sessions">Get TTL list on Sessions</h4>
<p>You can use this API to retrieve the list of TTLs applied to the session. Please note that this API is not intended to look up all sessions in use. Even if you are actively using sessions, they will be excluded from the list unless you have set the TTL.</p>

<table>
  <thead>
    <tr>
      <th>Method</th>
      <th>Path</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>GET</td>
      <td>​/v1​/account​/{accountId}​/namespace​/{customNamespace}​/session</td>
    </tr>
  </tbody>
</table>

<p>Request payload example:<br />
N/A</p>

<p>Example:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="syntax"><code>curl <span class="nt">-X</span> GET <span class="s2">"https://{domain}/v1/account/{accountId}/namespace/myNamespace/session"</span> <span class="nt">-H</span> <span class="s2">"accept: application/json"</span> <span class="nt">-H</span> <span class="s2">"maven-api-key: ABCD12BigSbWF2ZW4tcm91dGluZw=="</span>
</code></pre></div></div>

<p>Response payload example:<br /></p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="syntax"><code>[
  {
    "sessionId": "mySessionId",
    "createdAt": "2021-02-26T07:42:13.868Z",
    "ttlSecond": 100
  },
  …
]
</code></pre></div></div>
]]></description>
      <!-- <pubDate>Tue, 05 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Get User Data</title>
      <link>https://developers.liveperson.com/conversation-builder-scripting-functions-get-user-data.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-scripting-functions-get-user-data.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>Retrieving user data lets the bot personalize the conversation and provide a more tailored experience. This article explains how to access various types of user data using built-in scripting functions.</p>

<h3 id="get-user-channel">Get user channel</h3>
<p><code class="language-html highlighter-rouge">getUserChannel</code> returns the platform channel the user is currently communicating on. This function returns:</p>

<ul>
  <li><code class="language-html highlighter-rouge">lp_sms</code> for SMS</li>
  <li><code class="language-html highlighter-rouge">lp_web</code> for Web</li>
  <li><code class="language-html highlighter-rouge">lp_inapp</code> for In-app SDK</li>
  <li><code class="language-html highlighter-rouge">lp_whatsapp</code> for WhatsApp`</li>
  <li><code class="language-html highlighter-rouge">lp_rcs</code> for RCS</li>
  <li><code class="language-html highlighter-rouge">lp_abc</code> for Apple Business Chat, now called Apple Messages for Business</li>
  <li><code class="language-html highlighter-rouge">lp_fb</code> for Facebook and Instagram</li>
  <li><code class="language-html highlighter-rouge">lp_viber</code> for Viber</li>
  <li><code class="language-html highlighter-rouge">lp_line</code> for LINE</li>
  <li><code class="language-html highlighter-rouge">lp_twitter</code> for Twitter, now called X</li>
  <li><code class="language-html highlighter-rouge">lp_voice</code> for Voice</li>
  <li><code class="language-html highlighter-rouge">lp_kakaotalk</code> for KakaoTalk</li>
  <li><code class="language-html highlighter-rouge">lp_wechat</code> for WeChat</li>
  <li><code class="language-html highlighter-rouge">twilio_sms</code> for Twilio SMS</li>
  <li><code class="language-html highlighter-rouge">sms</code> for SMS</li>
  <li><code class="language-html highlighter-rouge">web</code> for Web</li>
  <li><code class="language-html highlighter-rouge">inapp</code> for In-application</li>
</ul>

<p>The "lp_" prefix indicates the LivePerson platform.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">getUserChannel()</code></td>
      <td>None</td>
      <td>lp_sms, lp_web, etc. <strong>See above.</strong></td>
    </tr>
  </tbody>
</table>

<h4 id="example">Example</h4>

<p>The following code retrieves the channel that the user is currently using:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">channel</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getUserChannel</span><span class="p">();</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">"</span><span class="s2">channel used by the user is: </span><span class="dl">"</span> <span class="o">+</span> <span class="nx">channel</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="get-user-platform-id">Get user platform ID</h3>

<p><code class="language-html highlighter-rouge">getUserPlatformId</code> is used to get the user’s unique ID that's valid only within the LivePerson Conversation Builder bot platform. This is the ID by which the bot identifies the user.</p>

<p>This scripting function isn't commonly used. However, it is used by those currently using the Agent Escalation API.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">getUserPlatformId()</code></td>
      <td>None</td>
      <td>string: unique user ID within Conversation Builder</td>
    </tr>
  </tbody>
</table>

<h4 id="example-1">Example</h4>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="c1">// get the user’s ID within CB</span>
<span class="kd">var</span> <span class="nx">userId</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getUserPlatformId</span><span class="p">();</span>
<span class="c1">// display the results…</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">The userPlatformId = </span><span class="dl">'</span> <span class="o">+</span> <span class="nx">userId</span><span class="p">);</span>
</code></pre></div></div>

<h3 id="get-authenticated-customer-info">Get authenticated customer info</h3>

<p><code class="language-html highlighter-rouge">getLPUserPersonalInfo</code> and <code class="language-html highlighter-rouge">getLPCustomerInfo</code> return authenticated customer information. You can attempt to see if either method returns true or not.  If the visitor is authenticated (typically they would set personal or customer info being logged in), you can access the Personal Info or Customer Info object array.</p>

<table>
  <thead>
    <tr>
      <th>Function Name</th>
      <th>Arguments</th>
      <th>Returns</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code class="language-html highlighter-rouge">getLPUserPersonalInfo()</code></td>
      <td>See below for accessing attributes</td>
      <td><a href="engagement-attributes-types-of-engagement-attributes.html#personal-info">personal info</a> object or nothing; <strong>Note</strong>: The <code class="language-html highlighter-rouge">address</code> and <code class="language-html highlighter-rouge">language</code> attributes aren't returned.</td>
    </tr>
    <tr>
      <td><code class="language-html highlighter-rouge">getLPCustomerInfo()</code></td>
      <td>See below for accessing attributes</td>
      <td><a href="engagement-attributes-types-of-engagement-attributes.html#customer-info">customer info</a> object or nothing</td>
    </tr>
  </tbody>
</table>

<p class="attn-note">Remote procedure calls (gRPC) and web sockets handle missing info differently. gRPC assigns an empty string ( ““ ) as the default value, while web sockets keep those values null. As a best practice, when checking for missing info, always check for both an empty string ( ““ ) and a null value to properly handle all cases.</p>

<h4 id="personal-info-example">Personal info example</h4>

<p>This is an example JSON object for the Personal Info. Keep in mind that all fields might not be available for your conversation. In addition, one of the following fields (firstname, lastname, company) must be populated for this object to return; otherwise, it will be null.</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
    </span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"personal"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"personal"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
        </span><span class="nl">"firstname"</span><span class="p">:</span><span class="w"> </span><span class="s2">"John"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"lastname"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Doe"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"age"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
            </span><span class="nl">"age"</span><span class="p">:</span><span class="w"> </span><span class="mi">34</span><span class="p">,</span><span class="w">
            </span><span class="nl">"year"</span><span class="p">:</span><span class="w"> </span><span class="mi">1980</span><span class="p">,</span><span class="w">
            </span><span class="nl">"month"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w">
            </span><span class="nl">"day"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="w">
        </span><span class="p">},</span><span class="w">
        </span><span class="nl">"contacts"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
            </span><span class="p">{</span><span class="w">
                </span><span class="nl">"email"</span><span class="p">:</span><span class="w"> </span><span class="s2">"myname@example.com"</span><span class="p">,</span><span class="w">
                </span><span class="nl">"phone"</span><span class="p">:</span><span class="w"> </span><span class="s2">"+1 555-333-7777"</span><span class="p">,</span><span class="w">
                </span><span class="nl">"phoneType"</span><span class="p">:</span><span class="w"> </span><span class="s2">"HOME"</span><span class="w">
            </span><span class="p">}</span><span class="w">
        </span><span class="p">],</span><span class="w">
        </span><span class="nl">"gender"</span><span class="p">:</span><span class="w"> </span><span class="s2">"MALE"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"company"</span><span class="p">:</span><span class="w"> </span><span class="s2">"company"</span><span class="w">
    </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p>Here is how you might use the <code class="language-html highlighter-rouge">getLPUserPersonalInfo()</code> method in JavaScript to check for a user’s first and last name.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">personalInfo</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getLPUserPersonalInfo</span><span class="p">();</span>
<span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">PERSONAL INFO:</span><span class="dl">'</span><span class="o">+</span><span class="nx">personalInfo</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="nx">personalInfo</span><span class="p">){</span>
    <span class="kd">var</span> <span class="nx">fullName</span> <span class="o">=</span> <span class="nx">personalInfo</span><span class="p">.</span><span class="nx">firstname</span><span class="o">+</span><span class="dl">"</span><span class="s2"> </span><span class="dl">"</span><span class="o">+</span><span class="nx">personalInfo</span><span class="p">.</span><span class="nx">lastname</span><span class="p">;</span>
    <span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">Full Name: </span><span class="dl">'</span><span class="o">+</span><span class="nx">fullName</span><span class="p">);</span>
    <span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="dl">"</span><span class="s2">fullName</span><span class="dl">"</span><span class="p">,</span><span class="nx">fullName</span><span class="p">,</span><span class="kc">true</span><span class="p">,</span><span class="kc">false</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<h4 id="customer-info-example">Customer info example</h4>

<p>Here is an example JSON object for the Customer Information.</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="p">{</span><span class="w">
    </span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ctmrinfo"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"info"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
        </span><span class="nl">"companyBranch"</span><span class="p">:</span><span class="w"> </span><span class="s2">"test"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"ctype"</span><span class="p">:</span><span class="w"> </span><span class="s2">"vip"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"customerId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"138766AC"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"balance"</span><span class="p">:</span><span class="w"> </span><span class="mf">-400.99</span><span class="p">,</span><span class="w">
        </span><span class="nl">"currency"</span><span class="p">:</span><span class="w"> </span><span class="s2">"USD"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"socialId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"11256324780"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"imei"</span><span class="p">:</span><span class="w"> </span><span class="s2">"99887766554433"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"userName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"user000"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"companySize"</span><span class="p">:</span><span class="w"> </span><span class="mi">500</span><span class="p">,</span><span class="w">
        </span><span class="nl">"accountName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"bank corp"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"role"</span><span class="p">:</span><span class="w"> </span><span class="s2">"broker"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"lastPaymentDate"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
            </span><span class="nl">"day"</span><span class="p">:</span><span class="w"> </span><span class="mi">15</span><span class="p">,</span><span class="w">
            </span><span class="nl">"month"</span><span class="p">:</span><span class="w"> </span><span class="mi">10</span><span class="p">,</span><span class="w">
            </span><span class="nl">"year"</span><span class="p">:</span><span class="w"> </span><span class="mi">2014</span><span class="w">
        </span><span class="p">},</span><span class="w">
        </span><span class="nl">"registrationDate"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
            </span><span class="nl">"day"</span><span class="p">:</span><span class="w"> </span><span class="mi">23</span><span class="p">,</span><span class="w">
            </span><span class="nl">"month"</span><span class="p">:</span><span class="w"> </span><span class="mi">5</span><span class="p">,</span><span class="w">
            </span><span class="nl">"year"</span><span class="p">:</span><span class="w"> </span><span class="mi">2013</span><span class="w">
        </span><span class="p">},</span><span class="w">
        </span><span class="nl">"storeNumber"</span><span class="p">:</span><span class="w"> </span><span class="s2">"123865"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"storeZipCode"</span><span class="p">:</span><span class="w"> </span><span class="s2">"20505"</span><span class="w">
    </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<p>Here is how you might use the <code class="language-html highlighter-rouge">getLPCustomerInfo()</code> method in JavaScript to check for a user’s customerId.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="syntax"><code><span class="kd">var</span> <span class="nx">customerInfo</span> <span class="o">=</span> <span class="nx">botContext</span><span class="p">.</span><span class="nx">getLPCustomerInfo</span><span class="p">();</span>
<span class="k">if</span><span class="p">(</span><span class="nx">customerInfo</span><span class="p">){</span>
    <span class="kd">var</span> <span class="nx">customerId</span> <span class="o">=</span> <span class="nx">customerInfo</span><span class="p">.</span><span class="nx">customerId</span><span class="p">;</span>
    <span class="nx">botContext</span><span class="p">.</span><span class="nx">printDebugMessage</span><span class="p">(</span><span class="dl">'</span><span class="s1">customerId: </span><span class="dl">'</span><span class="o">+</span><span class="nx">customerId</span><span class="p">);</span>
    <span class="nx">botContext</span><span class="p">.</span><span class="nx">setBotVariable</span><span class="p">(</span><span class="dl">"</span><span class="s2">customerId</span><span class="dl">"</span><span class="p">,</span><span class="nx">customerId</span><span class="p">,</span><span class="kc">true</span><span class="p">,</span><span class="kc">false</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>
]]></description>
      <!-- <pubDate>Mon, 04 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Custom Code</title>
      <link>https://developers.liveperson.com/conversation-builder-best-practices-custom-code.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-best-practices-custom-code.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>Some bots do a lot of computing via JavaScript. For optimal performance, follow these requirements and best practices.</p>

<h3 id="requirements">Requirements</h3>

<ul>
  <li>Custom JavaScript code should be compatible with ES5, i.e., ECMAScript 5 (2009). And there is an exception: The toLocaleString method isn't supported.</li>
  <li>Custom JavaScript code must complete within 5 seconds. Otherwise, it times out, and the execution flow continues on as per the <a href="conversation-builder-interactions-interaction-basics.html#order-of-operations">order of operations</a>. In general, the code shouldn’t do heavy calculations and should be fast.</li>
</ul>

<p class="attn-note">There’s no limit imposed by LivePerson Conversation Builder as to the size of your methods, but Java itself might impose one. If you encounter an error that your method code is too large, split the method into smaller ones.</p>

<h3 id="things-to-do">Things to do</h3>

<ul>
  <li>Catch issues early in bot development by inserting debug statements into the code to verify things work as you expect.</li>
  <li>Use loops wisely. Avoid time-consuming external API calls from within loops, as the call might time out before the loop finishes.</li>
  <li>
    <p>Use try-catch blocks inside interactions that have code with methods that can throw exceptions that need to be caught. Log a custom event to save the error.</p>

    <p><img class="fancyimage" style="width:600px" src="img/ConvoBuilder/trycatchblock.png" alt="Example try-catch block in Pre-Process Code of an interaction" /></p>
  </li>
  <li>Expect that tokens will expire and implement proper checks for this. It’s common to initialize a token within the bot’s Global Functions and use it in API calls elsewhere within the bot. If the API call fails, fetch the token again within the same global variables.</li>
  <li>
    <p>Take advantage of the Global Helper Functions <a href="conversation-builder-global-functions.html#global-helper-functions-dialog-template">dialog template</a> and <a href="conversation-builder-global-functions.html#global-helper-functions-bot-template">bot template</a> provided by LivePerson. The bot template is for educational purposes, while the dialog template can be imported into your bot to “add in” the global helper functions that are included.</p>

    <p>The global helper functions are designed to simplify the use of custom code. They’re recommended and useful for bots that have logic implemented via custom code in interactions or integrations. Use the helper functions in your bot’s <a href="conversation-builder-global-functions.html">global functions</a> to capture needed info and process common methods without having to write botContext methods.</p>
  </li>
  <li>
    <p>Remote procedure calls (gRPC) and web sockets handle missing info differently. gRPC assigns an empty string ( ““ ) as the default value, while web sockets keep those values null. As a best practice, when checking for missing info, always check for both an empty string ( ““ ) and a null value to properly handle all cases.</p>
  </li>
  <li>When setting a bunch of variables in the Conversation Context Service (so you can use them to guide the bot flow), make a single API call submitting an object of key/value pairs. <a href="conversation-builder-scripting-functions-manage-the-conversation-context-service.html#examples">See our example.</a></li>
  <li>When writing code that transfers to a skill, check for a null value for that skill. This helps to ensure a successful transfer.</li>
  <li>When writing code that “wakes up” an idle bot (for example, with “hi”), take the bot’s configured <a href="conversation-builder-bots-bot-basics.html#configure-bot-settings">session length</a> into consideration. If the bot is awakened after the session has expired, there won’t be any available conversational context. So, the flow that follows will not be as desired.</li>
</ul>

<h3 id="things-to-avoid">Things to avoid</h3>

<ul>
  <li>Avoid adding complex JavaScript in a single spot. Instead, practice component-based development: Try to componentize the code, breaking it into identifiable and reusable pieces that are easier to use and debug.</li>
  <li>Avoid too many context or third-party API calls in one JavaScript layer. Instead, split the calls into multiple interactions if possible.</li>
</ul>

<h3 id="handling-exceptions-and-errors">Handling exceptions and errors</h3>

<ul>
  <li>Catch and handle exceptions and errors gracefully. And use the <a href="conversation-builder-scripting-functions-log-debug.html#log-custom-event">logCustomEvent scripting function</a> to log the error.</li>
  <li>Handle timeouts and recover from them gracefully. Timeouts can happen due to latency in calls to external APIs. One way to recover the flow is to put in place checks within the JavaScript or in the next interaction. Handle the issue gracefully, retry, or bring the conversation context back to the prior interaction, i.e., return to an earlier point in the flow.</li>
</ul>
]]></description>
      <!-- <pubDate>Mon, 04 Aug 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Reports</title>
      <link>https://developers.liveperson.com/knowledgeai-reports.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-reports.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p>The <strong>Consumer Queries</strong> view provides access to query-and-answer data via a "KbSearchEvents" report that you can download. The report contains info on consumer queries, matched articles (if any), how articles were matched, the confidence scores, and more. Use the report to understand article effectiveness and to tune articles.</p>

<p><a href="knowledgeai-optimizing-your-content-evaluate-consumer-queries.html#access-consumer-queries">Learn how to access the Consumer Queries view.</a></p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_csq17.png" alt="The Download icon for downloading query-and-answer info" /></p>
]]></description>
      <!-- <pubDate>Wed, 30 Jul 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Manager Bots</title>
      <link>https://developers.liveperson.com/conversation-builder-bots-manager-bots.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-bots-manager-bots.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="whats-a-manager-bot">What’s a manager bot?</h3>

<p>“Manager bot” is a widely used term, but it’s a bit of a misnomer because the term “manager” has more to do with the bot agent than it does with the bot itself.</p>

<p>A manager bot is simply a bot with an <a href="conversation-builder-testing-deployment-deploy-the-bot.html#add-an-agent-connector">agent connector</a> that’s configured in a specific way that allows the bot agent to listen to all consumer messages on the account. This is the case for automated conversations with other bots, and for conversations with human agents.</p>

<p>In the bot itself, there is no specific design that’s needed. No specific dialogs or interactions are required. The bot can do whatever you need it to do. There is also no difference in the way the bot works. Once the bot receives a message, it processes the message just as it would if the message were passed via a regular bot agent. If the message triggers a dialog in the bot, the dialog’s flow begins.</p>

<h3 id="use-cases-for-manager-bots">Use cases for manager bots</h3>

<p>Typically, you use manager bots that listen to all consumer messages to invoke actions such as:</p>

<ul>
  <li>Send a message or email to managers. You might want to alert managers that a consumer has triggered a critical intent (such as “self harm”). You can include the conversation ID, what the consumer said, etc., in that communication.</li>
  <li>Transfer the conversation to a manager. You can check to ensure the manager is online before transferring.</li>
  <li>Send a private message to the agent. This message can provide guidance on how to handle the conversation.</li>
  <li>Report on an event. This might involve tagging the conversation with an <a href="engagement-attributes.html">engagement attribute</a> (SDE).</li>
  <li>Trigger a <a href="liveperson-functions-overview.html">LivePerson function</a> (FaaS function) or integration, i.e., call an external API.</li>
</ul>

<p>Common use cases include:</p>

<ul>
  <li><strong>Logging/escalation bot in a vulnerable consumer scenario</strong>: This solution involves detecting statements of self-harm in the consumer message, so the conversation can be transferred immediately to a specialized agent or team. The solution can also involve logging the event in Bot Analytics via <a href="conversation-builder-best-practices-custom-event-logging.html">custom events</a>, messaging the consumer, and/or sending a <a href="conversation-builder-interactions-statements.html#private-message">private message</a> to the agent.</li>
  <li><strong>Queue management/wake-up bot</strong>: If the conversation meets specific criteria (that is, it’s been in the queue for a certain number of minutes), this solution uses a <a href="liveperson-functions-overview.html">LivePerson function</a> to send a message via the <a href="conversation-builder-integrations-web-view-integration-api.html">Web View Integration API</a> to the manager bot. In turn, the manager bot either sends a message to the consumer, or transfers the conversation to another bot that does. Note that this solution requires that LivePerson enable some functionality behind the scenes. Contact us to explore this solution.</li>
</ul>

<h3 id="setup">Setup</h3>

<h4 id="bot-setup">Bot setup</h4>

<p>You create and implement a manager bot just like any other bot. There is no difference in building the bot.</p>

<p>What’s different is how you set up the bot’s agent connector. For <strong>Role</strong>, select “Manager,” not “Agent.”</p>

<p><img class="fancyimage" style="width:800px" src="img/ConvoBuilder/managerbot1.png" alt="The Add Agent Connector window, with a callout to the Role field" /></p>

<p class="attn-note">Keep in mind the default value of the <a href="conversation-builder-testing-deployment-deploy-the-bot.html#maxconsumermessagedelay">maxConsumerMessageDelay</a> custom configuration field. You might want to change the value in the bot’s agent connector.<br /><br />Also, there are several <a href="https://developers.liveperson.com/conversation-builder-testing-deployment-deploy-the-bot.html#custom-configuration-fields-for-manager-bots-only">custom configuration fields for manager bots</a> that you can configure in the bot's agent connector as well.</p>

<h4 id="user-setup">User setup</h4>

<ol>
  <li>Make sure that the assigned user (set in <strong>Agent User ID</strong> in the agent connector) has only the Agent Manager profile (and no other profiles).</li>
  <li>Assign the user to manage the "Main Group." Doing this ensures the bot agent can listen to all consumer messages on the account even after the conversation is transferred to a different skill outside of the bot's assigned bot group.</li>
</ol>

<p><img class="fancyimage" style="width:500px" src="img/ConvoBuilder/managerbot2.png" alt="The Add User window, with a callout to the Assignment area" /></p>

<h3 id="best-practices">Best practices</h3>

<ul>
  <li>We recommend that you have LivePerson assist with the configuration of any manager bot, or that you have LivePerson review the configuration before you release the bot into Production.</li>
  <li>Use one manager bot per account. This mitigates the risk of two manager bots conflicting with each other.</li>
  <li>
    <p><strong>Control the load capacity</strong>: In the manager bot’s agent connector, configure the <a href="conversation-builder-testing-deployment-deploy-the-bot.html#filterpatterns">filterPatterns</a> custom configuration field. If set, the bot agent will still listen to all consumer messages. But the bot itself will process only the consumer messages that match a Regular Expression in the list that you specify. If a consumer message doesn’t match an expression, it’s ignored by the bot. Use this field to control the load capacity, so the bot acts on only the messages that you care about.</p>

    <p>For example, if your filter patterns include the word “bill,” the bot will ignore “I want to change my shipping address,” and it will process both “thanks a billion” and “I want to pay my bill.” But if only the latter triggers a dialog flow due to a “pay bill” intent match in one of the bot’s dialog starters, then only the latter will result in an action taken by the bot.</p>
  </li>
  <li>Plan and build carefully to ensure that the manager bot doesn’t send the consumer undesired messages inadvertently.</li>
</ul>

<h3 id="limitations">Limitations</h3>

<ul>
  <li>Due to an enforced limit, a single bot agent connector can handle a maximum of 999 concurrent conversations. If this is exceeded, the conversations in the overflow aren't assigned to the bot agent because it's at capacity. To control the load capacity, we recommend  that you configure the <a href="conversation-builder-testing-deployment-deploy-the-bot.html#filterpatterns">filterPatterns</a> custom configuration field. For example, if there are 1,000 concurrent conversations, and 100 match the patterns, then the manager bot still has a capacity of almost 900.</li>
  <li>Manager bots listen to <strong>all</strong> consumer messages on your account. If you add two agent connectors for a manager bot—in an attempt to distribute the conversation load—this won’t work. It will result in both agent connectors joining all the same conversations. Again, to control the load capacity, we recommend that you configure the <a href="conversation-builder-testing-deployment-deploy-the-bot.html#filterpatterns">filterPatterns</a> custom configuration field in the agent connector, so the bot processes and acts on only messages that match specific Regular Expressions.</li>
  <li>Manager bots listen to only <strong>consumer</strong> messages. They don’t listen to agent messages, so you can’t trigger actions based on agent messages. This precludes you from listening for and acting on bad language used by agents, agents ignoring policies, etc.</li>
</ul>

<h3 id="solutions-using-the-web-view-integration-api">Solutions using the Web View Integration API</h3>

<p>Using the <a href="conversation-builder-integrations-web-view-integration-api.html">Web View Integration API</a> to post info back to a manager bot? Provide your account ID to your LivePerson account representative, so they can get that added to our backend configuration list.</p>

<p>Conversations on accounts in the list take longer to expire. Adding your account to our list can avoid a situation where the Web View Integration API tries to send a message to the bot runtime, but the conversation has already expired.</p>

<p class="attn-note">When calling the Web View Integration API, you <strong>must</strong> prefix <code class="language-html highlighter-rouge">MANAGER:::</code> to the <code class="language-html highlighter-rouge">userplatformId</code> to ensure the Web View message is processed. This is to satisfy underlying architecture requirements. Otherwise, the bot becomes stuck.</p>
]]></description>
      <!-- <pubDate>Fri, 18 Jul 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Key Terms &amp; Concepts</title>
      <link>https://developers.liveperson.com/trustworthy-generative-ai-prompt-library-key-terms-concepts.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/trustworthy-generative-ai-prompt-library-key-terms-concepts.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="prompts">Prompts</h3>

<p>In the context of Large Language Models (LLMs), the prompt is the text or input that is given to the model in order to receive generated text as output. Prompts can be a single sentence, a paragraph, or even a series of instructions or examples.</p>

<p>The LLM uses the provided prompt to understand the context and generate a coherent and relevant response. The quality and relevance of the generated response depend on the clarity of the instructions and how well the prompt conveys your intent.</p>

<p>The interaction between the prompt and the model is a key factor in determining the accuracy, style, and tone of the generated output. It's crucial to formulate prompts effectively to elicit the desired type of response from the model. <a href="trustworthy-generative-ai-prompt-library-best-practices.html#writing-prompt-instructions">See our best practices for writing prompt instructions.</a></p>

<h3 id="prompt-library">Prompt Library</h3>

<p>The Prompt Library is the user interface that you use to select and manage prompts.</p>

<p><img style="width:800px" src="img/PromptLibrary/promptLibrary1.png" alt="A view of the Prompt Library with the account's prompts listed" /></p>

<h3 id="prompt-templates">Prompt templates</h3>

<p>Prompt templates are essentially prompts that are created, tested, and maintained by LivePerson. They’re intended to get you up and running quickly, so you can explore a Generative AI solution.</p>

<p>Whenever you select to use a prompt template, a complete copy is made. You can customize it if desired. Once it's saved and selected, the copy is added to <strong>My Prompts</strong> in the Prompt Library. This is so that subsequent changes we make to the template don’t inadvertently affect the behavior of your solution.</p>

<p><img style="width:800px" src="img/PromptLibrary/promptLibrary2.png" alt="A view of the Prompt Library with LivePerson's templates listed" /></p>

<p>Again, there’s no relationship between a prompt template that you’ve copied and your copy itself. Your copy is independent by design: We don’t want our updates to the prompt templates to affect your solution inadvertently.</p>

<h3 id="custom-prompts">Custom prompts</h3>

<p>Custom prompts are prompts created by users of your account and visible only to the same. They’re tailored to suit your specific requirements. You can create custom prompts:</p>

<ul>
  <li><a href="trustworthy-generative-ai-prompt-library-manage-prompts.html#create-a-prompt-by-copying-a-liveperson-template">By copying a LivePerson prompt template</a></li>
  <li><a href="trustworthy-generative-ai-prompt-library-manage-prompts.html#create-a-prompt-by-copying-another-prompt">By copying one of your prompts</a></li>
  <li><a href="trustworthy-generative-ai-prompt-library-manage-prompts.html#create-a-prompt-from-scratch">From scratch</a></li>
</ul>

<h3 id="released-prompts">Released prompts</h3>

<p>The <strong>latest version</strong> of a prompt is always the released version that’s used by the client applications: Conversation Assist, the LivePerson Conversation Builder bot, etc.</p>

<p>Follow our <a href="trustworthy-generative-ai-prompt-library-best-practices.html#releasing-prompt-changes">best practices for releasing prompt changes</a>.</p>

<h3 id="tokens">Tokens</h3>

<p>LLMs handle text by segmenting it into units called <em>tokens</em>. Tokens represent common sequences of characters. For instance, the word "infrastructure" is dissected into "inf" and "rastructure" while a word like "bot" remains a single token.</p>

<p>An LLM’s <em>context window</em> is the total number of tokens permitted by the model. This window encompasses both the number of input tokens sent to the model and the number of generated tokens in the model’s response. The context window is about the two…combined. Every model has a fixed context window that’s based on computational constraints.</p>

<p>When considering input tokens plus generated tokens, for most LLMs, it’s relatively easy to stay well within the LLM’s context window. But be aware it exists.</p>

<h4 id="learn-more-about-tokens">Learn more about tokens</h4>

<ul>
  <li><a href="https://platform.openai.com/docs/introduction/tokens">https://platform.openai.com/docs/introduction/tokens</a></li>
  <li><a href="https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them">https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them</a></li>
  <li><a href="https://platform.openai.com/tokenizer">https://platform.openai.com/tokenizer</a></li>
  <li><a href="https://platform.openai.com/docs/guides/text-generation/managing-tokens">https://platform.openai.com/docs/guides/text-generation/managing-tokens</a></li>
</ul>

<h3 id="hallucinations">Hallucinations</h3>

<p>Hallucinations are situations where the underlying LLM service generates incorrect or nonsensical responses, or responses that aren't grounded in the contextual data or brand knowledge that was provided.</p>

<p>For example, suppose the consumer asks, “Tell me about your 20% rebate for veterans.” If the presupposition within that query (that such a rebate exists) is regarded as true by the LLM service, when in fact it is not true, the LLM service will hallucinate and send an incorrect response.</p>

<p>Be aware that all prompts have the potential for hallucinations. Typically, this happens when the model relies too heavily on its language model and fails to effectively leverage the provided source content. The degree of risk here depends on the prompt style that’s used. For example, if your solution uses answers that are enriched via Generative AI, consider these questions:</p>

<ul>
  <li>Does the prompt direct the service to respond using only the info in the matched articles?</li>
  <li>Does the prompt direct the service to adhere to the script in the matched articles as much as possible?</li>
  <li>Does the prompt direct the service to come up with answers independently when necessary (i.e., when no relevant articles are matched), using both the info in the conversation context and in its language model?</li>
</ul>

<p>It’s important to carefully evaluate the prompts that you create regarding questions like those above. Strike a balance between constraint and freedom that aligns with the level of risk that you accept. And always test your prompts thoroughly before using them in Production.</p>

<p class="attn-note">Conversational Cloud's LLM Gateway has a <a href="trustworthy-generative-ai-llm-gateway.html#hallucination-detection-post-processing">Hallucination Detection post-processing</a> service that detects and handles hallucinations with respect to URLs, phone numbers, and email addresses.</p>

<h3 id="prompt-updates-by-liveperson">Prompt updates by LivePerson</h3>

<p>New prompts released by LivePerson won't impact your solution; we'll release new prompts as separate prompts that have new and unique names.</p>
]]></description>
      <!-- <pubDate>Fri, 18 Jul 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Set Up Bots</title>
      <link>https://developers.liveperson.com/conversation-assist-setup-set-up-bots.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-assist-setup-set-up-bots.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note">Just getting started? Complete the <a href="tutorials-use-conversation-assist-overview.html">Using Conversation Assist</a> tutorial.<br /><br />It takes up to 3 hours for changes in Conversation Assist configuration to take effect.</p>

<h3 id="supported-bot-types">Supported bot types</h3>

<ul>
  <li>Bots created in LivePerson Conversation Builder</li>
  <li>Bots created in Google Dialogflow ES and CX</li>
  <li>Bots created in IBM Watson Assistant v1 and v2</li>
  <li>Any third-party bot made available via LivePerson Functions (FaaS) or a custom endpoint</li>
</ul>

<h3 id="step-1-create-the-bot">Step 1: Create the bot</h3>

<p>Create at least one bot.</p>

<p class="attn-tip">New to Conversation Builder? Check out the <a href="tutorials-get-started-with-bot-building-messaging-overview.html">Getting Started with Bot Building - Messaging</a> tutorial series. If you intend to build your bots using a third-party application, see <a href="third-party-bots-getting-started.html">this Getting Started info</a>.</p>

<h3 id="step-2-create-the-bot-user">Step 2: Create the bot user</h3>

<p>In <strong>Users &amp; Skills</strong>, create a bot user for the bot. This is illustrated in the <a href="tutorials-use-conversation-assist-overview.html">Conversation Assist tutorial</a>. Specify a bot user name that make sense for your use case.</p>

<h3 id="step-3-deploy-the-bot">Step 3: Deploy the bot</h3>

<p>If you've created a Conversation Builder bot, then use Conversation Builder to deploy the bot. This is illustrated in the Conversation Builder <a href="tutorials-get-started-with-bot-building-messaging-deploy-the-bot.html">Deploy the Bot</a> tutorial. When you add the agent connector for the bot, be sure to select to allow messaging conversations. And after adding the agent connector, be sure to start it to enable the bot to handle traffic.</p>

<p>To connect a third-party bot, follow <a href="third-party-bots-getting-started.html">this Getting Started Guide</a>. Then follow the specific guide for the vendor you're using. Be sure to press the play button in the bot dashboard to enable the bot.</p>

<h3 id="step-4-create-bot-level-recommendation-rules">Step 4: Create bot-level recommendation rules</h3>

<p>In this step, you create the rules that determine when the bot is offered as a recommendation to agents.</p>

<ol>
  <li><a href="conversation-assist-overview.html#access-conversation-assist">Access Conversation Assist</a>, and click <strong>Recommendation Sources</strong>.</li>
  <li>Click the <strong>Bots</strong> tab.</li>
  <li>Click <strong>Add rule</strong>.</li>
  <li>Define the rule that determines when the bot(s) are recommended to agents. Each rule element is described farther below.</li>
  <li>Click <strong>Save and activate</strong>.</li>
  <li>Add additional rules as you require.</li>
</ol>

<h4 id="rule-elements---general">Rule elements - general</h4>

<p><img width="800" alt="General attributes of a rule" src="img/agentassist/rules_bot_general_attr.png" /></p>

<ul>
  <li><strong>Name</strong>: Enter a short, meaningful, and unique name that highlights the rule’s basic function and purpose. It's important to name the rule well, so you can leverage reporting effectively.</li>
  <li><strong>Description</strong>: If desired, provide a more in-depth description of the rule: rationale, approach, i.e., anything that’s useful.</li>
  <li>
    <p><strong>Skills</strong>: Select the Conversational Cloud skills that you want this rule to apply to. You must specify at least one skill. A skill can be used in only one bot rule.</p>

    <p>In conversations routed to these skills, bots specified in this rule are returned by KnowledgeAI™ to Conversation Assist. (A conversation is routed to the skills assigned to the campaign's engagement.)</p>

    <p class="attn-note">When specifying the skills, <a href="conversation-assist-setup-before-you-begin.html">carefully consider which automations you want to expose through each skill serviced by human agents</a>.</p>
  </li>
</ul>

<h4 id="rule-elements---add-ons">Rule elements - add-ons</h4>

<p>A rule add-on completes the rule’s definition. You must define at least one rule add-on because, at a minimum, that’s where you specify the bots to use in the rule.</p>

<p>If you define multiple add-ons, the order of the add-ons matters: At runtime, the add-ons are evaluated in order, and only the first one that’s matched is executed. So, order the add-ons as you require.</p>

<p><img width="800" alt="The add-on attributes of a rule, with a callout to the move icon that can be used for reordering add-ons" src="img/agentassist/rules_bot_addons1.png" /></p>

<ul>
  <li><strong>For agents belonging to</strong>: You can further limit bot recommendations to specific Conversational Cloud agent groups and/or profiles. Carefully consider which automations you want to expose to specific groups and/or profiles. Or, if the rule will be only skill-based, leave these blank.</li>
  <li>
    <p><strong>Offer recommendations</strong>: Select where the recommendations should be offered. You can select “in conversations only,” “in On-demand widget only,” or “in conversations and in On-demand widget.”</p>

    <p class="attn-note">Keep in mind that agents only receive recommendations in conversations if the <strong>Inline recommendations</strong> setting on Conversation Assist's <strong>Settings</strong> page is turned on. That setting takes precedence over all knowledge base rules.</p>
  </li>
  <li><strong>Recommend bots</strong>: Specify here the bots that are in play. Also specify the minimum confidence score that the bot must have to be retrieved. The higher the score, the more relevant the match. To increase the likelihood of a matched bot, try a lower score.</li>
</ul>

<h4 id="example-rule">Example rule</h4>

<p>Our example rule below is for a fictitious, national automotive brand named Acme Auto. The rule is for a single skill named <code class="language-html highlighter-rouge">Support</code>, which the brand assigns to all of its customer support agents.</p>

<p><img width="800" alt="Name, description, and assigned skill for an example rule" src="img/agentassist/rules_bot_addons_ex1.png" /></p>

<p>Acme Auto agents are highly specialized, so the brand divides its agents into two Conversational Cloud agent groups:</p>

<ul>
  <li><code class="language-html highlighter-rouge">ICE Support</code> for handling FAQs about cars with an internal combustion engine (ICE)</li>
  <li><code class="language-html highlighter-rouge">EV Support</code> for handling FAQs about electric vehicles (EV)</li>
</ul>

<p>Thus, the rule shown above includes two add-ons: The first add-on is for offering the <code class="language-html highlighter-rouge">ICE Car Finder</code> bot as a recommentation to agents in the <code class="language-html highlighter-rouge">ICE Support</code> agent group. The second add-on is for offering the <code class="language-html highlighter-rouge">EV Car Finder</code> bot as a recommendation to agents in the <code class="language-html highlighter-rouge">EV Support</code> agent group.</p>

<p>So, for example, for an agent to receive the <code class="language-html highlighter-rouge">EV Car Finder</code> bot as a recommendation, the following must happen:</p>

<ul>
  <li>The agent must pick up a conversation that is routed to the <code class="language-html highlighter-rouge">Support</code> skill. (A conversation is routed to the skills assigned to the campaign's engagement.)</li>
  <li>The agent must be in the <code class="language-html highlighter-rouge">EV Support</code> agent group.</li>
</ul>

<p>As mentioned earlier, the order of the add-ons matters: At runtime, the add-ons are evaluated in order, and the first one that’s matched is executed. So, in our example here, if the agent were a member of both groups, the agent would never receive the <code class="language-html highlighter-rouge">EV Car Finder</code> bot as a recommendation because the first add-on (for the <code class="language-html highlighter-rouge">ICE Support</code> agent group) always evaluates to true for the agent.</p>

<h3 id="step-5-configure-settings">Step 5: Configure settings</h3>

<ol>
  <li><a href="conversation-assist-overview.html#access-conversation-assist">Access Conversation Assist</a>, and click <strong>Settings</strong>.</li>
  <li>Configure relevant <a href="conversation-assist-setup-configure-settings.html">settings</a>.</li>
</ol>

<h3 id="related-articles">Related articles</h3>

<ul>
  <li><a href="conversation-assist-key-terms-concepts-basic-concepts.html#how-rules-are-evaluated">Learn how a rule's add-ons are evaluated.</a></li>
  <li><a href="conversation-assist-key-terms-concepts-basic-concepts.html#how-recommendations-are-offered">Learn how bot recommendations are made.</a></li>
  <li><a href="conversation-assist-key-terms-concepts-bot-recommendations.html#delegating-conversations-to-bots">Learn how conversations are delegated to bots.</a></li>
</ul>
]]></description>
      <!-- <pubDate>Wed, 16 Jul 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Evaluate Consumer Queries</title>
      <link>https://developers.liveperson.com/knowledgeai-optimizing-your-content-evaluate-consumer-queries.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-optimizing-your-content-evaluate-consumer-queries.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="whats-the-consumer-queries-view">What’s the Consumer Queries view?</h3>

<p>After you’ve rolled out your KnowledgeAI™ integrations, and they’ve spent some time at work in Production, you might ask:</p>

<ul>
  <li>What questions are consumers asking?</li>
  <li>Are the right answers being served at the right time?</li>
  <li>How do I improve answer performance?</li>
</ul>

<p>These are great questions that the Consumer Queries view helps to answer. The view is a historical look at:</p>

<ul>
  <li>The questions (<em>“How do I cancel an order?”</em>) and other intentful messages (<em>“I want to cancel an order”</em>) sent by your consumers and used in knowledge base searches to find answers</li>
  <li>The answers returned in response (when answers were, indeed, returned)</li>
</ul>

<p><img style="width:800px" src="img/ConvoBuilder/kai_csq1.png" alt="Example of the Consumer Queries page" /></p>

<p>Use the view to evaluate both answered and unanswered queries. Both vantage points help you to audit your content and improve the answer quality.</p>

<p>Consider this scenario:</p>

<ol>
  <li>You use the Consumer Queries view to <strong>review the questions</strong> your consumers are asking.</li>
  <li>
    <p>In checking out the <strong>unanswered queries</strong> in particular, you <strong>discover a trend</strong>. There’s a question that’s asked frequently.</p>

    <p><img style="width:400px" src="img/ConvoBuilder/kai_csq2.png" alt="An example of an unanswered question" /></p>
  </li>
  <li>
    <p>Right within the view, you act. You <strong>quickly add an article</strong>, tying it to an intent that you also create on-the-fly using the unanswered query.</p>

    <p><img style="width:700px" src="img/ConvoBuilder/kai_csq3.png" alt="Using the Consumer Queries view to add an article to answer a question" /></p>
  </li>
</ol>

<p>Or, how about this scenario?</p>

<ol>
  <li>This time, you’re checking out the <strong>answered queries</strong>.</li>
  <li>
    <p>You see a consumer query that was answered with the <strong>wrong article</strong>.</p>

    <p><img style="width:400px" src="img/ConvoBuilder/kai_csq4.png" alt="An example of an answered question" /></p>
  </li>
  <li>
    <p>Right within the view, you fix this. You <strong>add the query as a training phrase</strong> to the correct intent to improve its intent matching.</p>

    <p><img style="width:600px" src="img/ConvoBuilder/kai_csq5.png" alt="Using the Consumer Queries view to add the consumer query as a  training phrase to the associated intent" /></p>

    <p>(In this flow and in others, <a href="intent-manager-build-intents.html#find-similar-training-phrases-in-your-consumer-messages">similar training phrases can be automatically found in your consumer messages</a>. This capability uses an Intent Manager feature behind the scenes, and there are some limitations that apply.)</p>
  </li>
</ol>

<h3 id="who-is-the-view-for">Who is the view for?</h3>

<p>The Consumer Queries view is for the person at your organization who is tasked with the following:</p>

<ul>
  <li>Analyzing the performance of your KnowledgeAI integrations (think metrics and key performance indicators)</li>
  <li>Tuning things for improvement</li>
  <li>Content operations</li>
</ul>

<p>Depending on your organization, this might not be the person who implemented your integrations. It could be a more non-technical person that’s closer to the content itself and the voice of the consumer.</p>

<h3 id="access-consumer-queries">Access Consumer Queries</h3>

<ol>
  <li><a href="knowledgeai-overview.html#access-knowledgeai">Access the KnowledgeAI application</a>.</li>
  <li>Select <strong>Test &amp; Tune</strong> in the menu in the upper-left corner.
 The <strong>Consumer Queries</strong> tab is displayed by default.</li>
</ol>

<h3 id="refine-the-view">Refine the view</h3>

<p>Initially, the Consumer Queries view shows you a lot of data. So, the first step is to refine the view, so you can focus on what you want: a particular knowledge base, a time frame, etc. Use the available filters to accomplish this.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_csq6.png" alt="Various controls that let you refine the view" /></p>

<ol>
  <li>Select a specific knowledge base here.</li>
  <li>Use this to display the data for unanswered queries, answered queries, or both.</li>
  <li>Select a time frame here.</li>
  <li>Use this to access even more filters: confidence score (Fair, Fair Plus, Good, Very Good), retrieval type (intent match, text search, CMS match), etc.</li>
  <li>See a bar in the graph that looks interesting? Click it to show only its queries.</li>
</ol>

<h3 id="evaluate-unanswered-queries">Evaluate unanswered queries</h3>

<p>Unanswered queries are those where the knowledge base was searched for an answer, but one wasn’t found. Unanswered queries include:</p>

<ul>
  <li>Queries posed to bots where answers weren’t found</li>
  <li>Queries posed to human agents where answers weren’t found that could be offered to the agents as recommendations for their use (i.e., you’re supporting your agents with a Conversation Assist integration)</li>
</ul>

<p><strong>To evaluate unanswered queries</strong></p>

<ol>
  <li>If desired, refine the view to show only unanswered queries. This simplifies the view.</li>
  <li>
    <p>Review an unanswered consumer query.
 Initially, the query is displayed like this:</p>

    <p><img style="width:400px" src="img/ConvoBuilder/kai_csq7.png" alt="An example of an unanswered query" /></p>

    <p>You can click the down arrow at the bottom of the card to show more information:</p>

    <p><img style="width:400px" src="img/ConvoBuilder/kai_csq8.png" alt="The expanded view of the unanswered query" /></p>
  </li>
  <li>Decide if and how you want to take action:
    <ul>
      <li><strong>Add answer</strong>: Select this if you want to add an answer for the query. This takes you through a guided flow: If you don’t have an existing article that’s suitable to respond to the query, you can create one. And if there is a suitable article, you can add the query as a training phrase to the article’s intent, or add an intent if none exists.</li>
      <li><strong>Don’t answer</strong>: Select this if you don’t want to add an answer for the query. You might want to do this for queries that are non-intentful, such as profanity or other spam-like messages (e.g., “bots are pathetic”). You might even want to do this for intentful messages that you don’t want to address at the moment.</li>
    </ul>

    <p><br />It’s also appropriate to select <strong>Don’t answer</strong> if you’ve already addressed the query. Assume you see a trend where the same unanswered query is asked 5 times. You might add the answer using the first instance, add the second and third instances as training phrases to the same intent, and dismiss the remaining two because they aren’t sufficiently different. Overall, you don’t need to answer the same query over and over.</p>

    <p><strong>Don’t answer</strong> dismisses the query: It simply removes the card from the view to get it out of your way. The card still counts in your  “Reviewed” total though. And if you turn on the <strong>Reviewed</strong> slider, you can see the card again.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/kai_csq9.png" alt="The Reviewed indicator and toggle for showing the queries tht you've already reviewed" /></p>
  </li>
  <li>Repeat this process for other unanswered queries.</li>
</ol>

<h3 id="evaluate-answered-queries">Evaluate answered queries</h3>

<p>Answered queries are those where the knowledge base was searched for an answer, and one was found. Answered queries include:</p>

<ul>
  <li>Queries posed to bots where answers were found and were sent to consumers</li>
  <li>Queries posed to human agents where answers were found and were offered to the agents as recommendations for their use (i.e., you’re supporting your agents with a Conversation Assist integration)</li>
</ul>

<p>Even answered queries can provide opportunities for tuning.</p>

<p><strong>To evaluate answered queries</strong></p>

<ol>
  <li>If desired, refine the view to show only answered queries. This simplifies the view.</li>
  <li>
    <p>Review an answered consumer query.
 Initially, the query is displayed like this:</p>

    <p><img style="width:500px" src="img/ConvoBuilder/kai_csq10.png" alt="An example of an answered query" /></p>

    <p>You can click the down arrow at the bottom of the card to show more information:</p>

    <p><img style="width:400px" src="img/ConvoBuilder/kai_csq11.png" alt="The expanded view of an answered query" /></p>
  </li>
  <li>Evaluate the answer to the query, and then mark the answer with a thumbs up or down:
    <ul>
      <li><img class="inlineimage" style="width:25px" src="img/ConvoBuilder/kai_csq12.png" alt="Thumbs up icon for Good" /> = Good = This means the answer was the right one, and the associated article has good content. Selecting this marks the answer as “Good,” and marks the card as “Reviewed.” There is <strong>no impact</strong> on the system beyond this.</li>
      <li><img class="inlineimage" style="width:25px" src="img/ConvoBuilder/kai_csq13.png" alt="Thumbs down icon for Bad" /> = Bad = The answer was the wrong one, or the associated article has inadequate content. This marks the card as "Reviewed."</li>
    </ul>
  </li>
  <li>
    <p>If you marked the answer as bad, specify why, and click <strong>Next</strong>.</p>

    <p><img style="width:700px" src="img/ConvoBuilder/kai_csq14.png" alt="The Mark query as bad window where you specify why it was bad" /></p>

    <p>The reason you marked the query as bad determines what happens next:</p>
    <ul>
      <li><strong>Wrong content served</strong>: This takes you through a guided flow, right within the view. You’re prompted to find the right article for the query, and to add the query as a training phrase to the article’s intent. If the article doesn’t have an associated intent, you’re prompted to associate an existing one or to create one.</li>
      <li><strong>Inadequate content</strong>: This too takes you through a guided flow, right within the view. You can update the article, and optionally associate an intent.</li>
    </ul>
  </li>
  <li>Repeat this process for other unanswered queries.</li>
</ol>

<h3 id="run-a-test">Run a test</h3>

<p>To quickly run a test on an answered query, select the <strong>Run test</strong> option.</p>

<p><img style="width:600px" src="img/ConvoBuilder/kai_csq15.png" alt="The menu option for Run Test" /></p>

<p>This takes you to the <strong>Test</strong> tab and populates the <strong>Question</strong> field with the consumer query (among other answer criteria), so you can test its performance.</p>

<h3 id="best-practices">Best practices</h3>

<p>Evaluating how your consumers’ queries were and weren’t answered by KnowledgeAI is an important step in the optimization process. To facilitate the best consumer experience, incorporate this step into your regular workflow. For example, you might want to invest some time here weekly.</p>

<h3 id="reports">Reports</h3>

<p>You can download the displayed query-and-answer information via the <strong>Download</strong> icon. This generates a "KbSearchEvents" report that contains info on the consumer's query, the matched article (if any), how the article was matched, the confidence score, and more.</p>

<p><img style="width:800px" src="img/ConvoBuilder/kai_csq17.png" alt="The Download icon for downloading query-and-answer info" /></p>

<h3 id="faqs">FAQs</h3>

<h4 id="i-dont-see-my-knowledge-base-listed-in-the-knowledge-base-dropdown-menu-why-is-this">I don’t see my knowledge base listed in the Knowledge Base dropdown menu. Why is this?</h4>

<p>The menu shows you only the knowledge bases that have been used within the specified time frame. By “used,” we mean that it has powered answers to consumers in bot conversations (via a LivePerson Conversation Builder integration) or served recommended answers to human agents (via a Conversation Assist integration).</p>

<p>Additionally, be aware that currently this feature is only available for internal and external knowledge bases that use AI, i.e., that use Natural Language Understanding (NLU) technology to understand and intelligently match consumer queries to articles. So, if you have an <a href="knowledgeai-external-knowledge-bases-external-kbs-without-liveperson-ai.html">external knowledge base that doesn’t use AI</a>, it won’t be listed in the menu.</p>

<h4 id="a-query-shows-the-conversation-id-and-the-search-criteria-can-you-explain-these">A query shows the conversation ID and the search criteria. Can you explain these?</h4>

<p>Yes, if you expand a consumer query, you can see the ID of the associated conversation and the search criteria that was applied when performing the search of the knowledge base:</p>

<p><img style="width:400px" src="img/ConvoBuilder/kai_csq16.png" alt="The Conversation ID and Search criteria fields on a consumer query card" /></p>

<p>The conversation ID is shown to support additional research, as you might want to look deeper into the context of the query. In Bot Analytics, you can use the conversation ID to display the complete transcript of the conversation.</p>

<p>The search criteria are drawn from the integration. It can give you insight into why certain answers are being served. For example, if you see that an inadequate answer was served and your integration is set to serve answers with a FAIR PLUS score or higher, you might want to consider boosting that to GOOD.</p>

<h4 id="if-i-make-changes-to-my-intents-do-i-need-to-train-the-affected-domain-to-pick-up-the-changes">If I make changes to my intents, do I need to train the affected domain to pick up the changes?</h4>

<p>Yes, it’s still the case that you need to train the domain after updating it if you want the updates to be reflected in subsequent testing, debugging, and usage. Training creates a new model version that incorporates the changes.</p>

<p>Within Consumer Queries, at the end of a guided flow, you’re reminded to train the domain within Intent Manager.</p>
]]></description>
      <!-- <pubDate>Tue, 15 Jul 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>LivePerson Agent Escalation Integrations</title>
      <link>https://developers.liveperson.com/conversation-builder-integrations-liveperson-agent-escalation-integrations.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/conversation-builder-integrations-liveperson-agent-escalation-integrations.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>You can use a LivePerson Agent Escalation integration when you want to transfer a conversation to either a live agent or another bot.</p>

<p class="attn-deprecation">This article discussing a legacy approach for transferring the conversation. Consider using the <a href="conversation-builder-interactions-integrations.html#agent-transfer-interactions">Agent Transfer interaction</a> instead. It's simpler and more convenient. If you use an Agent Transfer interaction, you <em>don't</em> need to create a supporting integration.</p>

<p class="attn-note">Implementing a bot-to-bot transfer? See <a href="conversation-builder-bots-bot-to-bot-transfers.html#manual-transfers">this section</a> for more info.</p>

<h3 id="add-a-liveperson-agent-escalation">Add a LivePerson Agent Escalation</h3>

<ol>
  <li>Open the bot, and click <strong>Integrations</strong> in the upper-left corner.</li>
  <li>Configure the integration settings (required fields are marked with asterisks):
    <ul>
      <li><strong>Integration Name</strong>: Enter the name of integration. Enter a name that's meaningful (it describes well the integration's purpose), concise, and follows a consistent pattern. This helps with organization, and it makes it easier for bot developers to work with the integration during bot development.</li>
      <li><strong>Response Data Variable Name</strong>: Enter the name of the variable that gets populated with the response from the API.</li>
      <li><strong>Integration Type</strong>: Select LivePerson Agent Escalation.</li>
      <li>
        <p><strong>Agent Skill</strong>: Mandatory; without this, the transfer won’t work. Select the name of the skill to which to transfer the conversation. Behind the scenes, the system retrieves the skill's ID as the value to use. You can also enter a bot context variable that stores a skill ID, for example, <code class="language-html highlighter-rouge">{$botContext.skillId}</code>. You <strong>can't</strong> enter a bot context variable that stores a skill name.</p>

        <p>When the transfer is attempted, the value is evaluated.</p>

        <p>If the value isn't numeric, the fallback message is sent to the user. (This never happens if you select a skill name.)</p>

        <p>If the value is numeric and the bot responds, the conversation is added to the queue for the selected skill. The conversation is then routed according to Conversational Cloud’s <a href="https://community.liveperson.com/kb/articles/1495-transfer-to-agent">Transfer to agent</a> rules.</p>

        <p>If the value is numeric, but the bot doesn't respond for more than 3 minutes (e.g., the chat server becomes overloaded and drops the message), an attempt is made to transfer to the Fallback Skill ID <em>if one is specified in the <a href="conversation-builder-testing-deployment-deploy-the-bot.html#add-an-agent-connector">agent connector</a></em>  (in <strong>Advanced Options</strong>). Otherwise, the transfer fails. For information on handling failures, see farther below on this page.</p>
      </li>
      <li><strong>Agent ID</strong>: Optional. Used for bot-to-human transfers only. Specify the ID of the human agent to which to transfer the conversation. (You can obtain the ID from the address bar when the user profile is displayed in Conversational Cloud.) For Messaging, specify the agent ID as <code class="language-html highlighter-rouge"><span class="nt">&lt;account</span> <span class="na">ID</span><span class="nt">&gt;</span>.<span class="nt">&lt;agent</span> <span class="na">ID</span><span class="nt">&gt;</span></code>. For Live Chat, specify just the <code class="language-html highlighter-rouge"><span class="nt">&lt;agent</span> <span class="na">ID</span><span class="nt">&gt;</span></code>. Transfer of the conversation to this agent ID only occurs if the agent is available. If the agent isn't available, the conversation is added to the queue for the skill specified in <strong>Agent Skill ID</strong> in this integration, and the conversation is routed according to Conversational Cloud’s <a href="https://community.liveperson.com/kb/articles/1495-transfer-to-agent">Transfer to agent</a> rules.</li>
      <li><strong>Transfer Bot Context</strong>: Used for <a href="conversation-builder-bots-bot-to-bot-transfers.html#manual-transfers">manual, bot-to-bot transfers</a> only. Select this to <em>automatically</em> pass the user's intent and/or message from the sender bot to the receiver bot. This lets the receiver bot know the appropriate dialog to start after the transfer.</li>
      <li><strong>Message to User</strong>: Use this field to guarantee that the user will see a message prior to being transferred, something like, “Hold on while I connect you with an agent.” You can enter either static text, use a variable, or a combination of both. The system will send this message as a part of the transfer API post body. If you need to insert a new line, use an escape character like so: \\n.</li>
    </ul>

    <p>This field is required, so if you don't want to send a message, enter "BLANK_MESSAGE" here. That satisfies the underlying, system requirement for a message, but it doesn't actually send one.</p>
    <ul>
      <li><strong>Transform Result Script</strong>: If applicable, use this section to write JavaScript code that transforms the raw result (typically in JSON format), so you can use the information in the bot's dialog. For more on this, see <a href="conversation-builder-integrations-integration-basics.html#transform-an-api-result">Transform an API result</a>.</li>
      <li><strong>Custom Data Fields</strong>: Add <a href="conversation-builder-integrations-integration-basics.html#process-api-results-with-custom-data-fields">the fields</a> that will store the result data in key/value pairs. Users who are tasked with creating bots can use and display this data in interactions by referencing these fields.</li>
    </ul>
  </li>
  <li>Click <strong>Save</strong>.</li>
</ol>

<h3 id="best-practices">Best practices</h3>

<h4 id="send-a-transfer-message">Send a transfer message</h4>

<p>When transferring the consumer to a live agent, it's customary to send some form of message to the user like, "Hold on while I connect you with an agent." You might want to send this as a Text statement in the dialog. However, supplying the message as a part of the integration's configuration guarantees the message is the last one seen by the consumer prior to the transfer (because the message is sent as a part of the post body in the underlying Transfer API).</p>

<p>In the integration, you supply the transfer message in the <strong>Message to User</strong> field. You don't have to supply a message, but if you don't, you'll need to set the field to <code class="language-html highlighter-rouge">BLANK_MESSAGE</code> to satisfy the system requirement for a value, as described above.</p>

<h4 id="add-a-time-delay-to-the-transfer-if-needed">Add a time delay to the transfer if needed</h4>

<p>If you're sending one or more messages to the consumer before the transfer, it's recommended that you add to the Integration interaction an interaction delay that accounts for each message to be sent. The transfer is an asynchronous process, and you don’t want the bot to start it too soon. The cumulative delay on the Integration interaction provides the time delay that’s needed.</p>

<p>For example, if you're sending 3 messages before the transfer, each with its own 2000 millisecond delay, you might add a 6000 millisecond delay to the Integration interaction (3 messages x 2000 millisecond delay per message = an aggregate 6000 millisecond delay).</p>

<p>Specify the delay in the <strong>Interaction Delay</strong> field in the Integration interaction's settings.</p>

<h4 id="handle-transfer-failures">Handle transfer failures</h4>

<p>First, if an immediate error occurs when calling the escalation API (due to an invalid skill ID or a system failure of some sort), a failure response will be returned. You can catch and handle these errors by adding a custom rule that checks for a “failure” result to the <a href="conversation-builder-interactions-integrations.html#integration-interactions">Integration interaction</a>.</p>

<p>Second, most often in Chat, but occasionally with Messaging, it can happen that the escalation API call is successful, but an attempt at transferring to a skill will fail after some time. When this happens, the platform sends the message <code class="language-html highlighter-rouge">__agent_escalation_failed__</code> to the bot. If you don’t have a dialog set up to catch this pattern, the bot will treat it like any other consumer message. In most cases, it will go to the Fallback dialog.</p>

<p>Setting up a dialog to catch the <code class="language-html highlighter-rouge">__agent_escalation_failed__</code> pattern allows you to send an appropriate message to the consumer, e.g., "Sorry, we're unable to perform the transfer at this time. Please try again later."</p>

<p>If the <code class="language-html highlighter-rouge">__agent_escalation_failed__</code> message is sent 3 times to the bot, and the 4th attempt also fails, the escalation stops, and the following default response is sent to the consumer, "Not able to transfer to Agent at this time. Please try later." Alternatively, if you've specified a "default user-friendly response" (for when errors and exceptions occur) in <a href="conversation-builder-bots-bot-basics.html#configure-bot-settings">Bot Settings</a>, that response is sent instead.</p>

<h3 id="troubleshooting">Troubleshooting</h3>

<p>See this <a href="conversation-builder-integrations-troubleshooting.html">troubleshooting info</a>.</p>
]]></description>
      <!-- <pubDate>Mon, 14 Jul 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Prerequisite Steps</title>
      <link>https://developers.liveperson.com/tutorials-use-conversation-assist-prerequisite-steps.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/tutorials-use-conversation-assist-prerequisite-steps.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note"><strong>Customize your POC:</strong> This guide walks through building a working example of the Conversation Assist capabilities within 30 minutes. The provided examples and starter resources are intentionally simple to move through the process quickly. Keep an eye out for "Customize your POC" sections like this one for indications as to where you can further develop and customize your implementation of a Conversation Assist proof-of-concept to fit your specific needs.</p>

<h3 id="before-you-begin">Before you begin</h3>

<p>Before you get started with this tutorial, download this <a href="assets/resources/AgentAssistTutorial_resources.zip">ZIP file</a>, which contains a few, necessary resources.</p>

<h3 id="step-1-activate-generative-ai-features">Step 1: Activate Generative AI features</h3>

<p class="attn-note">You need administrator access on the account to activate our Generative AI features. Contact your admin if you need assistance.</p>

<ol>
  <li>Log into Conversational Cloud.</li>
  <li>
    <p>Open the menu on the left side of the page, and select <strong>Manage &gt; Management Console</strong>.</p>

    <p><img style="width:300px" src="img/agentassisttutorial/mc_access.png" alt="The Management Console menu option in the left navigation pane" /></p>
  </li>
  <li>In the Management Console, search for “Generative AI” to display the <strong>Generative AI Management</strong> page.</li>
  <li>
    <p>Click <strong>Sign to activate</strong>.</p>

    <p><img style="width:800px" src="img/agentassisttutorial/mc_genai_activate.png" alt="The Sign to activate button to activate the Generative AI features" /></p>
  </li>
  <li>In the pop-up window, specify the following:
    <ul>
      <li><strong>Brand name</strong>: Acme Airline</li>
      <li><strong>Industry</strong>: Transportation</li>
    </ul>

    <p class="attn-note">During queries to the Large Language Model (LLM) service, your brand name and industry are included in the prompt that gets sent to the service. It helps the responses to stay in bounds, i.e., specific to your brand, with fewer hallucinations.</p>
  </li>
  <li>
    <p>Review the terms and conditions, and check the box to indicate that you’ve done so. Click <strong>Agree</strong>.</p>

    <p><img style="width:700px" src="img/agentassisttutorial/mc_genai_terms.png" alt="The window for accessing the terms and conditions to review" /></p>
  </li>
  <li>Review the info in the confirmation window: You’ll need to log out and back in. And it might take 15 minutes or so before the features are active. Click <strong>Ok, got it</strong>.</li>
  <li>Wait 15 minutes or so before proceeding to the next step.</li>
  <li>Log out of Conversational Cloud and then log back in.</li>
</ol>

<h3 id="step-2-create-the-airline-nlu-domain">Step 2: Create the Airline NLU domain</h3>

<p>LivePerson offers a variety of domain-specific starter packs (<a href="intent-manager-key-terms-concepts.html#prebuilt-domains">prebuilt domains</a>) to help you get up and running with Intent Manager quickly. In this step, you build out the NLU domain that will be used in the Conversation Assist solution.</p>

<p class="attn-note"><strong>Customize your POC:</strong> For demonstration purposes, this guide assumes a build-out suited for an Airline client. Add in a vertical-specific, pre-built domain to customize for your use case, or optionally add additional domains to supplement the primary one you are using. Conversation Assist can pull from multiple domain intents to offer recommendations to agents.</p>

<ol>
  <li>
    <p>Open the menu on the left side of the page, and select <strong>Automate</strong> &gt; <strong>Intent Manager</strong>.</p>

    <p><img class="fancyimage" alt="The Automate menu with the Intent Manager menu option highlighted" style="width:300px" src="img/ConvoBuilder/automate_im.png" /></p>
  </li>
  <li>On the <strong>Dashboard</strong> page, click <strong>Add a domain</strong> in the upper-right corner of the <strong>Domain list</strong>.</li>
  <li>In the window that's displayed, select <strong>Prebuilt domains</strong> along the top.</li>
  <li>
    <p>Move your mouse over the Airlines domain, and click <strong>Add</strong>.</p>

    <p><img class="fancyimage" style="width:800px" src="img/agentassisttutorial/add_prebuilt_domain.png" alt="Adding the Airline prebuilt domain" /></p>

    <p>Once completed, the LP_Airlines domain is created, fully trained and containing intents for use with any airline.</p>
  </li>
</ol>

<h3 id="step-3-create-the-airline-faq-knowledge-base">Step 3: Create the Airline FAQ knowledge base</h3>

<p>With the NLU domain created, the next step is to create a knowledge base with articles to be tied to domain intents. For the purpose of this demonstration, a CSV file has been provided to simplify the process. You downloaded this file earlier.</p>

<p class="attn-note"><strong>Customize your POC:</strong> This example uses a single knowledge base in order to quickly showcase the capabilities of recommending articles using Conversation Assist. Adding additional knowledge bases to showcase that Conversation Assist can pull from multiple data sources can help to create a more substantial and impressive demonstration with your proof-of-concept. Each additional knowledge base can pull from any domain you previously created to showcase their functionality.</p>

<ol>
  <li>
    <p>Open the menu on the left side of the page, and select <strong>Automate</strong> &gt; <strong>KnowledgeAI</strong> to open KnowledgeAI.</p>

    <p><img class="fancyimage" alt="The Automate menu with the KnowledgeAI menu option highlighted" style="width:300px" src="img/ConvoBuilder/automate_kai.png" /></p>
  </li>
  <li>
    <p>Click <strong>Add knowledge base</strong> in the upper-right corner.</p>

    <p class="attn-tip">Don't see the <strong>Add knowledge base</strong> button? If you're working with a brand new account, you might need to click <strong>Let's go</strong> on the landing page instead. Then proceed to the next step.</p>
  </li>
  <li>
    <p>On the <strong>AI Enabled</strong> tab of the window that appears, specify the following:</p>

    <ul>
      <li><strong>Knowledge Base Name</strong>: Airline FAQ</li>
      <li><strong>Domain</strong>: LP_Airlines</li>
      <li><strong>Language</strong>: English</li>
      <li><strong>Content source</strong>: CSV
        <ul>
          <li><em>Use the CSV file that is in the ZIP file that you downloaded earlier.</em></li>
        </ul>
      </li>
    </ul>
  </li>
  <li>
    <p>Click <strong>Save</strong> to upload your knowledge base articles, with intents from the LP_Airlines domain automatically associated with each article.</p>
  </li>
  <li>
    <p>Click <strong>Articles</strong> in the menu bar, and scroll down to review the articles.</p>

    <p><img class="fancyimage" style="width:800px" src="img/agentassisttutorial/articles.png" alt="A list of three active articles in the Airline FAQ knowledge base" /></p>

    <p><strong>Note:</strong> The intents will be automatically associated as long as you created the NLU model as per the previous section. If you didn't do this, you can make your intent associations afterward by aligning the intents with the correct article:</p>

    <table>
      <thead>
        <tr>
          <th>Article Title</th>
          <th>Intent</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Seating assignment</td>
          <td>ask about seat assignment</td>
        </tr>
        <tr>
          <td>Refund policy</td>
          <td>request refund or credit</td>
        </tr>
        <tr>
          <td>Claim reward miles</td>
          <td>claim reward miles</td>
        </tr>
        <tr>
          <td>Baggage policies</td>
          <td>ask about baggage</td>
        </tr>
        <tr>
          <td>Upgrade my seat</td>
          <td>upgrade seat</td>
        </tr>
        <tr>
          <td>Cancel flight</td>
          <td>cancel flight</td>
        </tr>
        <tr>
          <td>Change flight</td>
          <td>change flight</td>
        </tr>
        <tr>
          <td>Reschedule disrupted flight</td>
          <td>reschedule disrupted flight</td>
        </tr>
        <tr>
          <td>Book a flight</td>
          <td>book flight</td>
        </tr>
      </tbody>
    </table>

    <p class="attn-tip">Tying the articles to the intents is an optional step. We illustrate it, so you understand how. But you can skip it if desired. Instead, you can rely on <a href="knowledgeai-key-terms-concepts-search-methods.html">KnowledgeAI's AI Search</a> to find and retrieve articles that match the consumer's query. AI Search is very effective, and it works out of the box. No intent model is required.</p>

    <p>Next, you test out the matching of articles to consumer queries using the Answer Tester.</p>
  </li>
  <li>
    <p>In the Answer Tester, enter a few consumer queries, such as:</p>

    <ul>
      <li>I'm going on my honeymoon. How do I book a flight?</li>
      <li>I just got a bonus at work, so I want to upgrade my seat.</li>
    </ul>

    <p>Also, under "Process answers for better quality," turn on the <strong>Generate one enriched answer via Generative AI</strong> toggle. (<a href="conversation-assist-key-terms-concepts-copilot-assist-offer-enriched-answer-recommendations.html">Learn about using an LLM to enrich the answer.</a>)</p>

    <p>Click <strong>Get answers</strong>, and evaluate the results:</p>

    <p><img class="fancyimage" style="width:500px" src="img/agentassisttutorial/answerTester1.png" alt="Testing some consumer queries in the Answer Tester" /></p>

    <p>Review the answers:</p>

    <p><img class="fancyimage" style="width:600px" src="img/agentassisttutorial/answerTester2.png" alt="Some results in the Answer Tester" /></p>

    <p>Click the answer to see its details:</p>

    <p><img class="fancyimage" style="width:600px" src="img/agentassisttutorial/answerTester3.png" alt="Details on the results in the Answer Tester" /></p>

    <p class="attn-note">You can ignore the warning in the UI about the default value for the <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#enrichment-prompts">Enrichment prompt</a>. For the purpose of this tutorial, the default prompt will work just fine. In a real world scenario, you should select and use one of your own prompts as soon as possible. (You can copy one of LivePerson's if you choose.)</p>

    <p>The Enrichment prompt is the prompt to send to the LLM service when the consumer’s query is matched to articles in the knowledge base. It instructs the LLM service on how to use the matched articles to generate an enriched answer.</p>
  </li>
</ol>

<h3 id="step-4-create-the-users-and-skills">Step 4: Create the users and skills</h3>

<p>Every bot and human agent requires a user profile to be deployed and accessible from within the Conversational Cloud. This section provides the details needed to update the logged-in human agent with an associated skill, as well as the details needed to create bot agents for the two bots that will be uploaded.</p>

<p class="attn-note"><strong>Customize your POC:</strong> This guide provides two bots that Conversation Assist can source recommendations from. These demonstration bots do not provide much functionality out of the box, so bring in your own domain-specific bots to fit the needs of your POC. Keep in mind that any additional bots created will need their own corresponding bot user agents.</p>

<ol>
  <li>Open the menu on the left side of the page, and select <strong>Manage</strong> &gt; <strong>Users &amp; Skills</strong> to open the User Management section of the Conversational Cloud.</li>
  <li>
    <p>In the list of users, select your logged-in human user. In the <strong>Edit user</strong> form, scroll to the bottom. In the <strong>Skills</strong> field, enter “Agent,” and click the <strong>Create skill</strong> link that appears. Then click <strong>Save</strong>.</p>

    <p><img class="fancyimage" style="width:400px" src="img/agentassisttutorial/agentskill.png" alt="Adding the Agent skill to the Skills field" /></p>
  </li>
  <li>
    <p>Back on the <strong>Users</strong> tab, click <strong>+ Add user</strong> in the lower-left corner. Fill out the <strong>Add user</strong> form with the following user details:</p>

    <ul>
      <li><strong>User type</strong>: Bot</li>
      <li><strong>Login name</strong>: Booking Bot</li>
      <li><strong>Email</strong>: Your email address</li>
      <li><strong>Nickname</strong>: Booking Bot</li>
      <li><strong>Name</strong>: Booking Bot</li>
      <li><strong>Choose login method</strong>: API key</li>
      <li><strong>API key</strong>: Generate API key</li>
      <li><strong>Assignment → Assign Profile</strong>: Agent</li>
    </ul>

    <p>Click <strong>Save</strong>.</p>
  </li>
  <li>
    <p>Repeat the same process to create a second bot user with the following details:</p>

    <ul>
      <li><strong>User type</strong>: Bot</li>
      <li><strong>Login name</strong>: Seating Bot</li>
      <li><strong>Email</strong>: Your email address</li>
      <li><strong>Nickname</strong>: Seating Bot</li>
      <li><strong>Name</strong>: Seating Bot</li>
      <li><strong>Choose login method</strong>: API key</li>
      <li><strong>API key</strong>: Generate API key</li>
      <li><strong>Assignment → Assign Profile</strong>: Agent</li>
    </ul>

    <p><img class="fancyimage" style="width:800px" src="img/agentassisttutorial/twobotusers.png" alt="The Users tab showing two newly created bot users" /></p>
  </li>
</ol>

<h3 id="step-5-import-the-conversation-builder-bots">Step 5: Import the Conversation Builder bots</h3>

<p>In this step, you create two, new bots in Conversation Builder using the JSON files that are in the ZIP file that you downloaded earlier:</p>

<ul>
  <li>Booking Bot</li>
  <li>Seating Bot</li>
</ul>

<p>These bots have been created with <a href="conversation-builder-interactions-dialog-starter.html">dialog starters</a> ("bot flow" starters) that match several of the LP_Airlines intents. Because of this, the bots can be recommended in response to related consumer queries.</p>

<ol>
  <li>
    <p>Open the menu on the left side of the page, and select <strong>Automate</strong> &gt; <strong>Conversation Builder</strong> to open Conversation Builder.</p>
  </li>
  <li>
    <p>Click <strong>Import Bot</strong> in the upper-right corner, and select the "Booking Bot" JSON file that you downloaded. Click <strong>Open</strong>.</p>

    <p><strong>Note:</strong> If you have completed the previous step of creating the LivePerson domain, the intents will be automatically associated with the correct dialogs in the bots. However, if you have not yet done so, you will need to connect them manually to the appropriate dialog starters using Conversation Builder's Assist tool.</p>
  </li>
  <li>
    <p>Within the Booking Bot (now opened), click <strong>Agent Connectors</strong> on the menu bar at the top.</p>

    <p class="attn-tip">If you don't see this menu option, it's in menu to the right of the options that you do see. Just click the three-dot menu icon.</p>
  </li>
  <li>
    <p>Click <strong>Add Agent Connector</strong>, and in the resulting form, select your "Booking Bot" user agent from the <strong>Agent User ID</strong> dropdown. Ensure that the <strong>Conversation Type</strong> is set to "Messaging," and click <strong>Save</strong>.</p>
  </li>
  <li>
    <p>Click <strong>Start</strong> to start the agent connector.</p>

    <p><img class="fancyimage" style="width:800px" src="img/agentassisttutorial/agent_connector.png" alt="The Start button for an agent connector" /></p>

    <p class="attn-note">Starting the agent connector can take a few minutes.</p>
  </li>
  <li>
    <p>Click <strong>Back</strong> to return to the bot listing page.</p>
  </li>
  <li>
    <p>Follow the same process to upload the "Seating Bot" that you downloaded, to connect the Seating Bot user agent via an agent connector, and to start the agent connector.</p>

    <p>Once finished, you will have two bots up and running with agent connectors.</p>

    <p class="attn-note">These bots are for demonstration purposes, so they don't do much beyond serving a dialog (a bot flow) to a user based on the intent. No actual booking or seating functionality is built in. As such, they can be modified to meet your use case.</p>
  </li>
</ol>

<h3 id="whats-next">What's next?</h3>

<p>Continue on to the <a href="tutorials-use-conversation-assist-configure-conversation-assist.html">next step</a> in the tutorial.</p>
]]></description>
      <!-- <pubDate>Fri, 11 Jul 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Meta Intents &amp; Knowledge Bases</title>
      <link>https://developers.liveperson.com/tutorials-bot-groups-other-techniques-meta-intents-knowledge-bases.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/tutorials-bot-groups-other-techniques-meta-intents-knowledge-bases.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<p class="attn-note">This is a tutorial series that's cumulative in nature. What's more, this series builds on the beginner's series. To complete this tutorial, <a href="tutorials-get-started-with-bot-building-messaging-overview.html">start from the beginning</a>.</p>

<p>Brands often have static content, such as frequently asked questions, that can be addressed through bots and delivered with Conversation Builder. As opposed to creating individual interactions to handle these use cases, the Conversational Cloud provides knowledge base support to provide a seamless experience in delivering this content. To best work within the Collaborative Bot Group structure, we will create an FAQ meta intent to capture all FAQ questions and present them to our user within the <strong>Service Bot</strong>.</p>

<h3 id="step-8-create-the-faq-meta-intent">Step 8: Create the FAQ meta intent</h3>

<p>A meta intent is a wrapper for a group of related intents.</p>

<p><img style="width:500px" src="img/ConvoBuilder/advtutorial/meta_intents_diagram.png" alt="An illustration that shows several intents funneling into a meta intent" /></p>

<p>Using <a href="intent-manager-key-terms-concepts.html#meta-intents">meta intents</a>, you can funnel a variety of intents into a single dialog for processing. A meta intent can have many standard intents, and standard intents can belong to one meta intent. Another way to think about this relationship is as a parent-children model, with the meta intent being the parent and all its standard intents as its children.</p>

<ol>
  <li>Open the menu on the left side of the page, and select <strong>Automate</strong> &gt; <strong>Intent Manager</strong> to open Intent Manager.</li>
  <li>From the domain list on the Intent Manager dashboard, select the "LP_Cross-vertical" domain, and then select <strong>Build</strong> from the menu that appears.</li>
  <li>
    <p>Create a meta intent: Click <strong>Add Intent</strong> in the lower-left corner, and specify the following:</p>

    <ul>
      <li><strong>Intent Name</strong>: FAQ</li>
      <li><strong>Intent Display Name</strong>: FAQ</li>
      <li><strong>Intent Type</strong>: Meta Intent</li>
      <li><strong>Intents</strong> &gt; Select intent to add:
        <ul>
          <li>ask about shipping or pick up</li>
          <li>reset password</li>
          <li>cancel account</li>
        </ul>
      </li>
    </ul>

    <p>When finished, click <strong>Save</strong>.</p>

    <p>If created correctly, you should see your standard intents displayed underneath the FAQ meta intent.</p>

    <p><img style="width:300px" src="img/ConvoBuilder/advtutorial/meta_intents_list.png" alt="A view of Intent Manager that shows several intents nested under an FAQ meta intent" /></p>
  </li>
  <li>
    <p>Once saved, you will need to re-train your domain for your changes to take effect. Click <strong>Train &amp; Create Version</strong> in the upper-right corner. And confirm the action in the pop-up window that appears.</p>

    <p>Training might take a few minutes to complete.</p>
  </li>
  <li>
    <p>Test to make sure both intents and meta intents are being triggered by your training phrases: Click <strong>Intents</strong> on the menu bar. In the <strong>Test User Input</strong> panel on the right, select your newly trained model from the <strong>Model version</strong> dropdown. Test out a few phrases that you would expect to match the newly created intents. If set up correctly, you should see both the standard intent and its parent meta intent triggered with the same confidence score.</p>

    <p><img style="width:400px" src="img/ConvoBuilder/advtutorial/test_user_input.png" alt="Using the Test User Input tool to trigger the intents and meta intent" /></p>
  </li>
  <li>
    <p>With a newly created meta intent in hand, "release" the new model version, so the changes are reflected in your bot: Click <strong>Versions</strong> on the menu bar. Select the "release" action, and click <strong>Release</strong>.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/advtutorial/release_version.png" alt="The Versions page with a callout to the release icon in the Actions column" /></p>
  </li>
</ol>

<p>In the final two steps, you'll create a knowledge base and integrate it into a bot…in order to automate answers to consumers. But first, you need to activate our Generative AI features, so you can <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">enrich those answers using a Large Language Model</a> before sending them. Enriched answers are smarter, warmer, and better.</p>

<h3 id="step-9-activate-generative-ai-features">Step 9: Activate Generative AI features</h3>

<p class="attn-note">You need administrator access on the account to activate our Generative AI features. Contact your admin if you need assistance.</p>

<ol>
  <li>
    <p>In the menu on the left side of the page, select <strong>Manage &gt; Management Console</strong>.</p>

    <p><img style="width:300px" src="img/ConvoBuilder/advtutorial/mc_access.png" alt="The Management Console menu option in the left navigation pane" /></p>
  </li>
  <li>
    <p>In the Management Console, search for “Generative AI” to display the <strong>Generative AI Management</strong> page.</p>
  </li>
  <li>
    <p>Click <strong>Sign to activate</strong>.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/advtutorial/mc_genai_activate.png" alt="The Sign to activate button to activate the Generative AI features" /></p>
  </li>
  <li>In the pop-up window, specify the following:
    <ul>
      <li><strong>Brand name</strong>: Acme Company</li>
      <li><strong>Industry</strong>: Retail</li>
    </ul>

    <p class="attn-note">During queries to the Large Language Model (LLM) service, your brand name and industry are included in the prompt that gets sent to the service. It helps the responses to stay in bounds, i.e., specific to your brand, with fewer hallucinations.</p>
  </li>
  <li>
    <p>Review the terms and conditions, and check the box to indicate that you’ve done so. Click <strong>Agree</strong>.</p>

    <p><img style="width:700px" src="img/ConvoBuilder/advtutorial/mc_genai_terms.png" alt="The window for accessing the terms and conditions to review" /></p>
  </li>
  <li>Review the info in the confirmation window: You’ll need to log out and back in. And it might take 15 minutes or so before the features are active. Click <strong>Ok, got it</strong>.</li>
  <li>Wait 15 minutes or so before proceeding to the next step.</li>
  <li>Log out of Conversational Cloud and then log back in.</li>
</ol>

<p>The next step will be to create a new knowledge base.</p>

<h3 id="step-10-create-the-faq-knowledge-base">Step 10: Create the FAQ knowledge base</h3>

<p>In this step, you’ll create a new FAQ knowledge base and add FAQ articles to it.</p>

<ol>
  <li>
    <p>Open the menu on the left side of the page, and select <strong>Automate</strong> &gt; <strong>KnowledgeAI</strong> to open KnowledgeAI.</p>
  </li>
  <li>
    <p>Click <strong>Add Knowledge Base</strong> in the upper-right corner. (If you don't have any existing knowledge bases, you'll need to click <strong>Let's go</strong> instead in this step.)</p>
  </li>
  <li>
    <p>On the <strong>AI Enabled</strong> tab of the window that appears, specify the following:</p>

    <ul>
      <li><strong>Knowledge base name</strong>: Getting Started KB</li>
      <li><strong>Domain</strong>: LP_Cross-vertical</li>
      <li><strong>Language</strong>: English</li>
      <li><strong>Content source</strong>: Leave this field blank, as you'll create articles from scratch.</li>
    </ul>

    <p><img style="width:800px" src="img/ConvoBuilder/advtutorial/add_kb.png" alt="Adding a knowledge base using the Add Knowledge Base window" /></p>

    <p>Click <strong>Save</strong>.</p>

    <p>The next step is to add the FAQ articles that will be triggered by intents from our LP_Cross-vertical domain.</p>
  </li>
  <li>
    <p>Click <strong>Add article</strong> in the upper-right corner to create your first article. Complete the <strong>Add Article</strong> form with the following information:</p>

    <ul>
      <li><strong>Title</strong>: Password reset</li>
      <li>
        <p><strong>Intent</strong>: reset password</p>

        <p>The intent dropdown contains all of the intents within your associated domain. Use the search field or scroll down the list of intents to select the intent you want to surface this article.</p>
      </li>
      <li><strong>Summary</strong>: Password resets can be done through the login screen. Please select “Forgot Password” to receive an email with easy instructions on how to reset your password.</li>
    </ul>

    <p>After completing these fields, click <strong>Save</strong> to create your article.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/advtutorial/first_article.png" alt="Adding an article" /></p>
  </li>
  <li>
    <p>Back in our Getting Started KB page, repeat this process to add additional articles with the following information:</p>

    <ul>
      <li><strong>Title</strong>: Cancel my account</li>
      <li><strong>Intent</strong>: cancel account</li>
      <li>
        <p><strong>Summary</strong>: If you would like to delete your account, this can be done from your “Account Profile” page, accessible by clicking the “My Account” link in the upper-right after logging in. Scroll to the bottom for the link and instructions to delete your account from our server.</p>
      </li>
      <li><strong>Title</strong>: Update shipping address</li>
      <li><strong>Intent</strong>: ask about shipping or pickup</li>
      <li><strong>Summary</strong>: If you need to change your shipping address after placing an order, you can easily do so by contacting our customer support team before the order ships. Call 1-800-123-4567.</li>
    </ul>
  </li>
  <li>
    <p>Back in the <strong>Getting Started KB</strong> menu, confirm that the newly created articles are present in your list of articles. Note the <strong>Inactive</strong> designation, as all newly created articles need to be enabled prior to being accessible.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/advtutorial/article_list.png" alt="A list of articles, all inactive" /></p>
  </li>
  <li>
    <p>For each article, click the article title, scroll down to the <strong>Enable Article</strong> setting, and turn it on. Click <strong>Save</strong>.</p>

    <p class="attn-note">In this section, you learned how to tie articles to intents, but this isn't a necessary step for a Production solution. Our <a href="knowledgeai-key-terms-concepts-search-methods.html">AI Search method</a> works well out-of-the-box; no intents are required.</p>

    <p>The knowledge base has now been created. Navigating back to Conversation Builder, next you will use the Knowledge AI interaction to access and display this content.</p>
  </li>
</ol>

<h3 id="step-11-create-the-faqs-dialog">Step 11: Create the FAQs dialog</h3>

<p>In our <strong>Service Bot</strong>, we will now create a FAQs dialog which will be triggered by our FAQ meta intent.</p>

<ol>
  <li>
    <p>Open the menu on the left side of the page, and select <strong>Automate</strong> &gt; <strong>Conversation Builder</strong> to open Conversation Builder.</p>
  </li>
  <li>
    <p>Open the Service Bot, which at this point only includes the Escalation dialog.</p>
  </li>
  <li>
    <p>Add a new standard dialog (dialog type = Dialog): Click <strong>Add Dialog</strong> in the lower-left corner, and give the dialog a name of "FAQs". Click <strong>Save</strong>.</p>
  </li>
  <li>
    <p>Using the Assist tool, associate the dialog starter with the LP_Cross-vertical domain and the FAQ meta intent.</p>

    <p>As you do so, note the asterisk next to the FAQ intent, which serves to signify that it is a meta intent.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/advtutorial/assist1.png" alt="Using Assist to associate the FAQ meta intent with the dialog starter in the FAQs dialog" /></p>

    <p><img style="width:800px" src="img/ConvoBuilder/advtutorial/assist2.png" alt="The FAQ meta intent successfully associated with the dialog starter in the FAQs dialog" /></p>

    <p>This ensures that any of the intents within the FAQ meta intent will trigger this dialog.</p>
  </li>
  <li>
    <p>From the <strong>New Interaction</strong> menu, select the Knowledge AI interaction to add it to the dialog.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/advtutorial/newinteractionmenu.png" alt="The menu of interactions that is displayed when you click New Interaction, with a callout to the Knowledge AI interaction" /></p>
  </li>
  <li>
    <p>In the Knowledge AI interaction, use the <strong>Select knowledge base</strong> dropdown to select the Getting Started KB. And turn on the <strong>Enriched answers via Generative AI</strong> toggle.</p>

    <p><img style="width:600px" src="img/ConvoBuilder/advtutorial/kai_tile.png" alt="Adding and configuring a KnowledgeAI interaction" /></p>

    <p class="attn-note">You can ignore the warning in the UI about the default value for the <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html#enrichment-prompts">Enrichment prompt</a>. For the purpose of this tutorial, the default prompt will work just fine. In a real world scenario, you should select and use one of your own prompts as soon as possible. (You can copy one of LivePerson's if you choose.)</p>

    <p>The Enrichment prompt is the prompt to send to the LLM service when the consumer’s query is matched to articles in the knowledge base. It instructs the LLM service on how to use the matched articles to generate an enriched answer.</p>
  </li>
  <li>
    <p>Still in the Knowledge AI interaction, select the <strong>Settings</strong> (gear) icon and navigate to the <strong>Advanced</strong> menu.</p>

    <p>The Knowledge AI offers several options in how to display the article contents.</p>
  </li>
  <li>
    <p>For this example, select "1" for <strong>Max Number of Answers</strong>, and select "Auto render, plain" for <strong>Answer layout</strong>.</p>

    <p><img style="width:800px" src="img/ConvoBuilder/advtutorial/kai_tile_2.png" alt="Configuring the Advanced settings of the KnowledgeAI interaction" /></p>

    <p>This will ensure that the results are displayed in the same conversational fashion as our other interactions.</p>
  </li>
  <li>
    <p>Click <strong>Save</strong>.</p>
  </li>
  <li>
    <p>Test by opening the Preview tool, resetting your session, and typing in a variety of phrases to trigger the intents contained in your FAQ meta intent. If successful, you will receive different responses for each intent despite the fact that you have a single meta intent that triggers this dialog.</p>
  </li>
</ol>

<p><img style="width:600px" src="img/ConvoBuilder/advtutorial/kai_tile_output.png" alt="Using the Preview tool to prevew a conversation, triggering the intents in the FAQ meta intent" /></p>

<p>This is successful because, while the meta intent triggers the process, we are sending the user’s message to our knowledge base. Each of the articles within the knowledge base are triggered by individual standard intents. Adding additional FAQ responses simply requires nesting new intents under the FAQ meta intent and creating a corresponding Getting Started KB article. No additional dialogs will be required.</p>

<p class="attn-note">Note how the answers are grounded in knowledge base content, warm, and reflective of the conversation's context. <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Learn more about answers enriched via Generative AI.</a></p>

<p>Congratulations on completing this tutorial series!</p>
]]></description>
      <!-- <pubDate>Fri, 11 Jul 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Search Methods</title>
      <link>https://developers.liveperson.com/knowledgeai-key-terms-concepts-search-methods.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-key-terms-concepts-search-methods.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>When a consumer asks a question or makes an intentful statement, and you pass that query to a knowledge base to find an answer, the answer can be retrieved in one of two ways:</p>

<ul>
  <li>AI Search</li>
  <li>Intent Match</li>
</ul>

<p class="attn-note"><strong>Neither</strong> search method makes use of Generative AI or an LLM, but you can do that too - to enrich the answer and make it more contextually aware and natural sounding. <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">Learn more here.</a></p>

<h3 id="ai-search">AI Search</h3>

<p>AI Search is KnowledgeAI™’s powerful, one-size-fits-all search method that’s based on the latest research in deep learning. Key characteristics of this search include the following:</p>

<ul>
  <li><strong>There’s no setup required</strong>: This is some of the best news. AI Search works right out of the box. Don’t want to invest the time in creating and tuning intents in Intent Manager? No problem. You don’t have to. Just add your content to the knowledge base. Then expose it via a bot integration (use the <a href="conversation-builder-interactions-integrations.html#knowledge-ai-interactions">KnowledgeAI interaction</a>), or <a href="conversation-assist-setup-set-up-knowledge-bases.html">set up the knowledge base for Conversation Assist</a> as normal. That’s it.</li>
  <li><strong>It gets to the intent</strong>: The AI Search isn’t a type of search that just looks at the words for matches found between the consumer query and the answer. The search also uses language embedding models to make a best attempt to determine the <em>meaning</em> behind those words: What is the consumer trying to convey?</li>
  <li><strong>It’s context-aware</strong>: The search considers the whole of the consumer query (and nothing more at this time). So, for example, “I want to book a flight” is understood differently from “Can I borrow a second book at the library?” Homonyms like these are handled.</li>
  <li><strong>It’s phrasing-agnostic</strong>: Synonyms are handled too: “I want to buy a ticket” and “I want to purchase a ticket” are understood similarly. Keep in mind that certain niche or archaic synonyms, especially abbreviations, might not be supported (unless you add them directly to the articles).</li>
  <li><strong>It returns multiple answers</strong>: If more than one good answer is found, multiple answers can be returned. This means you can use the <a href="conversation-builder-interactions-integrations.html#knowledge-ai-interactions">KnowledgeAI interaction</a> to populate a “carousel” of good answers to the consumer, providing a better consumer experience.</li>
</ul>

<h3 id="intent-match-search">Intent Match search</h3>

<p>An Intent Match search is one that makes use of Natural Language Understanding or NLU to find the right answer to the consumer’s query. NLU leverages AI to identify various attributes of a message: meaning, sentiment, and more.</p>

<p>To use this type of search, you must add a set of intents in <a href="intent-manager-overview.html">Intent Manager</a> and tune them for optimal answer retrieval. Then, back in KnowledgeAI, you must <a href="knowledgeai-internal-knowledge-bases-use-intents-with-kbs.html">tie your articles to the intents</a>.</p>

<p>Like the AI Search, the Intent Match search is powerful and effective.</p>

<h3 id="choosing-a-search-method">Choosing a search method</h3>

<p>One common question we get is, “Which search method do I use: Intent Match or AI Search?” This is a good question, and our answer to this is to use them both if you can, and if it meets your needs. They are better together.</p>

<h4 id="benefits-of-ai-search">Benefits of AI Search</h4>

<ul>
  <li>Works right out of the box. No setup is required.</li>
  <li>Performs well when handling consumer queries that are similar to articles in knowledge bases. The broader the coverage, the higher the probability that there will be a match to the consumer query.</li>
  <li>Makes up for issues that can occur when using intents. Since intents are trained by humans, an intent model might have some flaws: There might be gaps in the coverage. There might be an overlap in the coverage. Or, an intent might not be trained well enough. In other words, there’s an article that could be returned, but the match to the input query doesn’t meet the threshold required to return the article. Using the AI Search as a fallback to the Intent Match search is a good, recommended strategy to address issues like these.</li>
</ul>

<h4 id="benefits-of-intent-match-search">Benefits of Intent Match search</h4>

<ul>
  <li>Lets you manipulate outcomes by tuning the answer retrieval yourself. This gives you a layer of control.</li>
  <li>Can outperform AI Search. NLU is better at making predictions. So, if you take the time to tune an intent well, the intent will likely outperform the AI Search. (That said, there’s a tradeoff here, as it’s a fairly significant effort to add and tune intents. Keep in mind that the AI Search performs well on its own.)</li>
  <li>More suitable for specialized scenarios. Conversations that use a highly specific vocabulary do better when intents are used.</li>
  <li>Sometimes, only an Intent Match does the job. Scenarios can exist where the consumer query properly matches to an article that doesn’t have any content that relates to the query.</li>
</ul>

<h3 id="search-offerings">Search offerings</h3>

<p>When you select an answer retrieval method in various parts of the UI, the following choices are offered:</p>

<ul>
  <li>KnowledgeAI (recommended)</li>
  <li>Intent match only</li>
  <li>AI search only</li>
</ul>

<p>Here’s an example:</p>

<p><img class="fancyimage" style="width:600px" alt="The list of search offerings in the Answer Tester" src="img/ConvoBuilder/kb_searchofferings.png" /></p>

<p class="attn-note">The “Intent match only” and “AI search only” options are primarily intended for testing and for diagnosing issues during troubleshooting. In Production, we recommend that you use the “KnowledgeAI” offering.</p>

<h4 id="knowledgeai-option">“KnowledgeAI” option</h4>

<p class="attn-note">The “KnowledgeAI” option is what’s used by the <a href="conversation-builder-interactions-integrations.html#knowledge-ai-interactions">KnowledgeAI interaction</a> in LivePerson Conversation Builder.</p>

<ol>
  <li>Runs an exact match search.</li>
  <li>Runs the Intent Match search.</li>
  <li>Runs the AI Search.</li>
</ol>

<h4 id="intent-match-only-option">“Intent match only” option</h4>

<ol>
  <li>Runs an exact match search.</li>
  <li>Runs the Intent Match search.</li>
</ol>

<h4 id="ai-search-only-option">“AI search only” option</h4>

<ol>
  <li>Runs an exact match search.</li>
  <li>Runs the AI Search.</li>
</ol>

<h3 id="search-flow">Search flow</h3>

<p>Here's the simplified view:</p>

<p><img style="width:800px" alt="The search flow in KnowledgeAI" src="img/ConvoBuilder/kai_search_flow1.png" /></p>

<p>Here's the expanded view:</p>

<p><img style="width:800px" alt="The search flow in KnowledgeAI" src="img/ConvoBuilder/kai_search_flow2.png" /></p>

<p>Whether searching one knowledge base or several, the flow is the same:</p>

<ol>
  <li>Using the specified search offering ("KnowledgeAI," "Intent match only," or "AI search only"), find the article matches in the knowledge bases.</li>
  <li>
    <p>Aggregate the results, and keep only those in <strong>one</strong> of the following groups, listed in order of priority:</p>

    <ol>
      <li>Exact match</li>
      <li>Intent match</li>
      <li>AI Search match</li>
    </ol>
  </li>
  <li>Sort the results in the group by match score.</li>
  <li>Return the top results based on the number of answers requested.</li>
</ol>

<h3 id="match-scores-and-thresholds">Match scores and thresholds</h3>

<h4 id="match-scores">Match scores</h4>

<p>Whenever a knowledge base is searched for an article match to a consumer query, the results receive scores. The score indicates the level of confidence in the match: VERY GOOD, GOOD, and so on.</p>

<p>AI Search assigns scores as follows:</p>

<ul>
  <li>VERY GOOD: 85-100% match</li>
  <li>GOOD: 70-85% match</li>
  <li>FAIR PLUS: 65-70% match</li>
  <li>FAIR: 50-65% match</li>
  <li>POOR: 0-50% match</li>
</ul>

<p>Intent Match search assigns scores using the <a href="intent-manager-key-terms-concepts.html#confidence-score-and-threshold">scoring breakdown for the NLU engine used by the associated domain</a>.</p>

<h4 id="thresholds">Thresholds</h4>

<p>Other applications in the Conversational AI suite let you specify a threshold — that is, a minimum score — that a result must have for it to be returned as an answer.</p>

<ul>
  <li>You might be sending answers to consumers in automated conversations with bots. In this case, you can specify a threshold in the <a href="conversation-builder-interactions-integrations.html#knowledge-ai-interactions">KnowledgeAI interaction</a> within the bot in Conversation Builder.</li>
  <li>Or, you might be recommending answers to agents inline in their conversations with consumers. And, in this case, you can likewise specify an answer threshold in the <a href="conversation-assist-setup-set-up-knowledge-bases.html#rule-elements---add-ons">add-on</a> of the configuration rule that determines when answers from the knowledge base are recommended.</li>
</ul>

<p>Regardless of the integration, if you lower the threshold, be sure to test whether the quality of the results meets your expectations. It's generally recommended to keep the quality above FAIR PLUS.</p>

<h3 id="faqs">FAQs</h3>

<h4 id="which-search-method-do-i-use-intent-match-or-ai-search">Which search method do I use: Intent Match or AI Search?</h4>

<p><a href="knowledgeai-key-terms-concepts-search-methods.html#choosing-a-search-method">Which search method is best</a> depends on the use case, your requirements, and your resources. KnowledgeAI’s AI Search works very well on its own and requires no setup. But use them both if you can; they are better together.</p>

<h4 id="ai-search-isnt-performing-as-well-as-id-like-what-can-i-do">AI Search isn’t performing as well as I’d like. What can I do?</h4>

<p>If you have a consumer query for which there isn’t a relevant article to serve as the answer, just add that article.</p>

<p>While it’s unlikely that an existing, relevant article won’t yield results, it might happen. In this case, improve the article’s title and/or add tags to the article.</p>

<h4 id="is-ai-search-available-for-external-knowledge-bases">Is AI Search available for external knowledge bases?</h4>

<p>AI Search isn't available for <a href="knowledgeai-external-knowledge-bases-external-kbs-without-liveperson-ai.html">external knowledge bases that don't use LivePerson AI</a>. Knowledge bases of this type use the CMS' query and answer API for article suggestions/answers.</p>

<h4 id="how-does-ai-search-work">How does AI Search work?</h4>

<p>In the internal knowledge base, AI Search performs 3 steps to get results:</p>

<ol>
  <li><strong>Pre-processing</strong>: This includes a simple query classification process to remove small talk (chitchat) from the input query. It also includes splitting a long query with multiple sentences into single sentences.</li>
  <li>
    <p><strong>Retrieval</strong>: The input query is concurrently checked against:</p>

    <ul>
      <li>Title alone</li>
      <li>Summary, Detail, and any tags</li>
      <li>Title, Category, and any tags</li>
    </ul>
  </li>
  <li>
    <p><strong>Post-processing</strong>: This includes the following:</p>

    <ol>
      <li><strong>De-duplication</strong>: From the retrieved articles, duplicate articles or highly similar articles are removed.</li>
      <li><strong>Re-ranking</strong>: The articles are reordered based on score and category.</li>
      <li><strong>Score calibration</strong>: The internal scores of the articles are calibrated to VERY GOOD, GOOD, FAIR PLUS, etc.</li>
    </ol>
  </li>
</ol>

<h4 id="how-does-the-intent-match-search-work">How does the Intent Match search work?</h4>

<p>In the internal knowledge base, the input query is checked against:</p>

<ul>
  <li>title</li>
  <li>domain intents</li>
</ul>

<h4 id="how-does-the-exact-match-search-work">How does the exact match search work?</h4>

<p>In the internal knowledge base, the input query is checked against:</p>

<ul>
  <li>title</li>
</ul>
]]></description>
      <!-- <pubDate>Thu, 10 Jul 2025 00:00:00 +0000</pubDate> -->
    </item>
    <item>
      <title>Language Support</title>
      <link>https://developers.liveperson.com/knowledgeai-key-terms-concepts-language-support.html</link>
      <guid isPermaLink="true">https://developers.liveperson.com/knowledgeai-key-terms-concepts-language-support.html</guid>
      <description xml:base="https://developers.liveperson.com/"><![CDATA[<h3 id="available-languages">Available languages</h3>

<p>You can select any of the following for the knowledge base’s language:</p>

<ul>
  <li>Arabic</li>
  <li>Chinese (Cantonese) — Hong Kong</li>
  <li>Chinese (Simplified) — China</li>
  <li>Chinese (Traditional) — Taiwan</li>
  <li>Danish</li>
  <li>Dutch — Netherlands</li>
  <li>English</li>
  <li>English — Australia</li>
  <li>English — Canada</li>
  <li>English — Great Britain</li>
  <li>English — India</li>
  <li>English — United States</li>
  <li>French</li>
  <li>French — Canada</li>
  <li>French — France</li>
  <li>German — Germany</li>
  <li>Hebrew</li>
  <li>Hindi</li>
  <li>Indonesian</li>
  <li>Italian — Italy</li>
  <li>Japanese — Japan</li>
  <li>Korean — Korea</li>
  <li>Norwegian</li>
  <li>Polish</li>
  <li>Portuguese — Brazil</li>
  <li>Portuguese — Portugal</li>
  <li>Romanian</li>
  <li>Russian</li>
  <li>Sinhalese</li>
  <li>Spanish</li>
  <li>Spanish — Latin America</li>
  <li>Spanish — Mexico</li>
  <li>Spanish — Spain</li>
  <li>Swedish</li>
  <li>Thai</li>
  <li>Turkish — Turkey</li>
  <li>Ukranian</li>
  <li>Urdu</li>
  <li>Vietnamese</li>
  <li>Other</li>
</ul>

<h3 id="mixed-language-knowledge-bases">Mixed-language knowledge bases</h3>

<p>A <em>mixed-language knowledge base</em> is one that includes content in multiple languages.</p>

<p><a href="knowledgeai-best-practices.html">As stated in our best practices</a>, don’t create a mixed-language knowledge base. Instead, add content in only one language to the knowledge base.</p>

<p>That said, there’s no restriction that prevents you from creating a mixed-language knowledge base. If you do so, specify the knowledge base’s language as “Other.” Selecting “Other” means that the multi-lingual embedding model is used during search. Selecting a value other than “Other” might degrade the performance.</p>

<h3 id="specifying-the-knowledge-bases-language">Specifying the knowledge base's language</h3>

<p>When you create an internal or external knowledge base, you specify its language:</p>

<p><img class="fancyimage" alt="Specify knowledge base language" style="width:700px" src="img/ConvoBuilder/kai_kblanguage.png" /></p>

<p>As mentioned elsewhere (<a href="knowledgeai-internal-knowledge-bases-knowledge-bases.html#add-an-internal-knowledge-base">example</a>), make an accurate selection.</p>

<p class="attn-note">In general, keep things consistent across integrations. The language of the knowledge base should be the same as the language of the bot in which the knowledge base is used.</p>

<h3 id="supporting-cross-lingual-queries">Supporting cross-lingual queries</h3>

<p>A <em>cross-lingual query</em> is one where the consumer’s query is in one language, but the knowledge base’s content is in another. For example, the consumer’s query is in Spanish, but the article is in English.</p>

<p>If you need to support cross–lingual queries, the approach to take depends on the solution:</p>

<ul>
  <li><strong>Conversation Assist</strong>: In your knowledge base rule, you can perform custom processing of the user’s query and the answers that are returned. That custom processing (via an LLM) can include translation.</li>
  <li><strong>Conversation Builder KnowledgeAI agent</strong>: Support for cross-lingual queries is still experimental. What’s more, currently, it relies on <a href="knowledgeai-key-terms-concepts-answers-enrich-via-generative-ai.html">enrichment of the answer using conversation context and Generative AI</a>. Why? Consider a consumer query in Spanish against an English-language knowledge base. Our early testing indicates that the LLM service, during enrichment of the answer, is likely to generate an answer in the same language as the consumer’s query, in this case, Spanish. All this said, stay tuned for enhancements in this area!</li>
</ul>

<h3 id="working-with-special-language-characters">Working with special language characters</h3>

<p>If you need to support special language characters (e.g., ö, ü, ß), and you’re creating an <a href="knowledgeai-internal-knowledge-bases-introduction.html">internal knowledge base</a> by importing a CSV file, ensure the import file is saved as a UTF-8 encoded CSV file beforehand.</p>

<h3 id="related-articles">Related articles</h3>
<ul>
  <li><a href="intent-manager-natural-language-understanding-language-support.html">Language Support</a> (NLU engines)</li>
  <li><a href="conversation-builder-bots-language-support.html">Language Support</a> (LivePerson Conversation Builder bots)</li>
</ul>
]]></description>
      <!-- <pubDate>Thu, 10 Jul 2025 00:00:00 +0000</pubDate> -->
    </item>
    
  </channel>
</rss>