- 30 Oct 2019
- 2 Minutes to read
- Contributors
- Print
- DarkLight
- PDF
WeatherBot in Line
- Updated on 30 Oct 2019
- 2 Minutes to read
- Contributors
- Print
- DarkLight
- PDF
Log in Line
Register your Line@ account in Line business Center.
Put required information about your Bot (account name, business type) for your LINE@ account.
And then select LINE@ MANAGER.
Next, press Messaging API on “Enable API” page
Customize your bot with Your Bot Settings by making next additional parameters: click on "Allow" for "Send event notifications" and "Bot access in group chats" and also "Forbid" for "Answering machine messages" and "Greeting messages"
Webhook and Access token
In “LINE Business Center", in Accounts section, choose LINE Developers to go to Channel Console.
In order to get Channel access token for API access, press ISSUE near “Channel access token” area.
Press EDIT and setup webhook URL.
After making this steps, your bot will interact with your users using API provided by Messaging API and you can go on and customize your bot.
WeatherBot
Clone template "WeatherBot"
WeatherBot - receives webhooks with city name or your coordinates, receives air temperature and sends a message.
In case if message does not contain city name or city is specified incorrectly and also if there is an error occurred in process, bot sends an appropriate message.
Next, in the "Set access_token and APPID_key" node, in the values of the variables:
- access_token put your personal Channel Access Token, that you recieved when created Bot in “LINE Business Center" in sections Accounts - LINE Developers - Channel Console.
- APPID_key put test access key for OpenWeatherMap API.
Webhook instal
For getting webhook-url of WeatherBot process, select "Connect to messenger":
Get webhook-url of WeatherBot for LINE Messenger. Then there is the empty field where you should put your personal Channel Access Token, that you get when created Bot in “LINE Business Center" in section Accounts - LINE Developers - Channel Console.
Specify received process webhook-url in your bot's settings at “LINE Business Center" in section Accounts -LINE Developers-Channel Console, more details described here.
What Weatherbot does
It will be enough to specify city name or your coordinates and this information your Bot receives air temperature and sends a message.
In case if city or coordinates are specified incorrectly and also if there is an error occurred in process, bot sends an appropriate message.
Integration with OpenWeatherMap
For user's comfort, we added test access key for OpenWeatherMap API into "WeatherBot" template. In order to get your access key for OpenWeatherMap API, follow link and register there. Key will be sent to your email or copy from site.
In "Set access_token and APPID_key" node, replace test OpenWeatherMap API key to the one that you received in value of the APPID_key parameter.
Testing and launch
In order to test your bot, add it to your friendlist with ID Line - @zvm1764c or QR code:
Just add your bot in Line and start a chat:
Switch to View or Debug modes to see the stream of requests, how it is moving and distribute to all process nodes.