Use Chatfuel to make weather search chatbot (Chatfuel part 4)

Tram Ho

Hello friends

Surely you have read the entire series of articles on how to use Chatfuel to make chatbots for your fanpage, right?

I have shared the good things in those posts. If you have not read it, you can access your articles to read again following the links below.

And continue the series of interesting games when making chatbots with Chatfuel, today I bring you another tutorial, which is to do chatbot looking up weather data.

Ok, got it Let’s go

To use in this article I need an api that provides weather data value and search on google, you will encounter quite a lot of results returned like this. https://rapidapi.com/blog/access-global-weather-data-with-these-weather-apis/

Here, I use the OpenWeatherMap API! provided at https://openweathermap.org/api

To use it, we need to create an account here to get api_key. Please register an account here: https://home.openweathermap.org/users/sign_up

Then there will be an email sent to us like this, including instructions for use. If you do not see enough details, we will look at its api page.

Ok, got it So there is API key, we start the code to submit data when querying. Please use the code below.

https://gist.github.com/quangpro1610/cb11fa8dd29c2c52197a5dd7d9b25083

In the above code, remember to change the api key that OpenWeatherMap has emailed to you.

Next is the setup for chatbot, you setup as shown below

Explain that because we use to receive the value of the user’s province or city to send a bot message to the bot to return the result, we use the get method to receive the user’s data, then will Return the data via the code we made above.

Finally, after setup is complete, we run the test and the results will be the same. Wish success

Share the news now

Source : Viblo