Skip to content

Commit

Permalink
fix: add interacted and link_clicked to engagement statuses (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbell authored May 3, 2024
1 parent 3ad0caf commit 044d427
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/resources/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class Messages {

async setStatus(
messageId: string,
status: MessageEngagementStatus,
status: Exclude<MessageEngagementStatus, "link_clicked">,
): Promise<Message> {
if (!messageId) {
throw new Error(`Incomplete arguments. You must provide a 'messageId'`);
Expand All @@ -92,7 +92,7 @@ export class Messages {

async deleteStatus(
messageId: string,
status: MessageEngagementStatus,
status: Exclude<MessageEngagementStatus, "link_clicked">,
): Promise<Message> {
if (!messageId) {
throw new Error(`Incomplete arguments. You must provide a 'messageId'`);
Expand All @@ -107,7 +107,11 @@ export class Messages {

async batchSetStatus(
messageIds: string[],
status: MessageEngagementStatus | "unseen" | "unread" | "unarchived",
status:
| Exclude<MessageEngagementStatus, "link_clicked">
| "unseen"
| "unread"
| "unarchived",
): Promise<Message[]> {
const { data } = await this.knock.post(`/v1/messages/batch/${status}`, {
message_ids: messageIds,
Expand Down
7 changes: 6 additions & 1 deletion src/resources/messages/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,9 @@ type MessageStatus =
| "undelivered"
| "not_sent";

export type MessageEngagementStatus = "seen" | "read" | "archived";
export type MessageEngagementStatus =
| "seen"
| "read"
| "archived"
| "interacted"
| "link_clicked";

0 comments on commit 044d427

Please sign in to comment.