Transition from Entity to Entity with BotKit SDK template response


(Yanluis Ulloa) #1

First, I didn’t know if asking in this category or APIs and SDKs because the question involves both categories, but here it goes.

I’m trying to modify the Flight Search Sample by removing the GetSourceAirports WebHook and FormatSourceRes Script dialogs.

Or, at least, the GetSourceAirports WebHook

The idea is that once the user enters the desired Source Name, the on_bot_message is triggered and the BotKit SDK insert a template response as explained here

How to use BotKit SDK Message Formatting with Templates?

But, I must be missing something, the DebugLog console shows that it is Transitioning from SourceName to Source. but it ends with Standard question ‘Discarding the task since we did not find any options for a list or lookup.’ identified

Take a look

The on_user_message is called, but the on_bot_message is never reached and is where I’m trying to return message template from the BotKit SDK.

I’ll really appreciate any help here, and if more info is needed I’ll be happy to provide it.

(Subrahmanyam Donepudi) #2

Hi @yanluis.ulloa,
Below is transition steps till the node “Source” for the dialog “find a flight”.

-> User enters the value for entity “SourceName” in the dialog.

-> This is passed to the bot kit as the “GetSourceAirports” webhook node is called.

-> In the botkit at, the logic has been written at webhook event as if the component is “GetSourceAirports”, then invoke the function findAirports() with searchterm as data.context.entities.SourceName


-> findAirports(searchterm) would call the endpoint and the list of airports will be received as response. sourceAirports is created and added to context from bot kit to store the airportResults. This variable is sent back to the platform which is used at the entity “source” to have the list.

So,in the dialog “find a flight”, the entity “Source” is dependent on the “sourceAirports”. Now that you have modified the dialog and have removed the webhook node “GetSourceAirports”, the entity couldn’t have the list and so the execution stopped.

(Yanluis Ulloa) #3

Hi @Subrahmanya, thanks for your response.

I’ve moved the logic you pointed from the *on_webhook to the on_bot_message in order to set the value of data.context.sourceAirports. No success anyway. Or, should I set the value of data.context.sourceAirports in the on_user_message message and the message template to render UI components in the on_bot_message?.

It is really confusing me. So, I’ve come with the following questions:

  • Can I make the flow I’m trying to accomplish without using webhook at all?
  • Can someone provide an example of a transition between two dialogs using the BotKit SDK without using webhooks*?

Thanks in advantage.

(Andy Heydon) #4

As an aside, why not use the airport entity within Kore and save the API request?

Airports can be identified by the their IATA or ICAO code, by their name and by the associated city.