Creating a Wikipedia bot in Api.Ai using Wikipedia API and integrate it in Telegram

This post briefly explains how to use Wikipedia’s Open Search API to search Wikipedia and return the result to our Bot.

Wikipedia API

Example Call:


Format – any of json,jsonfm,xml,xmlfm  More in the Docs

action –  opensearch

search – our term to search for, here it’s “Global Warming”

limit – Max number of results to return, we set it to 2. To make the call faster as it would return fewer data.

profile – more in the Docs


Example Result:

   "global warming",
      "Global warming",
      "Global warming controversy"
      "Global warming, also referred to as climate change, is the observed century-scale rise in the average temperature of the Earth's climate system and its related effects.",
      "The global warming controversy concerns the public debate over whether global warming is occurring, how much has occurred in modern times, what has caused it, what its effects will be, whether any action should be taken to curb it, and if so what that action should be."

] Intent

Create a new Intent for our agent. In what user says section add few sentences like below screenshot. When you enter these sentence might pre-select few words as system entities. You would want to remove any preselection and select the term to search of in all the sentences and define it as @sys.any

In the action, you will find the parameter, name it “wikisearchterm”. You can name it anything but our woobhook is made to recognize this parameter. Also, make it Required and define prompts.


And Check “Use Webhook” under fulfillment. We will be using the same URL as in the last tutorials.

Url is:



You can check the complete code for the webhook at my GitHub. It just a simple GET request to Wikipedia. And returns text for and telegram integration. I am putting all the webhook so far in one file. So you will see other webhook there as well.


Bot In Action

Telegram bot: @iameurekabot Web integrated Bot:


3 thoughts on “Creating a Wikipedia bot in Api.Ai using Wikipedia API and integrate it in Telegram

  1. Thank you for your informative article. I tried implementing your app, but on the diagnostic info, i recieve an error message ” Webhook failed. Error: 404 Not Found”. Could you please help.

    1. hm, my heroku account seems to be locked where i host the webhook. I am in middle of fixing it. but you can host it yourself and use it in your own telegram bot.

  2. Hello, thank you for your article. I am having a slight issue implementing your code. I get a “webhook call failed, Error : 404 not found”
    Could you help

Leave a Reply

Your email address will not be published. Required fields are marked *