whatsapp-business
Advanced tools
Comparing version 1.13.0 to 1.14.0
{ | ||
"name": "whatsapp-business", | ||
"author": "MarcosNicolau", | ||
"version": "1.13.0", | ||
"version": "1.14.0", | ||
"description": "Node.js connector for the WhatsApp Business APIs with TypeScript support, integration tests and more.", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -40,2 +40,49 @@ import { WABAErrorCodes } from "./error"; | ||
}; | ||
/** | ||
* When the name is "flow", it indicates a general flow submission. | ||
* Documentation: https://developers.facebook.com/docs/whatsapp/flows/reference/responsemsgwebhook/ | ||
*/ | ||
export type InteractiveWebhookMessageNfmReplyName = "address_message" | "flow" | string; | ||
export type InteractiveWebhookMessageNfmReply<Name extends InteractiveWebhookMessageNfmReplyName = string> = { | ||
name?: Name; | ||
response_json: string; | ||
} & Name extends "flow" ? { | ||
body: "Sent"; | ||
} : { | ||
body?: string; | ||
}; | ||
export interface InteractiveWebhookMessageListReply { | ||
/** | ||
* Unique ID of the selected list item. | ||
*/ | ||
id: string; | ||
/** | ||
* Title of the selected list item. | ||
*/ | ||
title: string; | ||
/** | ||
* Description of the selected list item. | ||
*/ | ||
description: string; | ||
} | ||
export interface InteractiveWebhookMessageButtonReply { | ||
/** | ||
* Unique ID of the button. | ||
*/ | ||
id: string; | ||
/** | ||
* Title of the button. | ||
*/ | ||
title: string; | ||
} | ||
export type InteractiveWebhookMessageObjects = InteractiveWebhookMessageButtonReply | InteractiveWebhookMessageListReply | InteractiveWebhookMessageNfmReply; | ||
export type InteractiveWebhookMessageType = "button_reply" | "list_reply" | "nfm_reply"; | ||
interface InteractiveWebhookMessagesMap extends Record<InteractiveWebhookMessageType, InteractiveWebhookMessageObjects> { | ||
button_reply: InteractiveWebhookMessageButtonReply; | ||
list_reply: InteractiveWebhookMessageListReply; | ||
nfm_reply: InteractiveWebhookMessageNfmReply; | ||
} | ||
export type InteractiveWebhookMessage<Type extends InteractiveWebhookMessageType = InteractiveWebhookMessageType> = Pick<InteractiveWebhookMessagesMap, Type> & { | ||
type: Type; | ||
}; | ||
type SharedMessageTypes = Exclude<MessageType, "template">; | ||
@@ -183,67 +230,3 @@ /** | ||
*/ | ||
interactive?: { | ||
/** | ||
* The type of interactive message that the customer replied to. | ||
*/ | ||
type: "button_reply" | "list_reply" | "nfm_reply"; | ||
} & ({ | ||
type: "button_reply"; | ||
/** | ||
* Sent when a customer clicks a button. | ||
*/ | ||
button_reply: { | ||
/** | ||
* Unique ID of the button. | ||
*/ | ||
id: string; | ||
/** | ||
* Title of the button. | ||
*/ | ||
title: string; | ||
}; | ||
} | { | ||
type: "list_reply"; | ||
/** | ||
* Sent when a customer selects an item from a list. | ||
*/ | ||
list_reply: { | ||
/** | ||
* Unique ID of the selected list item. | ||
*/ | ||
id: string; | ||
/** | ||
* Title of the selected list item. | ||
*/ | ||
title: string; | ||
/** | ||
* Description of the selected list item. | ||
*/ | ||
description: string; | ||
}; | ||
} | { | ||
type: "nfm_reply"; | ||
/** | ||
* Sent when a user submits a flow. | ||
*/ | ||
nfm_reply: { | ||
name: "address_message"; | ||
body?: string; | ||
response_json: string; | ||
} | { | ||
/** | ||
* Indicates a general flow submission. | ||
* Documentation: https://developers.facebook.com/docs/whatsapp/flows/reference/responsemsgwebhook/ | ||
*/ | ||
name: "flow"; | ||
/** | ||
* Body text indicating the flow was sent. | ||
*/ | ||
body: "Sent"; | ||
response_json: string; | ||
} | { | ||
name?: string; | ||
body?: string; | ||
response_json: string; | ||
}; | ||
}); | ||
interactive?: InteractiveWebhookMessage; | ||
/** | ||
@@ -427,2 +410,3 @@ * When the messages type field is set to location, this object is included in the messages object: | ||
timestamp: string; | ||
errors: Array<WebhookError>; | ||
}; | ||
@@ -429,0 +413,0 @@ export type WebhookMetadata = { |
{ | ||
"name": "whatsapp-business", | ||
"author": "MarcosNicolau", | ||
"version": "1.13.0", | ||
"version": "1.14.0", | ||
"description": "Node.js connector for the WhatsApp Business APIs with TypeScript support, integration tests and more.", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
121741
2293