{"id":18549,"library":"messaging-api-line","title":"messaging-api-line","description":"A Node.js client library for the LINE Messaging API, version 1.1.0. Maintained as part of the Yoctol messaging-apis monorepo, it provides a comprehensive, TypeScript-first wrapper for LINE's REST endpoints including reply, push, multicast, broadcast, and rich menu APIs. The library uses axios for HTTP and wraps errors for better debugging. Key differentiators: full TypeScript types, camelCase key support (v1.0.0+), factory methods for message creation, and support for Flex and Imagemap messages. Release cadence is sporadic with the last release in October 2021.","status":"active","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/Yoctol/messaging-apis","tags":["javascript","bot","chatbot","line","messaging-apis","typescript"],"install":[{"cmd":"npm install messaging-api-line","lang":"bash","label":"npm"},{"cmd":"yarn add messaging-api-line","lang":"bash","label":"yarn"},{"cmd":"pnpm add messaging-api-line","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"HTTP client for all API requests","package":"axios","optional":false}],"imports":[{"note":"Named export only; no default export. CommonJS: const { LineClient } = require('messaging-api-line')","wrong":"import LineClient from 'messaging-api-line'","symbol":"LineClient","correct":"import { LineClient } from 'messaging-api-line'"},{"note":"Namespace object with factory methods (createText, etc.). Not a class. ESM only.","wrong":"import Line from 'messaging-api-line'","symbol":"Line","correct":"import { Line } from 'messaging-api-line'"},{"note":"TypeScript type for client config. Also importable as type: import type { LineClientConfig } from 'messaging-api-line'","symbol":"LineClientConfig","correct":"import { LineClientConfig } from 'messaging-api-line'"}],"quickstart":{"code":"import { LineClient } from 'messaging-api-line';\n\nconst client = new LineClient({\n  accessToken: process.env.LINE_ACCESS_TOKEN ?? '',\n  channelSecret: process.env.LINE_CHANNEL_SECRET ?? '',\n});\n\n// Reply to a webhook event\nawait client.reply(REPLY_TOKEN, [\n  {\n    type: 'text',\n    text: 'Hello from messaging-api-line!',\n  },\n]);\n\n// Push a message to a user\nawait client.push(USER_ID, [\n  {\n    type: 'text',\n    text: 'This is a push message.',\n  },\n]);\n\n// Broadcast to all friends\nawait client.broadcast([\n  {\n    type: 'text',\n    text: 'Broadcast message',\n  },\n]);\n\n// Get bot info\nconst botInfo = await client.getBotInfo();\nconsole.log(botInfo);","lang":"typescript","description":"Initializes LineClient with credentials, then demonstrates reply, push, broadcast, and getBotInfo APIs."},"warnings":[{"fix":"Update all API parameters and message objects to use camelCase keys (e.g., replyToken → replyToken, originalContentUrl → originalContentUrl).","message":"v1.0.0 switched from snake_case to camelCase keys. Old code using snake_case will break.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Change imports from 'messaging-api-line/dist/LineClient' to 'messaging-api-line'.","message":"v1.0.0 removed namespace exports. Use 'messaging-api-line' directly instead of 'messaging-api-line/dist/...'.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Track used tokens and only reply once per webhook event.","message":"The replyToken can only be used once. Attempting to reply twice with the same token will result in an error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always use camelCase keys for message fields to ensure compatibility with future versions.","message":"Older versions used snake_case for message types (e.g., 'imagemapMessage'). Version 1.1.0 prefers camelCase for fields but still accepts snake_case for compatibility? Not explicitly deprecated but caution advised.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Provide a valid replyToken from the webhook event (e.g., req.body.events[0].replyToken). Ensure environment variable is set.","cause":"Calling client.reply() without a reply token or with an undefined/null token.","error":"Error: replyToken is required"},{"fix":"Verify LINE_ACCESS_TOKEN and LINE_CHANNEL_SECRET are set and passed correctly.","cause":"Missing or invalid accessToken/channelSecret in client constructor.","error":"TypeError: Cannot read properties of undefined (reading 'config')"},{"fix":"Regenerate access token from LINE Developers console and update your code.","cause":"Invalid or expired access token.","error":"Error: Request failed with status code 401"},{"fix":"Upgrade to messaging-api-line@1.1.0 or later. npm install messaging-api-line@latest","cause":"Using an older version (<1.1.0) that does not support broadcast API.","error":"TypeError: client.broadcast is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}