1. Documents
  2. Messaging API

Messaging API

The Messaging API lets you interact directly with individual users through either a LINE official account or a LINE@ account. With the Messaging API you can use APIs to automatically send customized responses to users when they add your account as a friend or send it a message. You can also send interactive messages from your server to users at any time.

How the Messaging API works

Using the Messaging API, you can send information between your company’s servers and a user’s LINE app via the LINE Platform. Requests are sent using JSON-based APIs.

bottrial-fig1

Architecture

Your server is linked to the LINE Platform. When a user adds your account as a friend or sends a message, the LINE Platform sends a request to your registered server URL. Your server then sends a response based on that request. This gives your users a better experience as they can feel like they are interacting with a friend.

Receiving messages/operations

Information is sent from the LINE Platform to your server whenever a user interacts with your account. There are two types of interactions:

  • User sends a message (message)
  • User performs an action such as adding your account as a friend (operation)

Information is sent via HTTP to your registered URL. A JSON string is generated in the request body for operations. The JSON string varies depending on the type of operation.

All requests include a signature in the header. Your server uses the signature to verify that requests are sent from the LINE Platform. If the request is not sent from the LINE Platform, the request is not valid and an unexpected event is triggered.

Calling APIs

You can useĀ APIs provided by the LINE Platform to send information from your server to users. What you can do with the APIs:

  • Send messages to individual users or to all users who have added your account as a friend
  • Get users’ nicknames

Your server can call APIs to send messages to users at any time. When API calls are made, a Channel access token or Channel ID, Channel secret and the MID for your Channel is set in the request header to verify that the call is from your server. You can get a Channel access token or Channel ID, Channel secret and MID of your Channel from the LINE Developers site.

APIs are accessed via HTTPS. The path and parameters are different for each API.

What you can do with the Messaging API

Use push messages

Send messages directly to users who have added your account as a friend. These are one-way messages you send to your users.

Use reply messages

Reply to messages from your users. Use webhooks to be notified about events for your account.

Send Imagemap messages using APIs

Send rich content messages that contain an image and a link. Imagemap messages are ideal for coupons, special promotions, news announcements, and blog posts.

bc_img002

Template messages

Send various types of template messages such as messages with images, text, multiple user action choices, and buttons.

Use your bot in groups and rooms

Engage with users in group chats as well as one-on-one chats.

Account types

To use the Messaging API, you’ll need either a LINE@ account or a LINE official account. Access to APIs vary depending on the account type and the plan associated with the account. For more information on account types, see LINE@ account and LINE official account.

Get started

To start creating a bot using the Messaging API, go to Getting started with the Messaging API.