v3.26.0 Support templated LINE notification messages (PNP) and custom aggregation units
Latest
Immutable
release. Only release title and notes can be modified.
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
templateKeyand substituting values into the template'semphasizedItem,items, andbuttons. 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.
- Send — send a message built from a template registered in advance, by specifying a
- 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:
- Templated LINE notification message: https://developers.line.biz/en/docs/partner-docs/line-notification-messages/template/
- LINE notification messages API reference: https://developers.line.biz/en/reference/line-notification-messages/
- Custom aggregation units: https://developers.line.biz/en/docs/messaging-api/unit-based-statistics-aggregation/
Example: send a templated LINE notification message
from linebot.v3.messaging import (
Configuration,
ApiClient,
MessagingApi,
PnpTemplatedMessageRequest,
PnpTemplatedMessageBody,
PnpTemplatedEmphasizedItem,
PnpTemplatedItem,
PnpTemplatedButton,
)
configuration = Configuration(access_token="YOUR_CHANNEL_ACCESS_TOKEN")
with ApiClient(configuration) as api_client:
line_bot_api = MessagingApi(api_client)
request = PnpTemplatedMessageRequest(
# Phone number normalized to E.164 and hashed with SHA256
to="0123...hashed_phone_number...cdef",
template_key="order_confirmation",
body=PnpTemplatedMessageBody(
emphasized_item=PnpTemplatedEmphasizedItem(item_key="amount", content="$42.00"),
items=[
PnpTemplatedItem(item_key="order_id", content="A1234567"),
PnpTemplatedItem(item_key="shop_name", content="LINE Store"),
],
buttons=[
PnpTemplatedButton(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
line_bot_api.push_templated_messages_by_phone(
request, x_line_delivery_tag="order-A1234567-0001"
)Example: get the number of sent templated notification messages
from linebot.v3.messaging import Configuration, ApiClient, MessagingApi
configuration = Configuration(access_token="YOUR_CHANNEL_ACCESS_TOKEN")
with ApiClient(configuration) as api_client:
line_bot_api = MessagingApi(api_client)
# GET /v2/bot/message/delivery/pnp/templated (date: yyyyMMdd, UTC+9)
response = line_bot_api.get_pnp_templated_message_statistics("20240916")
print(response.status) # "ready" / "unready" / "unavailable_for_privacy" / "out_of_service"
if response.status == "ready":
print(response.success)What's Changed
line-openapi updates
- Fix access_token description in revokeChannelToken by @github-actions[bot] in #1050
Dependency updates
- chore(deps): update dependency responses to v0.26.2 by @renovate[bot] in #1032
- chore(deps): update dependency tox to v4.56.2 by @renovate[bot] in #1026
- chore(deps): update dependency tox to v4.56.3 by @renovate[bot] in #1034
- chore(deps): update dependency tox to v4.56.4 by @renovate[bot] in #1035
- chore(deps): update actions/stale action to v10.4.0 by @renovate[bot] in #1036
- chore(deps): update junit-framework monorepo to v6.1.2 by @renovate[bot] in #1037
- chore(deps): update actions/setup-node action to v6.5.0 by @renovate[bot] in #1038
- chore(deps): update actions/setup-node action to v7 by @renovate[bot] in #1039
- chore(deps): update dependency tox to v4.57.0 by @renovate[bot] in #1041
- chore(deps): update dependency org.apache.maven.plugins:maven-jar-plugin to v3.5.1 by @renovate[bot] in #1042
- chore(deps): update pypa/gh-action-pypi-publish action to v1.14.1 by @renovate[bot] in #1043
- chore(deps): update actions/setup-python action to v7 by @renovate[bot] in #1045
- fix(deps): update openapi-generator-version to v7.24.0 by @renovate[bot] in #1046
- chore(deps): update actions/checkout action to v7.0.1 by @renovate[bot] in #1047
- chore(deps): update dependency tox to v4.57.1 by @renovate[bot] in #1048
- chore(deps): update dependency tox to v4.57.2 by @renovate[bot] in #1049
- chore(deps): update dependency tox to v4.58.0 by @renovate[bot] in #1051
- chore(deps): update actions/stale action to v11 by @renovate[bot] in #1053
- chore(deps): update dependency twine to v7 by @renovate[bot] in #1052
- chore(deps): update pypa/gh-action-pypi-publish action to v1.14.2 by @renovate[bot] in #1054
- chore(deps): update junit-framework monorepo to v6.1.3 by @renovate[bot] in #1055
- chore(deps): update dependency tox to v4.59.0 by @renovate[bot] in #1056
- chore(deps): update dependency wheel to v0.48.0 by @renovate[bot] in #1057
- chore(deps): update dependency tox to v4.60.0 by @renovate[bot] in #1058
- fix(deps): update openapi-generator-version to v7.25.0 by @renovate[bot] in #1059
- chore(deps): update dependency tox to v4.60.1 by @renovate[bot] in #1060
- chore(deps): update dependency responses to v0.26.3 by @renovate[bot] in #1061
- chore(deps): update dependency tox to v4.61.1 by @renovate[bot] in #1063
- chore(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.16.0 by @renovate[bot] in #1064
- chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.6.0 by @renovate[bot] in #1065
- chore(deps): update dependency tox to v4.61.2 by @renovate[bot] in #1066
- chore(deps): update dependency tox to v4.61.3 by @renovate[bot] in #1067
- chore(deps): update dependency tox to v4.61.4 by @renovate[bot] in #1068
- chore(deps): update dependency org.codehaus.mojo:build-helper-maven-plugin to v3.6.2 by @renovate[bot] in #1069
- chore(deps): update dependency tox to v4.63.0 by @renovate[bot] in #1071
Other Changes
Full Changelog: v3.25.0...v3.26.0
This release is prepared by @mokuzon