WeatherBot in Line
  • 30 Oct 2019
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

WeatherBot in Line

  • Dark
    Light
  • PDF

Article Summary

Log in Line

  1. Register your Line@ account in Line business Center.
    messaging_api

  2. Put required information about your Bot (account name, business type) for your LINE@ account.
    image

  3. And then select LINE@ MANAGER.
    line_manager

  4. Next, press Messaging API on “Enable API” page
    image

  5. 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"
    settings_bot

Webhook and Access token

  1. In “LINE Business Center", in Accounts section, choose LINE Developers to go to Channel Console.
    image

  2. In order to get Channel access token for API access, press ISSUE near “Channel access token” area.

  3. Press EDIT and setup webhook URL.
    pic5

  4. 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"
copy_proc

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":

connect_to_messenger

connect_to_messenger1

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.

connect_to_messenger2

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.
conv_weatherBot2

In case if city or coordinates are specified incorrectly and also if there is an error occurred in process, bot sends an appropriate message.
conv_weatherBot

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.
weather_key(2)

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.
set_token(1)

Testing and launch

In order to test your bot, add it to your friendlist with ID Line - @zvm1764c or QR code:
QR-code1

Just add your bot in Line and start a chat:

screenshot

Switch to View or Debug modes to see the stream of requests, how it is moving and distribute to all process nodes.
botweather_view


Was this article helpful?