LogoLogo
  • GETTING STARTED
    • Welcome to the NLX platform
    • How NLX works
    • Guides
      • Analytics dashboard
      • Chat
      • Generative Journey (Slots)
      • Model Context Protocol
      • Voice
      • Voice+
      • Touchpoint components
        • Carousel modality
        • Video modality
    • Terms & concepts
    • Generative AI
    • Developer
  • Build
    • Workspace setup
    • Flows
      • Intro to flows & variables
      • The Canvas
      • Flow settings
      • Nodes
      • Flow appearance
    • Resources
      • Actions
        • Implementation
        • Request model
      • Analytics tags
      • Context variables
      • Data requests
        • Implementation
        • Response model
        • Request model
      • Knowledge bases
        • Ingest content
        • Add metadata (beta)
        • Apply KB
      • Lifecycle hooks
        • Implementation
      • Modalities
      • Secrets
      • Slots (custom)
        • Adding values
        • Translating slots
      • Voice+ scripts
        • Add + download script
        • Deploy script + install SDK
        • Create Voice+ flow
    • Integrations
      • Channels
        • Alexa
        • Amazon Chime SDK
        • Amazon Connect
        • AWS End User Messaging SMS
        • AWS End User Messaging Social
        • Bandwidth
        • Genesys
        • Twilio
        • Zendesk Sunshine
      • LLM services
        • Amazon Bedrock
        • Anthropic
        • Azure OpenAI
        • Cerebras
        • Cohere
        • Google Vertex AI
        • Groq
        • NVIDIA
        • OpenAI
        • xAI
      • NLP
        • Amazon Lex
        • Google Dialogflow
        • Google Dialogflow CX
        • Custom NLP
    • Translations
  • Test & Deploy
    • Applications
      • Attach flows
      • Assign default behavior
      • Add channels
        • API
          • REST API
        • Alexa
        • Amazon Chime SDK
        • Amazon Connect
        • AWS End User Messaging SMS
        • AWS End User Messaging Social
        • Genesys
        • Genesys SMS
        • Messenger
        • Microsoft Teams
        • Slack
        • SMS via Bandwidth
        • Twilio SMS
        • Twilio Voice
        • WhatsApp via Twilio
        • Zendesk Sunshine
      • Deploy
      • Optional: Set lifecycle
      • Optional: Set languages
    • Test
      • Test a conversation
      • Automated tests
      • Test an external integration
  • Analyze
    • Conversations
    • Analytics
      • Creating dashboards
      • Formulas & multi-metrics
      • Canvas analytics
    • Training
  • Workspace Settings
    • Escalation channels
    • Resource tags
    • Audit
  • Admin
    • Access control
      • Roles & permissions
    • Notifications
    • FAQ
    • Contact support
Powered by GitBook
On this page
  • What's the Implementation of a Lifecycle hook?
  • External implementation
  • Static response
  • API spec
  1. Build
  2. Resources
  3. Lifecycle hooks

Implementation

Easily set up your Lifecycle hook's external webhook in your NLX workspace

Last updated 5 days ago

This feature is currently available to enterprise tiers only.

What's the Implementation of a Lifecycle hook?

A Lifecycle hook's Implementation is where you'll set up a static response or external webhook/API URL for your Lifecycle hook. When a conversation with your conversational AI application starts, ends, escalates, or streams state modifications and a Lifecycle hook is attached at one of those stages, the webhook will trigger the specified URL and run the process required.

Need more context? See


External implementation

External mode is used for integrating with a URL that triggers your Lifecycle hook:

  • Set implementation toggle to External

  • Enter the URL

  • Use NLX's AWS CloudFormation template provided within the Instructions section

  • Click Save

Optional:

  • Headers: Expand section > Click + Add header > Enter the Name and Value to be sent with the request. Useful for custom headers such as an API key, content type, content length, etc.


Static response

Static mode is useful for creating a static response when building demos or for early testing.

  • Set implementation toggle to Static

  • Enter your response in JSON structure

  • Click Save


API spec

HTTP POST payloads that are delivered to your Lifecycle hook's configured URL endpoint contain a few headers, including:

Header
Value
Description

Content-Type

application/json

The only content type currently supported is JSON

nlx-correlation-id

<uuid>

A unique identifier that can be used for debugging

nlx-lifecycle-hook-version

v1

The version associated with the Lifecycle hook configuration

The body of the POST request your webhook will receive may contain:

Name
Type
Description
Event Type

eventType

string

All

context

object

All

context.botId

string

A unique identifier of the application associated with this Lifecycle hook that has been triggered

All

context.channelType

string

A human friendly label indicating the channel type in use such as API, AmazonChime or Genesys

All

context.channelId

string

A unique identifier of the channel associated with the appplication

All

context.conversationId

string

A unique identifier of the conversation that triggered this Lifecycle hook

All

context.languageCode

string

All

context.lastUtterance

string

The last user utterance captured before the Lifecycle hook has triggered

All, except conversationStart and stateModification

context.intentId

string

The intent ID from where the Lifecycle hook has triggered

All, except conversationStart and stateModification

context.userId

string

A user identifier such as a E.164 format phone number, UUID or other formats depending on the channel type

All

context.<attributeName>

any

A set value of a custom context variable

All

context.request

object

The request message information

messageReceived

context.request.text

string

The user utterance

messageReceived

context.request.intentId

string

The intent ID if the request was structured, void of a user utterance

messageReceived

events

array of objects

An array of objects, where each item represents a state modification

stateModification

event.name

string

The name of the Data request property being modified, such as Profile.FirstName

stateModification

event.before

object

The whole Data request object before the state modifications

stateModification

event.after

object

The whole Data request object after the state modifications

stateModification

event.timestamp

string

The timestamp in milliseconds indicating when the state modification happened

stateModification

The response body of your Lifecycle hook can optionally include the following properties:

Name
Type
Description

context

object

A map of key value pairs that you would like to be set as context variables

context.<attributeName>

string, number or boolean

A set value of a custom context variable. The variable name can be an alphanumeric string with dashes and underscores

For example, the response body of a Lifecycle hook for a conversationStart event type may look like this:

{
    "context": {
        "FirstName": "Alice",
        "AccountNumber": 9932,
        "Subscribed": true
    }
}

Lifecycle hooks have a response timeout set to 3 seconds. Currently this value cannot be adjusted.

Whether you have sensitive data or frequently enter the same URL string, try setting up a in your workspace for enhanced security and efficiency.

Now that your implementation setup is complete, attach your Lifecycle hook to an application under the .

Now that your implementation setup is complete, attach yourLifecycle hook to an application under the .

The event type determined by the application's configuration. Possible values: conversationStart, conversationEnd, escalation, messageReceived, stateModification

The conversation context containing essential values such as the conversationId and any that have been set up to this point in the conversation

The application's used in the current conversation

Secret
application's Lifecycle tab
application's Lifecycle tab
Lifecycle
🧠
Application lifecycle
context variables
Implementation tab of a Lifecycle hook
language code