Lynn
  • Lynn’s User Guide
  • 📖Building Up the Knowledge Base
  • 🛠️Creating a Widget
  • 📝Add Suggested Questions to Your Widget
  • 📗How to Update Your Knowledge Base
  • 🖋️Setting Up Model Answers
  • 🎗️How to Embed A Chat Widget
  • 💬Personality Customization
  • 🦸How to Handover to Human Support
  • 📈Trending Topics: AI Categorisation for Insightful Conversation Analysis
  • 📊Reports Dashboard
  • 🪄Lynn Javascript API
  • 🏉Webhooks
    • Next.js
  • 🎭How to Integrate Tidio with Lynn for Seamless Customer Support with Live Agents
  • 🔍How to Capture Your Leads Through the Lynn’s Widgets
    • Next.js
Powered by GitBook
On this page
  • Setup
  • Payload
  • Receiving the Request

Was this helpful?

Webhooks

PreviousLynn Javascript APINextNext.js

Last updated 8 months ago

Was this helpful?

While Lynn's AI-powered chatbots bring significant value by automating customer interactions, it's essential to recognize that they work within the current boundaries of AI technology.

With Lynn, there are several effective methods to address these challenges and ensure customer satisfaction by seamlessly transitioning them to human assistance when the AI encounters limitations. Let's explore how you can leverage Lynn's features to achieve this.

The guide provides you with the capability to configure webhooks to receive a POST request when a requirement for a human handover event is triggered.

Setup

The image shows a user interface for setting up handover rules in Lynn.

For the section to add a new handover rule, you should fill in details such as:

  • Title: The name or identifier for the new rule.

  • Rule Type: Options to select whether the handover is a webhook rule (as in the example shown) or an email rule.

  • Webhook URL: The field where the user would enter the endpoint URL for Lynn to send data to when the handover is triggered.

  • Secret Key: Once you've set up the handover rule, you'll notice a part of the screen that keeps the secret key just out of sight. Think of this key as a secret handshake between Lynn and the endpoint. This key is used to sign requests to verify their authenticity.

Payload

Key

Type

Description

conversationId

String

Identifier for the conversation.

workspaceId

String

Identifier for the workspace.

widgetId

String

Widget identifier to identify the widget that triggered the event.

messages

Array

An array of messages that exchanged in the conversation.

createdAt

String

Timestamp for when the message was created.

updatedAt

String

Timestamp for when the message was last updated.

contactEmail

String

Email address provided by the user who need the support.

Example:

{
  "conversationId": "clP5fVfvHISpzpLkJub2",
  "workspaceId": "04JchTJQCSG4GyYobqi1",
  "widgetId": null,
  "messages": [
    { "text": "Hi", "senderRole": "human" },
    {
      "resources": [],
      "text": "Hello! How can I assist you today?",
      "senderRole": "lynn"
    },
    { "text": "I need human support", "senderRole": "human" },
    {
      "resources": [],
      "text": "Sure, would you be able to share your email address for our awesome support team to get back?",
      "senderRole": "lynn"
    },
    {
      "text": "Here's my email address - vinsurakumuthu@gmail.com.",
      "senderRole": "human"
    },
    {
      "resources": [],
      "text": "Well received, thank you!",
      "senderRole": "lynn"
    }
  ],
  "createdAt": "2023-11-23T07:48:23.119Z",
  "updatedAt": "2023-11-23T07:48:59.400Z",
  "contactEmail": "vinsurakumuthu@gmail.com",
  "customMetadata": null
}

Receiving the Request

You can easily get the information you need from the request body, just like you would with any request. However, for added security and to prevent spam from people who are aware of your endpoint, it's a good idea to check the x-lynn-hmac-sha256 in the request header. This helps ensure that only legitimate requests are processed.

To verify the data's authenticity, encrypt the entire request body using HMAC-SHA256 with a secret key that Lynn’s admin portal. Then compare the generated signature with the x-lynn-hmac-sha256 value in the request headers. If they match, it confirms the message's legitimacy.

The following Next.js code example demonstrates a secure way to handle webhook requests.

For testing the functionality of your webhook, you can use as a convenient tool to simulate receiving and inspecting the requests.

🏉
webhook.site
Next.js