foxhard
foxhard

Reputation: 506

Unable to trigger event from webhook - api.ai

I need your help with the using of events for communication from webhook to demo chat (https://snag.gy/6tfGEZ.jpg) of api.ai. I have already test in telegram too and it does no work either.

My flow is the following:

The user request something from the api.ai web demo chat. for instance: “Hi, I need my access code” Api.ai gets the intent and send it to my webhook. My webhook starts an asynchounous operation to process user request (it could take more than 6 seconds) and returns “We are processing your request please wait a few seconds” to api.api therefore the user will see that message in demo chat. After the asynchrounous process has been finished the next step will be call POST https://api.api.ai/api/query?v=20150910 with body { "event": { "name": "result_event", "data": { "code": "ABDDRR787545HHTTU4545454" } }, "timezone": "America/New_York", "lang": "en", "sessionId": "a77875da-4bd5-db26-dce2-e42439d4fbde" } result_event already exists inside an Intent that contains the response “Your request was processed. Here your code: $code”.

The idea here is the user get the respond to his request for instance: “Your request was processed. Here your code: ABDDRR787545HHTTU4545454”

Althought I get a successfully respond of (https://api.api.ai/api/query) called from my webhook the user don’t get any response in the demo chat.

This is the screen (https://snag.gy/qN3tTC.jpg) of the intent with my event in api.ai.

What do you think I’m doing bad ?

Thanks in advance

Upvotes: 2

Views: 590

Answers (1)

Apoorvraj saxena
Apoorvraj saxena

Reputation: 36

Events in API.AI are calling methods for a specific intent. it does not trigger anything so you can not get any triggered for you web-demo bot. this will work if you can make a custom html bot where you can call events endpoint to get the json data and show it in your html bot.

Upvotes: 2

Related Questions