liveBook · Manning

Webhook

As explained in Effective Conversational AI

A webhook is an API endpoint that is invoked automatically when a specified event occurs in another system.

When a chatbot needs to keep its own conversation transcript, a webhook can update it automatically as the conversation unfolds. A webhook is an API call triggered by a predefined event. In a chatbot’s orchestration layer, it can run before or after the bot processes a user response and can use conversational context. section 12.2.2

For example, a post-webhook can add each user message and bot reply to a transcript, one message per line. The transcript can be a string, array, JSON object, or custom object. Platform terminology and the required format vary, so check the platform’s documentation before implementing one. section 12.2.2

Listing 12.3 Pseudocode for a webhook that updates a transcript
def transcript_webhook(request, response):
  userMessage = request.input.text  #1
  botMessage  = response.output.text  #2
  if(userMessage != null)  #3
    response.context.transcript += 'User: ' +  #4
    userMessage + '\n' 
  if(botMessage  != null)
    response.context.transcript += 'Bot: ' +  
    botMessage + '\n'

The pseudocode shows a post-webhook adding available user and bot messages to the transcript. section 12.2.2

How Effective Conversational AI covers it

How deep it goes
Defines pre- and post-processing events and illustrates transcript updates with pseudocode, while deferring platform-specific terminology and formats.
Examples
Shows a post-webhook appending user messages and bot replies as labeled lines in a transcript.
What it assumes
Assumes a chatbot orchestration layer and notes that platform-specific webhook terminology and formats may need checking.
What you can do after
Apply a post-webhook to update a transcript with available user messages and bot replies.
How it connects
Connects webhooks with APIs, orchestration layers, conversational context, and chatbot transcripts.

Also explained in

Compare how 6 books explain webhook →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Conversational AI. The section links point to the parts of the book it draws on.