Skip to content

Commit

Permalink
Merge pull request #38 from tecoad/main
Browse files Browse the repository at this point in the history
Feat: ✨ added webhook contacts & location types
  • Loading branch information
MarcosNicolau authored Jul 29, 2024
2 parents e58364c + ce1df89 commit 527657b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/types/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export type InteractiveMessageAction = {
/**
* Required for Call-to-Action URL Button Messages.
*/
url?: string;
url?: string;
/**
* Optional for Flows Messages.
*
Expand Down
61 changes: 57 additions & 4 deletions src/types/webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -70,6 +70,49 @@ export type WebhookMessage = {
payload: string;
text: string;
};
/**
* When the messages type field is set to contact, 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
*/
Expand Down Expand Up @@ -163,11 +206,21 @@ 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;
};
};
/**
* 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:
*/
Expand Down

0 comments on commit 527657b

Please sign in to comment.