docs/platform/integrations/chat/line.mdx
The LINE chat integration lets you send messages to subscribers who have added your LINE Official Account as a friend. Novu uses the LINE Messaging API push endpoint with a Channel Access Token configured on the integration, and a LINE user ID stored on each subscriber's channel endpoint.
Supported message types:
Before connecting LINE in Novu, create a Messaging API channel in the LINE Developers Console and issue a Channel Access Token.
<Steps> <Step title="Open the LINE Developers Console"> Go to the [LINE Developers Console](https://developers.line.biz/console/) and sign in. </Step> <Step title="Create a provider and channel"> Create a provider (if you do not have one), then create a **Messaging API** channel for your LINE Official Account. </Step> <Step title="Issue a Channel Access Token"> Open your channel, go to the **Messaging API** tab, and issue a **Channel access token** (long-lived). Copy the token - you will paste it into Novu. </Step> <Step title="Enable webhooks (recommended)"> On the same tab, enable **Use webhook** if you plan to capture subscriber LINE user IDs from follow or message events. Set the webhook URL to your backend endpoint that creates `line_user` channel endpoints in Novu.See LINE's docs on [getting user IDs](https://developers.line.biz/en/docs/messaging-api/getting-user-ids/) for details.
Each subscriber needs a LINE user ID (for example, U1234567890abcdef) so Novu knows where to deliver messages. Create a line_user channel endpoint for the subscriber using the channel endpoints API.
const novu = new Novu({ secretKey: '<NOVU_SECRET_KEY>', // Required if using EU region // serverURL: 'https://eu.api.novu.co', });
await novu.channelEndpoints.create({ subscriberId: 'subscriberId', integrationIdentifier: 'line-<integration-id>', type: 'line_user', endpoint: { userId: '<LINE_USER_ID>', }, });
</Tab>
<Tab title="cURL">
```bash
curl -L -X POST 'https://api.novu.co/v1/channel-endpoints' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: ApiKey <NOVU_SECRET_KEY>' \
-d '{
"subscriberId": "<SUBSCRIBER_ID>",
"integrationIdentifier": "line-<integration-id>",
"type": "line_user",
"endpoint": {
"userId": "<LINE_USER_ID>"
}
}'
See the Create a channel endpoint API reference for full request details.
<Note> Push messages can only be delivered to users who have added your LINE Official Account as a friend. Capture the LINE user ID from follow or message webhook events, then register it as a `line_user` channel endpoint. </Note>Create a workflow with a Chat step, add your message content, and trigger the workflow for a subscriber that has a line_user channel endpoint configured.
import { Novu } from '@novu/api';
const novu = new Novu({
secretKey: '<NOVU_SECRET_KEY>',
});
await novu.trigger({
workflowId: 'order-shipped',
to: {
subscriberId: 'subscriberId',
},
payload: {
orderId: 'ORD-12345',
},
});
The chat step content is sent as a plain text LINE message unless you override the message type at trigger time.
Pass flex, image, or sticker under overrides.chat when triggering a workflow. When present, Novu sends that message type instead of plain text.