Skip to content

Commit

Permalink
support-vide
Browse files Browse the repository at this point in the history
  • Loading branch information
uriva committed Jan 9, 2025
1 parent bdc7a3b commit 09061e1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/whatsapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ type TextMessage = CommonProps & {
context?: { from: string; id: string };
};

type VideoMessage = CommonProps & {
type: "video";
caption: string;
sha256: string;
id: string;
mime_type: string;
};

type ReactionMessage = CommonProps & {
type: "reaction";
reaction: { message_id: string; emoji: string };
Expand Down Expand Up @@ -196,7 +204,8 @@ type InnerMessage =
| ImageMessage
| ReactionMessage
| RequestWelcome
| TextMessage;
| TextMessage
| VideoMessage;

// https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/payload-examples#text-messages
type WhatsappMessage = {
Expand Down Expand Up @@ -264,6 +273,8 @@ const messageText = pipe(
? msg.image.caption
: msg.type === "reaction"
? msg.reaction.emoji
: msg.type === "video"
? msg.caption
: ""
),
filter((x: string) => x),
Expand Down

0 comments on commit 09061e1

Please sign in to comment.