Skip to content

v12.8.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
Immutable release. Only release title and notes can be modified.
b75cb5b

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

use LINE\Clients\MessagingApi\Api\MessagingApiApi;
use LINE\Clients\MessagingApi\Configuration;
use LINE\Clients\MessagingApi\Model\PnpTemplatedMessageRequest;
use LINE\Clients\MessagingApi\Model\PnpTemplatedMessageBody;
use LINE\Clients\MessagingApi\Model\PnpTemplatedEmphasizedItem;
use LINE\Clients\MessagingApi\Model\PnpTemplatedItem;
use LINE\Clients\MessagingApi\Model\PnpTemplatedButton;

$config = new Configuration();
$config->setAccessToken('YOUR_CHANNEL_ACCESS_TOKEN');
$messagingApi = new MessagingApiApi(client: new \GuzzleHttp\Client(), config: $config);

$request = new PnpTemplatedMessageRequest([
    // Phone number normalized to E.164 and hashed with SHA256
    'to' => '0123...hashed_phone_number...cdef',
    'templateKey' => 'order_confirmation',
    'body' => new PnpTemplatedMessageBody([
        'emphasizedItem' => new PnpTemplatedEmphasizedItem(['itemKey' => 'amount', 'content' => '$42.00']),
        'items' => [
            new PnpTemplatedItem(['itemKey' => 'order_id', 'content' => 'A1234567']),
            new PnpTemplatedItem(['itemKey' => 'shop_name', 'content' => 'LINE Store']),
        ],
        'buttons' => [
            new PnpTemplatedButton(['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.
$messagingApi->pushTemplatedMessagesByPhone($request, 'order-A1234567-0001');

Example: get the number of sent templated notification messages

use LINE\Clients\MessagingApi\Api\MessagingApiApi;
use LINE\Clients\MessagingApi\Configuration;

$config = new Configuration();
$config->setAccessToken('YOUR_CHANNEL_ACCESS_TOKEN');
$messagingApi = new MessagingApiApi(client: new \GuzzleHttp\Client(), config: $config);

// GET /v2/bot/message/delivery/pnp/templated (date: yyyyMMdd, UTC+9)
$response = $messagingApi->getPNPTemplatedMessageStatistics('20240916');

echo $response->getStatus() . PHP_EOL;   // ready / unready / unavailable_for_privacy / out_of_service
if ($response->getStatus() === 'ready') {
    echo $response->getSuccess() . PHP_EOL;
}

What's Changed

line-openapi updates

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

Dependency updates

  • Update actions/setup-java action to v5.5.0 by @renovate[bot] in #866
  • Update actions/stale action to v10.4.0 by @renovate[bot] in #867
  • Update junit-framework monorepo to v6.1.2 by @renovate[bot] in #868
  • Update actions/setup-node action to v7 by @renovate[bot] in #870
  • Update actions/setup-java action to v5.6.0 by @renovate[bot] in #871
  • Update dependency org.apache.maven.plugins:maven-jar-plugin to v3.5.1 by @renovate[bot] in #872
  • Update openapi-generator-version to v7.24.0 by @renovate[bot] in #873
  • Update actions/checkout action to v7.0.1 by @renovate[bot] in #875
  • Update dependency guzzlehttp/psr7 to v3 by @renovate[bot] in #878
  • Update actions/stale action to v11 by @renovate[bot] in #882
  • Update dependency squizlabs/php_codesniffer to v4.0.2 [SECURITY] by @renovate[bot] in #884
  • Update actions/setup-java action to v5.7.0 by @renovate[bot] in #883
  • Update dependency squizlabs/php_codesniffer to v4.0.4 by @renovate[bot] in #885
  • Update junit-framework monorepo to v6.1.3 by @renovate[bot] in #886
  • Update openapi-generator-version to v7.25.0 by @renovate[bot] in #887
  • Update actions/setup-java action to v6 by @renovate[bot] in #888
  • Update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.16.0 by @renovate[bot] in #889
  • Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.6.0 by @renovate[bot] in #890
  • Update actions/deploy-pages action to v5.0.1 by @renovate[bot] in #891
  • Update actions/setup-java action to v6.0.1 by @renovate[bot] in #892
  • Update dependency org.codehaus.mojo:build-helper-maven-plugin to v3.6.2 by @renovate[bot] in #893

Full Changelog: v12.7.0...v12.8.0


This release is prepared by @mokuzon