Skip to content

Webhook

Automation without connection to your Information System, APIs, databases ... will certainly be of little interest.

Prisme.ai allows you to declare connectors using their URLs and headers. A connector, we are going to name it Webhook.

As soon as you create a webhook, you can then share with your team or the community in the ** Store ** menu to pool and share your resources.

A webhook will then be a step in your workflows.

Example of use :

  • You create a "Weather" webhook which gives you the temperature, wind and humidity for a city.
  • Then as soon as you need the weather forecast in the services you are going to create, in your Workflow, you add a step "Call a Webhook" and select "Weather".

Receiving a Prisme.ai request

Request's body

Prisme.ai will send a request with the following body :

{
  body: {
    timestamp: string;
    sessionId: string;
    bot: {
      botId: string;
    };
    user: {
      id: string;
      platform: "web";
      conversationSize: number;
      conversationId: string;
    };
    userMessage: {
      event: string | null;
      text: string;
      payload: any;
    };
    originalRequest: {
      webhook: {
        url: string;
        parameters: string[];
      };
    };
    lang: string;
    query: string;
    fulfillment: {
      stream: StreamResponse[]; // Those are the intent's responses
      data: any[];
    };
    intent: {
      name: string;
      confidence: number;
      inputs: {
        [k: string]: string;
      };
    };
    contexts: string[];
    endConversation: boolean;
  };

Extract from the structure of the request you receive from Prisme.ai

Parameter Description
user the end user
event Event
query user Query
intent user detected
intent.inputs parameters
contexts conversation context

Example :

body: { "id": "",
   "timestamp": "2018-09-21T12:02:39+00:00",
   "sessionId": "BxopMtpjDl5Pfrc4",
   "user": { "platform": "web", "conversationSize": 1 },
   "lang": "fr",
   "query": "Je souhaite réserver trois chambres pour 4 personnes avec petit déjeuner",
   "endConversation": false,
    ...
   "status": { "code": 200, "errorType": "success" }
  }

Respond to the request

Response types

Card

key type required ? description
type string required 'card'
title string required Card title
text string required Text content, below the image
image string optionnal image url
imageDisplay string optionnal "background-size" css property, by default "contain"
buttons array optionnal List of clickable elements at the bottom of the card
key type required ? description
type string required 'button', 'event' or 'link'
text string required Text shown as a button
value string required button: text that will be sent after click, event: event that will be sent, link: target url
openInPanel boolean optionnal Only for link, to open it in a panel
quickReply boolean optionnal Disable the other buttons when it is clicked

Perform a ‘POST’ type request with a JSON request body structured as follows:

Parameter Description
stream an array of messages (event, card, link, button, file ...)

Example

{

 "stream" : [
   {"text" : "Oui bien sûr"},
   {"type" : "button","text":"click me","value":"clicked"},
   {"type" : "link","text":"click me","value":"URL | tel:PHONENUMBER | mailto:EMAIL"},
   {"type" : "card","title":"I am a card","image":"image URL","text":"some text..","buttons":[
       {"type":"button | link","text":"...","value":"..."},
       {"..."}
   ]},
 ]
}