This post is part of “ ” series. In this part, I will show you how to create a in with (formerly ) to show list of movies playing today in cinema. ChatOps Messenger Bot Golang DialogFlow API.AI Note: all the code used in this demo can be found on my . Github Start with an server exposing 2 endpoints: HTTP 1 — GET /webhook Handles challenge verification. It simply looks for the and responds with the sent in the verification request. Facebook Verify Token challenge 2 — POST /webhook Handles messages coming from : Messenger It calls the method which uses to send a image to the user: ProcessMessage Facebook Graph API GIF Note: for more in depth details check my tutorial Build a Facebook Messenger bot with Go and Messenger API Create a It will be “ ” of your bot: Facebook page. identity Then create a . It will be the middleware that connects the server and your public page. Facebook application Click from the left menu, then choose Add Product Messenger: At the , choose the page you just created from the dropdown menu, and it will generate a token: Token Generation Once you’ve gotten your and , make sure you add those two as environment variables for the server: PAGE_ACCESS_TOKEN VERIFY_TOKEN export PAGE_ACCESS_TOKEN=”YOUR PAGE ACCESS TOKEN”export VERIFY_TOKEN=”YOUR SECRET” In new terminal session, issue the following command to start the server: HTTP go run *.go In order to make our server publically accessible, I will use a tool called . It basically creates a secure tunnel on your local machine along with a public URL you can use for browsing your local server. ngrok Note: Keep in mind, to use your bot in production, you need to use a : like , IaaS AWS GCP, Azure … like PaaS Heroku, Clever Cloud … ngrok http 5000 Then, at the , click the button: Webhooks section Setup Webhooks After you’ve configured your , you will need to subscribe to the page you created earlier: Webhook Go to the you created and and click on “ ” button, next to the “ ” button near the top of the page. Start sending your Page messages and the bot should reply with a ! Facebook Page Message Like GIF By default, the bot should respond to everything with a image. GIF Now lets make it smarter, for that we will use an ( ) backend like (formerly ): NLP Natural Language Processing DialogFlow API.AI So after signing up to , create a new Agent: Dialogflow Give it a name and fill out the required fields: Once created, lets use feature of to give our bot the ability to have simple conversations: Small Talk DialogFlow Enable the checkbox. With this feature enabled we imported a lot of predefined answers for simple questions and phrases. You can easily change the responses to the questions if you don’t like them: Small Talk To test it out, you can use the at the right hand side: Console Now lets use this feature in out bot. offers many in different programming languages: DialogFlow SDKs But unfortunately, there’s no for SDK Golang But dont be sad, I made an to integrate with : SDK DialogFlow Golang So, install library: DialogFlow Golang go get github.com/mlabouardy/dialogflow-go-client Go back to dashboard and copy the : DialogFlow Client Access Token Set it as environment variable: export DIALOG_FLOW_TOKEN=”YOUR TOKEN” Create a new function that takes the message sent from a user via as an argument, and pass it to to get the appropriate response: Messenger DialogFlow Client Go to the and click on to start chatting : Facebook Page Message But that’s not enough, lets take this further and make our bot tell us about the movies playing today in cinema, and series airing today on TV. Create an , to store the type of the show ( or ) the user is asking about: entity movie series Then, create a new , which represents a mapping between what a user says and what action should be taken: intent Create some more questions: Finally, update the method to respond with a list of shows if the intent name is . The method is using the library to get the list of shows. ProcessMessage shows moviedb Let’s test the bot from : Messenger Wow !! you have created your first in with ! It was easy, wasn’t it ? chatbot Golang DialogFlow In the upcoming tutorial, I will show you how to create a with & . Serverless Messenger Bot Lambda API Gateway