Group chats

LINE bots can interact with users in group chats using the Messaging API. This page describes how you can use your bot in a group chat.

"Groups" and "rooms"

The LINE app has two types of group chats, groups and rooms. The users of a group or room are called members.

Group

A group is a chat that users join by accepting an invitation from the user who created the chat or another member of the chat. LINE users can create groups with a specified name and invite their friends to join the group.

Room

A room is a chat with more than 2 users where the users can freely add other users to the chat. Unlike groups, rooms do not have specified names and do not require an invitation for users to join.

Note: A room is created locally on the client when a user adds another user to a one-on-one chat. However, the room is not created on the LINE Platform until a user sends a message.

Receiving join webhook events

The following describes how join webhook events are triggered in groups and rooms.

  • Group: Sent when a user invites your bot to a group.
  • Room: Sent when the first event (for example when a user sends a message or is added to the room) occurs after your bot is added to a room.

For more information, see join webhook event.

Receiving message webhook events

The LINE Platform sends a message webhook event whenever a message is sent in a group chat where your bot has been added. The message event object includes a source object with a value of group or room in the type field.

"source": {
    "type": "group",
    "groupId": "Ca56f94637cc4347f90a25382909b24b9",
    "userId": "U206d25c2ea6bd87c17655609a1c37cb8"
    }

Note: The user ID is included only if the user has agreed to the Official Accounts Terms of Use.

Sending messages

Send reply messages with the /message/reply endpoint and push messages with the /message/push endpoint in group chats. Messages are displayed to all members of the group or room.

Note: The /message/multicast endpoint cannot be used in groups or rooms.

Getting a user profile of a member of a group or room

If you know the user ID of a member of a group or room, you can get the user's LINE profile by sending a request to /group/{groupId}/member/{userId} or /room/{roomId}/member/{userId}.

Note: You can get the user profiles of users who have not added your bot as a friend or users who have blocked your bot.

Getting user IDs of the members of a group or room

Get the user IDs of the members of a group or a room where your bot has been added with the /group/{groupId}/members/ids and /room/{roomId}/members/ids endpoints. This retrieves user IDs of users who have not added the bot as a friend or has blocked the bot.

Note: This feature is only available for LINE@ Approved accounts or official accounts.

Leaving a group or room

Make your bot leave a group or room by using the /bot/group/{groupId}/leave and /bot/room/{roomId}/leave endpoints.