From c272d93039497a05d3786f2995b38d533537a6f1 Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 29 Jul 2024 16:08:26 -0300 Subject: [PATCH 1/4] =?UTF-8?q?Feat:=20=E2=9C=A8=20added=20contacts=20type?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types/webhooks.ts | 49 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/src/types/webhooks.ts b/src/types/webhooks.ts index c3936ca..1a3a12a 100644 --- a/src/types/webhooks.ts +++ b/src/types/webhooks.ts @@ -70,6 +70,49 @@ export type WebhookMessage = { payload: string; text: string; }; + /** + * When the messages type field is set to contacts, this object is included in the messages object: + */ + contacts?: [ + { + addresses?: { + city?: string; + country?: string; + country_code?: string; + state?: string; + street?: string; + type?: string; + zip?: string; + }[]; + birthday?: string; + emails?: { + email: string; + type?: string; + }[]; + name?: { + formatted_name?: string; + first_name?: string; + last_name?: string; + middle_name?: string; + suffix?: string; + prefix?: string; + }; + org?: { + company?: string; + department?: string; + title?: string; + }; + phones?: { + phone: string; + wa_id?: string; + type?: string; + }[]; + urls?: { + url: string; + type?: string; + }[]; + }, + ]; /** * Context object. Only included when a user replies or interacts with one of your messages. Context objects can have the following properties */ @@ -163,9 +206,9 @@ export type WebhookMessage = { * Sent when a user submits a flow */ nfm_reply?: { - body: string; - name: string; - response_json: string; + body: string; + name: string; + response_json: string; }; }; /** From 38e86ab48c54255ba39e3a7d80d1d01c086f09c5 Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 29 Jul 2024 16:37:12 -0300 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E2=9C=A8=20added=20location=20obje?= =?UTF-8?q?ct=20types=20to=20webhooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types/webhooks.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/types/webhooks.ts b/src/types/webhooks.ts index 1a3a12a..dd8859c 100644 --- a/src/types/webhooks.ts +++ b/src/types/webhooks.ts @@ -71,7 +71,7 @@ export type WebhookMessage = { text: string; }; /** - * When the messages type field is set to contacts, this object is included in the messages object: + * When the messages type field is set to contact, this object is included in the messages object: */ contacts?: [ { @@ -211,6 +211,16 @@ export type WebhookMessage = { response_json: string; }; }; + /** + * When the messages type field is set to location, this object is included in the messages object: + */ + location?: { + latitude: string; + longitude: string; + name?: string; + address?: string; + }; + /** * Included in the messages object when a customer has placed an order. Order objects have the following properties: */ From 3320d28a4ff4f062bc631cf28b6dcd5ff3ae5efe Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 29 Jul 2024 17:12:33 -0300 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E2=9C=A8=20added=20request=5Fwelco?= =?UTF-8?q?me=20as=20message=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types/messages.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/types/messages.ts b/src/types/messages.ts index 94d164c..5eda9bc 100644 --- a/src/types/messages.ts +++ b/src/types/messages.ts @@ -36,7 +36,8 @@ export type MessageType = | "template" | "text" | "video" - | "reaction"; + | "reaction" + | "request_welcome"; export type MessageContext = { /** @@ -251,7 +252,7 @@ export type InteractiveMessageAction = { /** * Required for Call-to-Action URL Button Messages. */ - url?: string; + url?: string; /** * Optional for Flows Messages. * From ce1df894fd3dde5262126d9c45a1aa23ec10b08f Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 29 Jul 2024 18:03:38 -0300 Subject: [PATCH 4/4] Fix: move the new message type to right place --- src/types/messages.ts | 3 +-- src/types/webhooks.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/types/messages.ts b/src/types/messages.ts index 5eda9bc..aeb5861 100644 --- a/src/types/messages.ts +++ b/src/types/messages.ts @@ -36,8 +36,7 @@ export type MessageType = | "template" | "text" | "video" - | "reaction" - | "request_welcome"; + | "reaction"; export type MessageContext = { /** diff --git a/src/types/webhooks.ts b/src/types/webhooks.ts index dd8859c..4ffd9ee 100644 --- a/src/types/webhooks.ts +++ b/src/types/webhooks.ts @@ -48,7 +48,7 @@ export type WebhookMessage = { /** * The type of message that has been received by the business that has subscribed to Webhooks. */ - type: MessageType | "system" | "unknown"; + type: MessageType | "system" | "unknown" | "request_welcome"; /** * The time when the customer sent the message to the business in unix format */