Integrating a Content Intelligence

Integrating a content intelligence is done in just a few steps. In this guide, we'll explain what's needed.

Accessing the necessary information

Before making the flow, separate the information that will be used:

  1. On Weni Platform, access the content intelligence you want to integrate, in the Artificial Intelligence module;
  2. Then go to the API page, located on the left sidebar:
  3. From the drop-down box, select the Knowledge Base you want to integrate.
  4. When selecting the Knowledge Base, its information will be loaded in the area below
    The URL is the link to the API related to this type of intelligence. The Access Token is the code needed to authenticate your user and the POST body Informs the Knowledge Base code, the question to ask (variables can be used here) and the Knowledge Base language.
  5. Finally, the API page also has a mini-guide for integration and an API return example:

How to integrate intelligence to Weni Fluxos or Rapidpro

In Weni Fluxos or Rapidpro, follow the steps below:

  1. Create a flow, or open the flow in which you will integrate
  2. Add a Wait for Response card. This card will receive the question asked by whoever uses your chatbot. To facilitate identification, name the result a question, or another term that identifies that it will store a question:
  3. Then add the flow card Call a webhook
  4. When the card opens, select the POST in the method selector and paste the z entered into the URL field:
  5. Click the HTTP Headers button and enter the Access Token:
  6. Click the POST Body button and enter the POST Body information. In question, include the variable that contains the result. In this example the variable is called "question", so we enter "@results.question":
    Tip: Learn more about flow variables in this article.
Handling the responses received

After configuring the Call Webhook card, the information received by the flow can be processed and used. Here is an example of usage.

Once the Call Webhook card runs, you can use the response values ​​by inserting these formulas into your flow:

  1. @(results.result.extra.answers.0.text) - The answer that has the most confidence
    1. @(results.result.extra.answers.0.confidence) - The confidence of the first returned response
  2. @(results.result.extra.answers.1.text) - The answer that has the second highest confidence
    1. @(results.result.extra.answers.1.confidence) - The confidence of the second response returned
  3. @(results.result.extra.answers.2.text) - The answer that has the third highest confidece
    1. @(results.result.extra.answers.2.confidence) - The confidence of the third response returned

How did we do?

Introducing the Content Intelligence