Skip to content

v11.3.0 Support templated LINE notification messages (PNP) and custom aggregation units

Choose a tag to compare

@github-actions github-actions released this 29 Sep 07:28
· 38 commits to master since this release
Immutable release. Only release title and notes can be modified.
3937dcd

This version adds the templated LINE notification message (PNP) API, and lets you assign a custom aggregation unit (CAU) to LINE notification messages.

Schema changes: line/line-openapi#131

What's new

  • Templated PNP
    • Send — send a message built from a template registered in advance, by specifying a templateKey and substituting values into the template's emphasizedItem, items, and buttons. New endpoint: POST /v2/bot/message/pnp/templated/push.
    • Analytics — get the number of sent templated notification messages. New endpoint: GET /v2/bot/message/delivery/pnp/templated.
  • Custom aggregation unit — assign a custom aggregation unit to LINE notification messages (both templated and flexible) via customAggregationUnits, so their delivery can be aggregated per unit with the existing unit-based statistics APIs.

This is a partner-only feature that requires an application. For more details, see:

Example: send a templated LINE notification message

import { messagingApi } from "@line/bot-sdk";

const client = new messagingApi.MessagingApiClient({
  channelAccessToken: process.env.CHANNEL_ACCESS_TOKEN ?? "",
});

const request: messagingApi.PnpTemplatedMessageRequest = {
  // Phone number normalized to E.164 and hashed with SHA256
  to: "0123...hashed_phone_number...cdef",
  templateKey: "order_confirmation",
  body: {
    emphasizedItem: { itemKey: "amount", content: "$42.00" },
    items: [
      { itemKey: "order_id", content: "A1234567" },
      { itemKey: "shop_name", content: "LINE Store" },
    ],
    buttons: [
      { buttonKey: "detail", url: "https://example.com/orders/A1234567" },
    ],
  },
  customAggregationUnits: ["promotion_a"],
};

// The second argument is the X-Line-Delivery-Tag (16-100 chars),
// which is returned in the delivery completion webhook.
await client.pushTemplatedMessagesByPhone(request, "order-A1234567-0001");

Example: get the number of sent templated notification messages

import { messagingApi } from "@line/bot-sdk";

const client = new messagingApi.MessagingApiClient({
  channelAccessToken: process.env.CHANNEL_ACCESS_TOKEN ?? "",
});

// GET /v2/bot/message/delivery/pnp/templated (date: yyyyMMdd, UTC+9)
const response = await client.getPNPTemplatedMessageStatistics("20240916");

console.log(response.status); // "ready" | "unready" | "unavailable_for_privacy" | "out_of_service"
if (response.status === "ready") {
  console.log(response.success);
}

What's Changed

line-openapi updates

  • Update line-openapi digest to de8bd9e by @renovate[bot] in #1755
  • Add Templated LINE notification message API and custom aggregation units for PNP by @github-actions[bot] in #1827

Dependency updates

Other Changes

  • Fix npm audit vulnerability and exclude gitignored paths from npm-audit.sh by @mokuzon in #1752
  • Omit undefined multipart fields by @Yang-33 in #1775
  • Close npm audit reminder automatically by @Yang-33 in #1773
  • Update dependency typescript to v7 by @mokuzon in #1730

Full Changelog: v11.2.0...v11.3.0


This release is prepared by @mokuzon