broadcast_flex_message
Send customizable flex messages to all LINE Official Account followers using bubble or carousel layouts for rich, interactive content delivery.
Instructions
Broadcast a highly customizable flex message via LINE to all users who have added your LINE Official Account. Supports both bubble (single container) and carousel (multiple swipeable bubbles) layouts. Please be aware that this message will be sent to all users.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes |
Implementation Reference
- src/tools/broadcastFlexMessage.ts:27-38 (handler)The core handler function that broadcasts the provided flex message to all users using the LINE Messaging API client, handling success and error responses.async ({ message }) => { try { const response = await this.client.broadcast({ messages: [message as unknown as messagingApi.Message], }); return createSuccessResponse(response); } catch (error) { return createErrorResponse( `Failed to broadcast message: ${error.message}`, ); } },
- Zod schema defining the structure of the input flex message, including type, altText, and contents with bubble or carousel support.export const flexMessageSchema = z.object({ type: z.literal("flex").default("flex"), altText: z .string() .describe("Alternative text shown when flex message cannot be displayed."), contents: z .object({ type: z .enum(["bubble", "carousel"]) .describe( "Type of the container. 'bubble' for single container, 'carousel' for multiple swipeable bubbles.", ), }) .passthrough() .describe( "Flexible container structure following LINE Flex Message format. For 'bubble' type, can include header, " + "hero, body, footer, and styles sections. For 'carousel' type, includes an array of bubble containers in " + "the 'contents' property.", ), });
- src/tools/broadcastFlexMessage.ts:19-39 (registration)Registers the 'broadcast_flex_message' tool on the MCP server with name, description, input schema, and handler function.server.tool( "broadcast_flex_message", "Broadcast a highly customizable flex message via LINE to all users who have added your LINE Official Account. " + "Supports both bubble (single container) and carousel (multiple swipeable bubbles) layouts. Please be aware that " + "this message will be sent to all users.", { message: flexMessageSchema, }, async ({ message }) => { try { const response = await this.client.broadcast({ messages: [message as unknown as messagingApi.Message], }); return createSuccessResponse(response); } catch (error) { return createErrorResponse( `Failed to broadcast message: ${error.message}`, ); } }, );
- src/index.ts:64-64 (registration)Instantiates and registers the BroadcastFlexMessage tool instance with the MCP server in the main entry point.new BroadcastFlexMessage(messagingApiClient).register(server);