Repository navigation
Add Templated LINE notification message API and custom aggregation units for PNP - #131
Conversation
…its for PNP Add the Templated LINE notification message (PNP) endpoints and support custom aggregation units (CAU) for LINE notification messages: - Add POST /v2/bot/message/pnp/templated/push to send a notification message built from a pre-registered template. Only to and templateKey are required (body and body.emphasizedItem are optional); success returns 202 Accepted. - Add GET /v2/bot/message/delivery/pnp/templated to get the number of sent templated notification messages. - Add customAggregationUnits to the flexible PNP request and the new templated PNP request so their statistics can be aggregated per unit. Refs: - https://developers.line.biz/en/reference/line-notification-messages/ - https://developers.line.biz/en/docs/partner-docs/line-notification-messages/template/ - https://developers.line.biz/en/docs/messaging-api/unit-based-statistics-aggregation/
1108071 to
9b096bd
Compare
|
|
||
| PnpTemplatedMessageRequest: | ||
| externalDocs: | ||
| url: https://developers.line.biz/en/docs/partner-docs/line-notification-messages/template/ |
There was a problem hiding this comment.
can you consider other externalDocs links to reference page, not guide for api body/response?
| description: "Message destination. Specify a phone number that has been normalized to E.164 format and hashed with SHA256." | ||
| templateKey: | ||
| type: string | ||
| description: "Key of the template to use. The template must be registered in advance and authorized for the bot." |
There was a problem hiding this comment.
https://developers.line.biz/en/reference/line-notification-messages/#send-line-notification-message-template says this, so how about using this?
Specify the Key of the template you want to send.
See Templates for available Key.
and embedding
https://developers.line.biz/en/docs/partner-docs/line-notification-messages/template/#templates help developers?
There was a problem hiding this comment.
The same applies to the other properties as well! hope improving description and externalDocs !
4eac07d to
8447bba
Compare
NODEJSYou can check generated code in nodejs |
PYTHONYou can check generated code in python |
JAVAYou can check generated code in java |
PHPYou can check generated code in php |
GOYou can check generated code in go |
RUBYYou can check generated code in ruby |
Yang-33
left a comment
There was a problem hiding this comment.
I expect the release notes to follow the guide and be user-friendly~
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | Type | Update | |---|---|---|---|---|---| | [github.com/line/line-bot-sdk-go/v8](https://redirect.github.com/line/line-bot-sdk-go) | `v8.22.0` → `v8.23.0` |  |  | require | minor | | [golang](https://hub.docker.com/_/golang) ([source](https://redirect.github.com/docker-library/golang)) | `1.26.0-alpine` → `1.27.1-alpine` |  |  | stage | minor | --- ### Release Notes <details> <summary>line/line-bot-sdk-go (github.com/line/line-bot-sdk-go/v8)</summary> ### [`v8.23.0`](https://redirect.github.com/line/line-bot-sdk-go/releases/tag/v8.23.0): Support templated LINE notification messages (PNP) and custom aggregation units [Compare Source](https://redirect.github.com/line/line-bot-sdk-go/compare/v8.22.0...v8.23.0) 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](https://redirect.github.com/line/line-openapi/pull/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: - 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 ```go package main import ( "log" "github.com/line/line-bot-sdk-go/v8/linebot/messaging_api" ) func main() { client, err := messaging_api.NewMessagingApiAPI("YOUR_CHANNEL_ACCESS_TOKEN") if err != nil { log.Fatal(err) } _, err = client.PushTemplatedMessagesByPhone( &messaging_api.PnpTemplatedMessageRequest{ // SHA256 hash of the E.164-normalized destination phone number. To: "0123...hashed_phone_number...cdef", TemplateKey: "order_confirmation", Body: &messaging_api.PnpTemplatedMessageBody{ EmphasizedItem: &messaging_api.PnpTemplatedEmphasizedItem{ ItemKey: "amount", Content: "$42.00", }, Items: []messaging_api.PnpTemplatedItem{ {ItemKey: "order_id", Content: "A1234567"}, {ItemKey: "shop_name", Content: "LINE Store"}, }, Buttons: []messaging_api.PnpTemplatedButton{ {ButtonKey: "detail", Url: "https://example.com/orders/A1234567"}, }, }, CustomAggregationUnits: []string{"promotion_a"}, }, // xLineDeliveryTag (16-100 chars) is returned in the delivery completion webhook "order-A1234567-0001", ) if err != nil { log.Fatal(err) } } ``` ##### Example: get the number of sent templated notification messages ```go package main import ( "fmt" "log" "github.com/line/line-bot-sdk-go/v8/linebot/messaging_api" ) func main() { client, err := messaging_api.NewMessagingApiAPI("YOUR_CHANNEL_ACCESS_TOKEN") if err != nil { log.Fatal(err) } // GET /v2/bot/message/delivery/pnp/templated (date: yyyyMMdd, UTC+9) resp, err := client.GetPNPTemplatedMessageStatistics("20240916") if err != nil { log.Fatal(err) } fmt.Printf("status: %s\n", resp.Status) if resp.Status == messaging_api.NumberOfMessagesResponseSTATUS_READY { fmt.Printf("success: %d\n", resp.Success) } } ``` <!-- Release notes generated using configuration in .github/release.yml at master --> #### What's Changed ##### line-openapi updates - Fix access\_token description in revokeChannelToken by [@​github-actions](https://redirect.github.com/github-actions)\[bot] in [#​723](https://redirect.github.com/line/line-bot-sdk-go/pull/723) - Add Templated LINE notification message API and custom aggregation units for PNP by [@​github-actions](https://redirect.github.com/github-actions)\[bot] in [#​733](https://redirect.github.com/line/line-bot-sdk-go/pull/733) ##### Dependency updates - chore(deps): update actions/stale action to v10.4.0 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​712](https://redirect.github.com/line/line-bot-sdk-go/pull/712) - chore(deps): update junit-framework monorepo to v6.1.2 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​713](https://redirect.github.com/line/line-bot-sdk-go/pull/713) - chore(deps): update actions/setup-node action to v6.5.0 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​714](https://redirect.github.com/line/line-bot-sdk-go/pull/714) - chore(deps): update actions/setup-node action to v7 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​715](https://redirect.github.com/line/line-bot-sdk-go/pull/715) - chore(deps): update actions/setup-go action to v7 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​716](https://redirect.github.com/line/line-bot-sdk-go/pull/716) - chore(deps): update dependency org.apache.maven.plugins:maven-jar-plugin to v3.5.1 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​717](https://redirect.github.com/line/line-bot-sdk-go/pull/717) - chore(deps): update actions/setup-python action to v7 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​718](https://redirect.github.com/line/line-bot-sdk-go/pull/718) - fix(deps): update dependency org.openapitools:openapi-generator to v7.24.0 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​719](https://redirect.github.com/line/line-bot-sdk-go/pull/719) - chore(deps): update actions/checkout action to v7.0.1 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​720](https://redirect.github.com/line/line-bot-sdk-go/pull/720) - chore(deps): update actions/stale action to v11 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​722](https://redirect.github.com/line/line-bot-sdk-go/pull/722) - chore(deps): update junit-framework monorepo to v6.1.3 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​725](https://redirect.github.com/line/line-bot-sdk-go/pull/725) - chore(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.16.0 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​730](https://redirect.github.com/line/line-bot-sdk-go/pull/730) - fix(deps): update dependency org.openapitools:openapi-generator to v7.25.0 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​729](https://redirect.github.com/line/line-bot-sdk-go/pull/729) - chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.6.0 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​731](https://redirect.github.com/line/line-bot-sdk-go/pull/731) - chore(deps): update dependency org.codehaus.mojo:build-helper-maven-plugin to v3.6.2 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​732](https://redirect.github.com/line/line-bot-sdk-go/pull/732) ##### Other Changes - Prevent path traversal by [@​Yang-33](https://redirect.github.com/Yang-33) in [#​724](https://redirect.github.com/line/line-bot-sdk-go/pull/724) - Drop go 1.25 by [@​Yang-33](https://redirect.github.com/Yang-33) in [#​728](https://redirect.github.com/line/line-bot-sdk-go/pull/728) **Full Changelog**: <line/line-bot-sdk-go@v8.22.0...v8.23.0> *** This release is prepared by [@​mokuzon](https://redirect.github.com/mokuzon) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/takumi3488/dead-or-line). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMjUuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjEyNS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This adds the Templated LINE notification message (PNP) API and enables custom aggregation units (CAU) for LINE notification messages.
Changes
Templated LINE notification message (PNP)
POST /v2/bot/message/pnp/templated/pushto send a notification message built from a pre-registered template (templateKey+bodywithemphasizedItem/items/buttons).GET /v2/bot/message/delivery/pnp/templatedto get the number of sent templated notification messages (reusesNumberOfMessagesResponse).PnpTemplatedMessageRequest,PnpTemplatedMessageBody,PnpTemplatedEmphasizedItem,PnpTemplatedItem,PnpTemplatedButton.Custom aggregation units (CAU) for PNP
customAggregationUnitsto the flexible PNP request (PnpMessagesRequest) and to the new templated PNP request, so their delivery can be aggregated per unit via the existing unit-based statistics APIs.References