Skip to content

Support new Membership API and Webhook #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions messaging-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,69 @@ paths:
schema:
"$ref": "#/components/schemas/ErrorResponse"

"/v2/bot/membership/{membershipId}/users/ids":
get:
externalDocs:
url: https://developers.line.biz/en/reference/messaging-api/#get-membership-user-ids
tags:
- messaging-api
operationId: getJoinedMembershipUsers
description: "Get a list of user IDs who joined the membership."
parameters:
- name: start
in: query
required: false
description: |+
A continuation token to get next remaining membership user IDs.
Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request.
The continuation token expires in 24 hours (86,400 seconds).
schema:
type: string
- name: limit
in: query
required: false
description: |+
The max number of items to return for this API call.
The value is set to 300 by default, but the max acceptable value is 1000.
schema:
type: integer
format: int32
default: 300
maximum: 1000
minimum: 1
- name: membershipId
in: path
required: true
schema:
type: integer
description: "Membership plan ID."
responses:
"200":
description: "OK"
content:
application/json:
schema:
"$ref": "#/components/schemas/GetJoinedMembershipUsersResponse"
example:
userIds:
- U4af4980629...
- U0c229f96c4...
- U95afb1d4df...
next: jxEWCEEP...

"400":
description: "`start` is incorrect or expired, or `limit` is under 1 or over 1000."
content:
application/json:
schema:
"$ref": "#/components/schemas/ErrorResponse"
"404":
description: "Membership ID is not owned by the bot or does not exist."
content:
application/json:
schema:
"$ref": "#/components/schemas/ErrorResponse"

"/v2/bot/chat/loading/start":
post:
externalDocs:
Expand Down Expand Up @@ -4836,6 +4899,30 @@ components:
items:
"$ref": "#/components/schemas/Membership"

GetJoinedMembershipUsersResponse:
externalDocs:
url: https://developers.line.biz/en/reference/messaging-api/#get-membership-user-ids
description: "List of users who have joined the membership"
required:
- userIds
type: object
properties:
userIds:
type: array
maxItems: 1000
description: |+
A list of user IDs who joined the membership.
Users who have not agreed to the bot user agreement, are not following the bot, or are not active will be excluded.
If there are no users in the membership, an empty list will be returned.
items:
type: string
next:
type: string
description: |+
A continuation token to get next remaining membership user IDs.
Returned only when there are remaining user IDs that weren't returned in the userIds property in the previous request.
The continuation token expires in 24 hours (86,400 seconds).

Subscription:
description: "An array of memberships."
required:
Expand Down
62 changes: 62 additions & 0 deletions webhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ components:
beacon: "#/components/schemas/BeaconEvent"
accountLink: "#/components/schemas/AccountLinkEvent"
things: "#/components/schemas/ThingsEvent"
membership: "#/components/schemas/MembershipEvent"
module: "#/components/schemas/ModuleEvent"
activated: "#/components/schemas/ActivatedEvent"
deactivated: "#/components/schemas/DeactivatedEvent"
Expand Down Expand Up @@ -860,6 +861,67 @@ components:
description: "Base64-encoded binary data"
type: string

# https://developers.line.biz/en/reference/messaging-api/#membership-event
MembershipEvent:
description: "This event indicates that a user has subscribed (joined), unsubscribed (left), or renewed the bot's membership."
allOf:
- $ref: "#/components/schemas/Event"
- type: object
required:
- replyToken
- membership
properties:
replyToken:
type: string
description: "Reply token used to send reply message to this event"
membership:
$ref: "#/components/schemas/MembershipContent"
MembershipContent:
description: "Content of the membership event."
required:
- type
- membershipId
type: object
properties:
type:
type: string
description: "Type of membership event."
discriminator:
propertyName: type
mapping:
joined: "#/components/schemas/JoinedMembershipContent"
left: "#/components/schemas/LeftMembershipContent"
renewed: "#/components/schemas/RenewedMembershipContent"
JoinedMembershipContent:
allOf:
- $ref: "#/components/schemas/MembershipContent"
- type: object
required:
- membershipId
properties:
membershipId:
type: integer
description: "The ID of the membership that the user joined. This is defined for each membership."
LeftMembershipContent:
allOf:
- $ref: "#/components/schemas/MembershipContent"
- type: object
required:
- membershipId
properties:
membershipId:
type: integer
description: "The ID of the membership that the user left. This is defined for each membership."
RenewedMembershipContent:
allOf:
- $ref: "#/components/schemas/MembershipContent"
- type: object
required:
- membershipId
properties:
membershipId:
type: integer
description: "The ID of the membership that the user renewed. This is defined for each membership."

# https://developers.line.biz/en/reference/partner-docs/#module-webhook-event-object
ModuleEvent:
Expand Down
Loading