Webhook & api.ai

#1

Hi there,
I read docs about webhook at FlowXO and the ones at Api.ai, I promise, but the fact is that I use Flowxo because I am not a programmer… and I need your help once again to get this working.

A video from Steven, with step by step examples, would be great and easy to understand. In the meanwhile, please, could you give me some webhook examples?

I have registered at api.ai, created entities and intents, trained, and tried them satisfactorily inside api.ai site. I have a api.ai token. I need your help to connect both systems.

  1. I will get-a-message from my client at FlowXO, and I want to send it to Api.ai. Please, a line of the webhook that I should use for such purpose?
  2. Api.ai will analyze the sentence, find one ‘entitie’ based on one ‘intent’ I created, and it will try to get more info from my client, a second entitie, with one question. Therefore Api.ai will provide a question/sentence which must be received by FlowXO. How will I get this sentence and know that Api.ai wants more?

I think that if -with your help- I could understand this with one or two examples, I could move on. Thank you!!

#2

Hi,
I am finding it by my own using webhook:

Once tested, I see in FlowXO logs that I get an answer from api.ai, json format.

Status Code
200
Body

Data

Inside the Data results I find that api.ai is asking the user for more information according to my previous work at Api.ai:

"fulfillment": {
  "speech": "What kind of test or sentence?",
  "messages": [
    {
      "type": 0,
      "speech": "What kind of test or sentence?"
    }

Now my problem is already inside FlowXO: How can I use this information received? I mean, I want to send the question “what kind of…?” to my user. Where has it been recorded? I am lost here. Is it an attribute? Named?
Thank you

#3

OK, I got my own answer again (it sounds silly, I know, the amazing learning!). I just write it down for those looking for the same in the future.

I found that answer here https://support.flowxo.com/article/143-data-outputs
i.e. mytask.data__fulfillment__speech or mytask.data__messages__fulfillment__speech

Thanks again

(John Jackson) #4

Glad you figured out the solution here. We’re trying to improve the resources we have available and access to info to make it easier to find the kind of answers you needed.

You are right about the solution.

Except in the case of the example you gave, you could use:

mytask.data__fulfillment__speech
mytask.data__fulfillment__messages__0__type
mytask.data__fulfillment__messages__0__speech

And if there were more than 1 message, to access the second:

mytask.data__fulfillment__messages__1__type
mytask.data__fulfillment__messages__1__speech

(For the benefit of others here, this is in any action after the HTTP request. Use the ‘Data’ output of the HTTP action, and when it asks you to enter a key, type fulfillment__speech, or fulfillment__messages__0__type etc. to access the data you need).

Good luck building out the rest of your flows! :grinning: Thanks for using the platform.

(Talvinder) #5

@Kiko what did you use as session id? I am planning to use responsepath, is that a good idea?