Skill Level: Any Skill Level

This recipe will allow you to deploy a fresh bot on your IBM Bluemix environment and make it accessible from web and Facebook Messenger in less than 10 minutes.
This app also lets you modify user input, Watson output, context, and display buttons easily.


  • Bluemix Account - Sign up for a trial account if you don't already have one.
  • [Optional] Facebook Account (for Messenger integration) - Sign up if you don't already have one.
  • [Optional] Telegram Account (for Telegram integration)
  • [Optional] Watson Conversation Workspace - I made a sample one in French on my GitHub repository

You can also check my Github repository for more info.

French Showcase (webapp) : http://conversationmaster-main.mybluemix.net

French Showcase (Telegram Messenger) : https://t.me/ConversationMasterBot


  1. Deploy to Bluemix

    1. The first thing you have to do is to deploy the sample app to Blumix. button2
    2. In this example, we’ll call this app ‘sample’ and its link will be sample.mybluemix.net.
  2. Create a new Facebook Page

    1. Go to https://www.facebook.com/pages/create/
    2. Create an app.
  3. Create a new Facebook application

    1. Go to https://developers.facebook.com
    2. Log in and create a new app.
    3. Choose App for Messenger and Create an app ID.
    4. Select your new Page in Token Generation field. access_token
    5. Copy the Page Access Token.
    6. Go to Dashboard and Copy your Secret key.access_token
  4. Create a new Telegram bot

    1. In Telegram, start a new conversation with @BotFather
    2. Say ‘/newbot’ then give your bot a name and an username.
    3. Copy the HTTP token that is given to you by BotFather.
    4. Create an arbitrary webhookEndpoint for Telegram (ie. /webhook1234), and copy it for later.
  5. Create (or import) your Watson Conversation workspace

    1. Open the Watson Conversation tool, and create (or import) a new workspace.Screen-Shot-2017-04-21-at-00.00.52-copyScreen-Shot-2017-04-21-at-00.02.38-copyScreen-Shot-2017-04-21-at-00.11.12-copy
    2. Click on the three dots and choose View details.workspace_id
    3. Copy the Workspace ID.
  6. Set your envirnmental variable in Bluemix

    In order to work, your Bluemix app will need some environment variables.

    1. Go to https://bluemix.net and get to the Runtime part of the app freshly created. Click on Environment variables.bluemix_appenv_variables
    2. Use the Page Access Token previously copied as MESSENGER_PAGE_TOKEN.
    3. Use the Secret Key as MESSENGER_APP_SECRET.
    4. Set an arbitrary MESSENGER_VERIFY_TOKEN and keep it for later.
    5. Create a webhook endpoint for Facebook Messenger as you did for Telegram with what you saved earlier and set it as MESSENGER_WEBHOOKENDPOINT.
    6. Set your TELEGRAM_AUTH_TOKEN and TELEGRAM_WEBHOOKENDPOINT with what you saved earlier.
    7. Set your WORKSPACE_ID with what you copied earlier.
  7. Configure the Facebook webhooks

    1. Click on Configure webhooks
    2. Use https://sample.mybluemix.net/messenger/MESSENGER_WEBHOOKENDPOINT (watch out, we’re here using our sample link, DO NOT copy paste this link)
    3. Select messages, messages_deliveries, messaging_postbacks, and messaging_optins as subscribing fields.
  8. Configure the Telegram webhook

    1. Open the page https://api.telegram.org/botHTTP_TOKEN/setWebhook?url=https://sample.mybluemix.net/telegram/TELEGRAM_WEBHOOKENDPOINT
  9. Almost done !

    And that’s it, your app is now fully deployed, accessible through the web directly, from Messenger, and from Telegram !

    But, for now, you’re the only one able to use the Facebook app, if you want someone else to use your chatbot through the Facebook page, you need to add them as Testers or Developers.


    Here is a link to my detailed documentation on how to make this code yours and how to use every piece of code I added. (including buttons for premade answers on Messenger and Telegram)

    Please let me know if anything goes wrong for you.

22 comments on"How to build an enhanced chatbot with Watson Conversation"

  1. Hi, thank you for your help!

    I have a problem in step 7, because I try to create a Webhook on Facebook.

    my aplication is: conversationMaster-vyktor-01.mybluemix.net

    which are the correct parameters?
    my paremeter are:

  2. mohamed.mokhtar April 11, 2017

    it seems outdated or something, you lost me on point 5 , i can’t find any of those things

    • cyrille.benoit April 20, 2017

      Hi, I’ve added some more screenshots in Step 5 so you can follow the instructions on your machine. Thank you for your feedback 😉

  3. chrisjeo93 April 18, 2017

    Hi. What do I enter in the verify token field while customising the webhooks?

    • cyrille.benoit April 20, 2017

      You may enter some personal text, like, for instance : test123
      Facebook will check if the token you gave it and the one from the Bluemix App are the same so it belongs to you.

  4. randywreed April 27, 2017

    I would note that when I tried to deploy this through tool pipe, I got
    “Creating route wConversationMaster.mybluemix.net…
    Server error, status code: 400, error code: 210003, message: The host is taken: wConversationMaster
    Finished: FAILED”

    Solution to this was to change the host in the manifest1.yml file to “rrwConversationMaster” (or whatever your intials are). I would note that if you use the Eclipse Orion Web IDE that toolchain setup for you, any changes made need to committed (use the git menu which is launched using the 2nd icon on the left) and then pushed before they will actually take effect.

  5. leowiseBLUE May 09, 2017

    Hi, I am note sure how many ppl is using this recipe, which I found an easy and interesting way to test Watson. However, after following a very similar recipe that also uses the Telegram client, the app failed after a couple of days!
    I found out that the Node-RED implementation used by Bluemix has deprecated support for Nodejs v5 so this breaks the Telegram Nodes!


  6. Hi all, I have been facing an issue with the creating a call back url ,which is used at the facebook web hooks creation. Please anyone guide me on the issue.

    • cyrille.benoit September 05, 2017

      Your callback URL is made like this :

      For instance:
      If my app is live on https://conversationMaster-main.mybluemix.net, and I’ve set my MESSENGER_WEBHOOKENDPOINT to /Hemanth2396, then I’ll give Facebook the following address:

      Oh, and make sure to put a slash at the beginning of your env variable in Bluemix, if this doesn’t work right away.

      Hope this solved your issue,


      • Thanks for your reply i tried as above but the call backurl not worked.
        “make sure to put a slash at the beginning of your env variable in Bluemix, if this doesn’t work right away”,I dint understand this can you please give me brief

      • for the messenger webhook point i have created like this /webhook. It is also not working showing some error as,”The URL couldn’t be validated. Callback verification failed with the following errors: HTTP Status Code = 404; HTTP Message = Not Found”

        • cyrille.benoit September 07, 2017

          Is your app running on Bluemix?
          What do you get when you use your browser to go to the address you send to Facebook?
          If you are getting a 404 error (I assume you will from your words) then there could only be 2 possibilities as far as I know:
          1. The app is not running, so the address doesn’t exist.
          2. You’ve misspelled the address you gave to Facebook. (or the webhook endpoint in the environment variables)
          Also make sure to use an httpS link and not http.
          If you keep having troubles I suggest you to email me at cyrille.benoit@fr.ibm.com so we can figure this out in private.

  7. please give me details how to create a call back url.

  8. Hi, thanks for the guide! 2 Things:

    You have to restart the bluemix app before you can call the callback from the facebook dev site (2/2 cases). This might help some.
    However, i followed the guide and neither messanger, telegram nor the app directly worked.
    There are no errors in the interfaces…

Join The Discussion