Skip to content

v2.11.0 Support templated LINE notification messages (PNP) and custom aggregation units

Latest

Choose a tag to compare

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

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

require 'line-bot-api'

client = Line::Bot::V2::MessagingApi::ApiClient.new(
  channel_access_token: ENV.fetch("LINE_CHANNEL_ACCESS_TOKEN")
)

request = Line::Bot::V2::MessagingApi::PnpTemplatedMessageRequest.new(
  # Phone number normalized to E.164 and hashed with SHA256
  to: "0123...hashed_phone_number...cdef",
  template_key: "order_confirmation",
  body: Line::Bot::V2::MessagingApi::PnpTemplatedMessageBody.new(
    emphasized_item: Line::Bot::V2::MessagingApi::PnpTemplatedEmphasizedItem.new(
      item_key: "amount",
      content: "$42.00"
    ),
    items: [
      Line::Bot::V2::MessagingApi::PnpTemplatedItem.new(item_key: "order_id", content: "A1234567"),
      Line::Bot::V2::MessagingApi::PnpTemplatedItem.new(item_key: "shop_name", content: "LINE Store")
    ],
    buttons: [
      Line::Bot::V2::MessagingApi::PnpTemplatedButton.new(
        button_key: "detail",
        url: "https://example.com/orders/A1234567"
      )
    ]
  ),
  custom_aggregation_units: ["promotion_a"]
)

# x_line_delivery_tag (16-100 chars) is returned in the delivery completion webhook
client.push_templated_messages_by_phone(
  pnp_templated_message_request: request,
  x_line_delivery_tag: "order-A1234567-0001"
)

Example: get the number of sent templated notification messages

require 'line-bot-api'

client = Line::Bot::V2::MessagingApi::ApiClient.new(
  channel_access_token: ENV.fetch("LINE_CHANNEL_ACCESS_TOKEN")
)

# GET /v2/bot/message/delivery/pnp/templated (date: yyyyMMdd, UTC+9)
response = client.get_pnp_templated_message_statistics(date: "20240916")

puts response.status   # "ready" / "unready" / "unavailable_for_privacy" / "out_of_service"
puts response.success

What's Changed

line-openapi updates

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

Dependency updates

Full Changelog: v2.10.0...v2.11.0


This release is prepared by @mokuzon