LINE Module API

Four operations for the module feature, which lets a partner-operated module channel take and release chat control on behalf of a LINE Official Account — detach a module, acquire chat initiative, release it, and list the bots a module is attached to.

OpenAPI Specification

line-module-openapi.yml Raw ↑
---
openapi: 3.0.0
info:
  title: LINE Messaging API
  version: "0.0.1"
  description:
    This document describes LINE Messaging API.

servers:
  - url: "https://api.line.me"

security:
  - Bearer: []

tags:
  - name: line-module

paths:
  "/v2/bot/channel/detach":
    post:
      externalDocs:
        url: https://developers.line.biz/en/reference/partner-docs/#unlink-detach-module-channel-by-operation-mc-admin
      tags:
        - line-module
      operationId: detachModule
      description: "The module channel admin calls the Detach API to detach the module channel from a LINE Official Account."
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/DetachModuleRequest"
      responses:
        "200":
          description: "OK"

  "/v2/bot/chat/{chatId}/control/acquire":
    post:
      externalDocs:
        url: https://developers.line.biz/en/reference/partner-docs/#acquire-control-api
      tags:
        - line-module
      operationId: acquireChatControl
      description: |+
        If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API.
        The channel that was previously an Active Channel will automatically switch to a Standby Channel.
      parameters:
        - name: chatId
          in: path
          required: true
          description: "The `userId`, `roomId`, or `groupId`"
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/AcquireChatControlRequest"
      responses:
        "200":
          description: "OK"

  "/v2/bot/chat/{chatId}/control/release":
    post:
      externalDocs:
        url: https://developers.line.biz/en/reference/partner-docs/#release-control-api
      tags:
        - line-module
      operationId: releaseChatControl
      description: |+
        To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API.
      parameters:
        - name: chatId
          in: path
          required: true
          description: "The `userId`, `roomId`, or `groupId`"
          schema:
            type: string
      responses:
        "200":
          description: "OK"

  "/v2/bot/list":
    get:
      externalDocs:
        url: https://developers.line.biz/en/reference/partner-docs/#get-multiple-bot-info-api
      tags:
        - line-module
      operationId: getModules
      description: "Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels."
      parameters:
        - name: start
          in: query
          required: false
          description: |+
            Value of the continuation token found in the next property of the JSON object returned in the response.
            If you can't get all basic information about the bots in one request, include this parameter to get the remaining array.
          schema:
            type: string
        - name: limit
          in: query
          required: false
          description: |+
            Specify the maximum number of bots that you get basic information from. The default value is 100.
            Max value: 100
          schema:
            type: integer
            format: int32
            default: 100
            maximum: 100
      responses:
        "200":
          description: "OK"
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/GetModulesResponse"
              example:
                bots:
                  - userId: Uf2dd6e8b081d2ff9c05c98a8a8b269c9
                    basicId: "@628..."
                    displayName: Test01
                    pictureUrl: https://profile.line-scdn.net/0hyxytJNAlJldEDQzlatVZAHhIKDoz...
                  - userId: Ua831d37bfe8232808202b85127663f70
                    basicId: "@076lu..."
                    displayName: Test02
                    pictureUrl: https://profile.line-scdn.net/0hohnizdyzMEdTECbnVo9PEG9VPiok...
                  - userId: Ub77ea431fba86f7c159a0c0f5be43d9f
                    basicId: "@290n..."
                    displayName: Test03
                  - userId: Ub8ec80a14e879e9c6833fb4cee0e632b
                    basicId: "@793j..."
                    displayName: Test04


components:
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      description: "Channel access token"

  schemas:
    DetachModuleRequest:
      externalDocs:
        url: https://developers.line.biz/en/reference/partner-docs/#unlink-detach-module-channel-by-operation-mc-admin
      type: object
      description: "Unlink (detach) the module channel by the operation of the module channel administrator"
      properties:
        botId:
          description: "User ID of the LINE Official Account bot attached to the module channel."
          type: string
    AcquireChatControlRequest:
      externalDocs:
        url: https://developers.line.biz/en/reference/partner-docs/#acquire-control-api
      description: "Request entity of the Acquire Control API"
      type: object
      properties:
        expired:
          type: boolean
          description: |+
            `True`: After the time limit (ttl) has passed, the initiative (Chat Control) will return to the Primary Channel. (Default)
            `False`: There's no time limit and the initiative (Chat Control) doesn't change over time.
          example: true
        ttl:
          type: integer
          format: int32
          # one year = 3600*24*365
          maximum: 31536000
          description: |+
            The time it takes for initiative (Chat Control) to return to the Primary Channel (the time that the module channel stays on the Active Channel).
            The value is specified in seconds. The maximum value is one year (3600 * 24 * 365).
            The default value is 3600 (1 hour).

            * Ignored if the value of expired is false.
          example: 3600
    GetModulesResponse:
      externalDocs:
        url: https://developers.line.biz/en/reference/partner-docs/#get-multiple-bot-info-api
      description: "List of bots to which the module is attached"
      required:
        - bots
      type: object
      properties:
        bots:
          type: array
          items:
            "$ref": "#/components/schemas/ModuleBot"
          description: "Array of Bot list Item objects representing basic information about the bot."
        next:
          type: string
          description: |+
            Continuation token.
            Used to get the next array of basic bot information.
            This property is only returned if there are more unreturned results.
    ModuleBot:
      externalDocs:
        url: https://developers.line.biz/en/reference/partner-docs/#get-multiple-bot-info-api
      description: "basic information about the bot."
      required:
        - userId
        - basicId
        - displayName
      type: object
      properties:
        userId:
          type: string
          description: "Bot's user ID"
        basicId:
          type: string
          description: "Bot's basic ID"
        premiumId:
          type: string
          description: "Bot's premium ID. Not included in the response if the premium ID isn't set."
        displayName:
          type: string
          description: "Bot's display name"
        pictureUrl:
          type: string
          description: "Profile image URL. Image URL starting with `https://`. Not included in the response if the bot doesn't have a profile image."