Skip to main content
Glama
acquo

LINE Bot MCP Server (SSE Support)

by acquo

push_flex_message

Send customizable flex messages via LINE with bubble or carousel layouts to deliver rich, interactive content to users.

Instructions

Push a highly customizable flex message to a user via LINE. Supports both bubble (single container) and carousel (multiple swipeable bubbles) layouts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdNoThe user ID to receive a message. Defaults to DESTINATION_USER_ID.
messageYes

Implementation Reference

  • The handler implementation for the "push_flex_message" tool, which uses the LINE MessagingApiClient to send a Flex message.
    server.tool(
      "push_flex_message",
      "Push a highly customizable flex message to a user via LINE. Supports both bubble (single container) and carousel " +
        "(multiple swipeable bubbles) layouts.",
      {
        userId: userIdSchema,
        message: flexMessageSchema,
      },
      async ({ userId, message }) => {
        if (!userId) {
          return createErrorResponse(NO_USER_ID_ERROR);
        }
    
        try {
          const response = await this.client.pushMessage({
            to: userId,
            messages: [message as unknown as messagingApi.Message],
          });
          return createSuccessResponse(response);
        } catch (error) {
          return createErrorResponse(
            `Failed to push flex message: ${error.message}`,
          );
        }
      },
    );
  • Registration logic for the "push_flex_message" tool within the MCP server.
    register(server: McpServer) {
      const userIdSchema = z
        .string()
        .default(this.destinationId)
        .describe(
          "The user ID to receive a message. Defaults to DESTINATION_USER_ID.",
        );
    
      server.tool(
        "push_flex_message",
        "Push a highly customizable flex message to a user via LINE. Supports both bubble (single container) and carousel " +
          "(multiple swipeable bubbles) layouts.",
        {
          userId: userIdSchema,
          message: flexMessageSchema,
        },
        async ({ userId, message }) => {
          if (!userId) {
            return createErrorResponse(NO_USER_ID_ERROR);
          }
    
          try {
            const response = await this.client.pushMessage({
              to: userId,
              messages: [message as unknown as messagingApi.Message],
            });
            return createSuccessResponse(response);
          } catch (error) {
            return createErrorResponse(
              `Failed to push flex message: ${error.message}`,
            );
          }
        },
      );
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/acquo/line-bot-mcp-server-sse'

If you have feedback or need assistance with the MCP directory API, please join our Discord server