Weather bot on Line
  • 22 Oct 2024
  • 4 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Weather bot on Line

  • Dark
    Light
  • PDF

Article summary

Introduction

The weather bot is a simple and efficient tool for getting real-time air temperature updates. By providing either your city name or coordinates, the bot instantly retrieves the current temperature and sends it directly to you. It's designed to be user-friendly and quick, saving you time when you need weather information on the go. Whether you're planning your day or checking for travel, the weather bot has you covered with accurate, location-based data.

To learn more about the weather bot ion Line, get familiar with the following topics:

Create Line official account

To create the Line official account:

  1. Go to https://developers.line.biz/en and create an account by clicking Log in to Console.
    Developer console page

  2. On the Providers tab, click Create.
    Create provider button

  3. In the Create a new provider dialog, enter a provider name and click Create.
    Create weather bot dialog1

  4. On the Channels tab of the created provider, click Create a Messaging API channel.
    Create Messaging API

  5. On the Create a Messaging API tab, click Create a Line Official Account.
    Create Line acc button

  6. In the Verify by text message dialog click Verify by text message and pass the verification by using your phone number.
    Verify by text message

  7. On the Create a Line official account page:

    1. Enter an account name in the Account name field.
    2. Enter an email in the Email address field.
    3. Select a country in the Country dropdown list.
    4. (Optional) Enter a company name in the Company name field.
    5. Select a main industry in the Main industry dropdown list.
    6. Select a subindustry in the Subindustry dropdown list.
    7. Click Continue.

    ENter company info page

  8. On the Confirm info page, check whether the provided information is correct and click Submit.
    Confirm info page

  9. On the Account info page, click Go to Line Official Account Manager.
    Application complete

  10. In the upper-right corner of the created bot page, click Settings.
    Settings button on page

  11. On the left navigation panel of the Account settings page, click Messaging API.
    Mess Api tab

  12. On the Messaging API page, click Enable Messaging API.
    Enable Messaging API

  13. In the Select provider dialog, select the newly created bot checkbox and click Agree.
    Select provider dialog

  14. (Optional) In the Privacy Policy and Terms of Use dialog, enter the Privacy policy and Terms of Use URLs and click Ok.
    Privacy policy dialog

  15. In the Enabling Messaging API dialog, click Ok.
    Enabling Mess API

  16. In the Webhook URL field of the Messaging API page, enter the corresponding webhook URL and click Save.
    Webhook URL field

Your account and your bot have been created with the messaging API channel.

Customize weather bot

Before proceeding with the steps below:

  • Upload the weather bot project file to your computer.
  • Create an account on https://home.openweathermap.org, go to My API keys, generate an API key and copy it.
    Generate API key

To customize your weather bot:

  1. Go to admin.corezoid.com, in the upper-left corner, click Create, and from the dropdown list, select From file.
    Upload ffle

  2. Upload the weather bot project file to your Corezoid workspace, click it, and select the config diagram.
    Config diagr

  3. In the upper-left corner, click View, click + New task, and in the New Task dialog:

    1. Enter tokens in the REF field.
    2. Enter access_token and apiKey in the Key fields.
    3. Enter the channel secret key (from the Line weather bot) and the generated key (on https://home.openweathermap.org) in the Value fields.
    4. Click Add task.

    Create task

  4. Go back to the Line weatherBot folder, select the BP-processes folder, and click the weather_bot process.
    BP processes

  5. In the weather_bot process, click the first node, in the Parameters of its details panel, change @config with the config diagram ID, and click Deploy.
    Weather_bot process

  6. In the webhook folder, click the main-webhook process, click the info icon, and on the Webhook tab, click Connect to messenger.
    Webhook folder

  7. In the Connect to messenger dialog, click Messenger.
    Connect to mess1

  8. In the Connect to messenger dialog, click Copy webhook.
    Copy webhook option

  9. On the Messaging API page, enter the copied webhook in the Webhook URL field, click Save, and then click Line Developers.
    WebhookURL and Line dev

  10. In the upper-right corner of the Line Developers page, click Console.
    Console button

  11. On the Providers tab, click your bot name.
    Bot view

  12. On the Basic settings tab, customize your bot data by clicking Edit.
    Bot settings tab

  13. On the Messaging API tab, scan your bot QR code, turn the Use webhook toggle on, edit your bot information by using toggles or clicking Edit (if needed), and click Issue to generate the channel access token.
    MessAPI bot settings

  14. Copy the generated channel access token by clicking the copy icon.
    Copy access token

  15. In the config diagram, click the edit icon and in the New task dialog, insert the copied channel access token in the Value field, and click Add task.
    Edit Config diagram

Your weather bot has been customized, and you can start using it.

Use weather bot

You can use the weather bot by sending either the city name or your coordinates. The bot will receive this data, fetch the relevant air temperature data, and send you a message with the result.
image.png

If a city or coordinates are specified incorrectly or there is an error occurred in the process, the weather bot sends the corresponding message.
image.png

Test and launch weather bot

To test your weather bot:

  1. Add it to your friend list by using its ID on Line or QR code.
    Find bot

  2. Add your bot in Line and start a chat.
    image.png


Was this article helpful?