Skip to content

Commit c988035

Browse files
authored
Merge pull request #340 from nanato12/feature/webhook-redelivery
Support : "webhook redelivery"
2 parents 47dcab8 + a067a2e commit c988035

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/types.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ export type EventBase = {
7878
* Source user, group, or room object with information about the source of the event.
7979
*/
8080
source: EventSource;
81+
/**
82+
* Webhook Event ID, an ID that uniquely identifies a webhook event
83+
*/
84+
webhookEventId: string;
85+
/**
86+
* Whether the webhook event is a redelivered one or not
87+
*/
88+
deliveryContext: DeliveryContext;
8189
};
8290

8391
export type EventSource = User | Group | Room;
@@ -110,6 +118,8 @@ export type Room = {
110118
userId?: string;
111119
};
112120

121+
export type DeliveryContext = { isRedelivery: boolean };
122+
113123
export type ReplyableEvent = EventBase & { replyToken: string };
114124

115125
/**

test/middleware.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ describe("middleware", () => {
2626
groupId: "test_group_id",
2727
type: "group",
2828
},
29+
webhookEventId: "test_webhook_event_id",
30+
deliveryContext: {
31+
isRedelivery: false,
32+
},
2933
timestamp: 0,
3034
mode: "active",
3135
type: "message",
3236
};
3337
const webhookSignature = {
34-
"X-Line-Signature": "GzU7H3qOXDzDD6cNcS/9otLzlLFxnYYriz62rNu5BDE=",
38+
"X-Line-Signature": "Ey7AjSuSI2GfTDQHICAiRLLJ+GSMseISNYaQ6qXSjrU=",
3539
};
3640

3741
const http = (headers: any = { ...webhookSignature }) =>

0 commit comments

Comments
 (0)