Integrating Bot with Externally Sourced Data

As an information provider, bot ought to have the ‘I-Know-Everything’ attitude. It has to make sure its end-user is to stay in the know so that often companies need external resources to provide diverse information for it won’t be stuck on a singular, product-related, and specific kind of conversation.

3Dolphins dialogue developers are able to integrate that demand. It can be done with building Software Development Kit (SDK) or with our Process Flow feature; both provide the ability for developers to integrate 3Dolphins system with available APIs, within or without the authorisations depends on the API requirements you have. For an easier step, we’d like to focus on explaining the procedure in our Process Flow feature because it has fewer hassles and codes since it’s effortlessly displayed in a comprehensive UI.

This is when you have to insert source without authorisation and headers.

Integrating Bot with External Data Source without Authorisation and Headers

Look for the API that contains data you want.

Keep in mind that author use Process Flow feature as example to integrate Bot with that link above. Go to Process Flows tab, and you will see a clean workspace with only one “Start” activity node. Click “+” icon on right upper corner of workspace. Choose HTTP Request activity.

Explanation :

HTTP Request Name : Name of Activity Node (will appear in workspace)
Method : GET or POST. For this case just only use GET.
URL : Link or API Source to get a set of data.
Key & Value : If you need to add headers or authorisation. Add it with (+) HTTP Header button.
Play : To execute that HTTP Request.
Add : To save settings and add it on workspace.
HTTP Body (second tab) : To add body (if needed).
HTTP Response (third tab) : To see the result if you execute the setting using Play button.

Input Setting

When all the parameters are completed for the setting, you can test the activity by click the PLAY button and move to HTTP Response to take a look in the api response output. It will be shown like this.

Developer can process the response by doing it on MVEL Function. Developer can get it by clicking (+) icon on upper right corner in workspace. For example, if developer want to get email data on first array (that is [email protected]), we can do this on MVEL Function like picture below.

Make an activity node for output. Developer can use Webhook activity.

Connect all the nodes into one flow.

Save it into one workflow. Attach the workflow that has been made to Dialog Flow.

Integrating Bot with External Data Source Using Authorisation and Headers

This process has nothing prominently to differ but to add some more on HTTP Request activity node. If HTTP Request needs a body, the developer can add it on HTTP Body tabs. For example, an API needs a requirement like this:


  • Key = X-RapidAPI-Host, within given value
  • Key = X-RapidAPI-Key, within given value

Parameters (put parameters on URL, continue the URL link with adding “?” symbols):

  • location_id = 392339
  • currency = IDR

Method = GET

Remember you can use formatted variables for all the input parameter, in case you need dynamic input to execute the activity process. As you can see the following representation of input described above is shown here.

Given use-case: Public Holiday Schedule

As 2020 is still in the round of new beginning, and perhaps some people haven’t made it buy a calendar, Bella, for example, offered ease to let the end-user know about Indonesia’s holiday schedule. The data was made from an external source but has to take down the holidays that have been passed by. Here is how the use-case solved.

First, we need API source to make this process flow. For example, on this case, author get one API that provide data.

URL link: given a source

Parameters needed:

  • api_key (developer need to make account to get “api_key” and put in as parameter.
  • country = ID
  • language = ID
  • year = 2020

Combine URL link and parameters and result to put in URL is

Make an activity node, choose HTTP Request and make it like this.

Click Edit to save and add activity node on workspace. After that, make a MVEL Function activity node to process the data. Remember, in this case we need to remove holidays that have already passed. In MVEL Function activity node, insert code in MVEL Script tab. And then, make a Webhook as output of MVEL Function activity node.

Notes: Author’s MVEL Function activity node is named mvelHoliday. So, anyone must be careful on Webhook’s output.

Connect all the nodes and save it to a process flow. Developer can test the process flow before

developer attach it to dialog flow.

And it went like this!

You can try more on Bella rather than public holiday schedule, and your bot can do beyond that, too. If you are still curious about how to build bot integration with external data source you can always reach us at [email protected]. Stay tuned for a more thorough explanation about our products and optimizing its best performance here!

Share :
Related Post