export type WebhookObjectType = "page" | "instagram" | "user" | "permissions" | "payments" | (string & {}); export interface RawWebhookValue { item?: string; verb?: string; from?: { id?: string; name?: string; username?: string; }; sender_id?: string; sender_name?: string; post_id?: string; comment_id?: string; parent_id?: string; created_time?: number; edited_time?: number; message?: string; is_hidden?: boolean; reaction_type?: string; id?: string; text?: string; media?: { id?: string; media_product_type?: string; ad_id?: string; ad_title?: string; original_media_id?: string; }; media_id?: string; rating?: number; review_text?: string | null; recommendation_type?: "positive" | "negative"; reviewer_id?: string; reviewer_name?: string; [key: string]: unknown; } export interface RawWebhookChange { field: string; value: RawWebhookValue; } export interface RawWebhookMessaging { sender?: { id?: string; }; recipient?: { id?: string; }; timestamp?: number; [key: string]: unknown; } export interface RawWebhookEntry { id: string; time: number; changes?: RawWebhookChange[]; messaging?: RawWebhookMessaging[]; field?: string; value?: RawWebhookValue; } export interface WebhookPayload { object: WebhookObjectType; entry: RawWebhookEntry[]; } export type Platform = "facebook" | "instagram"; export type WebhookEventType = "comment.added" | "comment.edited" | "comment.removed" | "comment.hidden" | "comment.unhidden" | "post.published" | "reaction.added" | "reaction.removed" | "mention.created" | "review.created" | "review.updated" | "unknown"; export interface WebhookAuthor { id: string; name?: string; username?: string; } interface WebhookEventBase { accountId: string; time: number; raw: RawWebhookChange | RawWebhookMessaging; } export interface CommentEvent extends WebhookEventBase { type: "comment.added" | "comment.edited" | "comment.removed" | "comment.hidden" | "comment.unhidden"; platform: Platform; commentId: string; parentId?: string; postId?: string; mediaId?: string; text?: string; from?: WebhookAuthor; createdTime?: number; isHidden?: boolean; } export interface PostEvent extends WebhookEventBase { type: "post.published"; platform: "facebook"; postId: string; postType: string; message?: string; from?: WebhookAuthor; createdTime?: number; } export interface ReactionEvent extends WebhookEventBase { type: "reaction.added" | "reaction.removed"; platform: "facebook"; reactionType: string; postId?: string; commentId?: string; from?: WebhookAuthor; createdTime?: number; } export interface MentionEvent extends WebhookEventBase { type: "mention.created"; platform: Platform; postId?: string; mediaId?: string; commentId?: string; text?: string; from?: WebhookAuthor; createdTime?: number; } export interface ReviewEvent extends WebhookEventBase { type: "review.created" | "review.updated"; platform: "facebook"; rating?: number; reviewText?: string | null; recommendationType?: "positive" | "negative"; reviewerId?: string; reviewerName?: string; createdTime?: number; } export interface UnknownEvent extends WebhookEventBase { type: "unknown"; object: string; platform?: Platform; field?: string; } export type WebhookEvent = CommentEvent | PostEvent | ReactionEvent | MentionEvent | ReviewEvent | UnknownEvent; export {}; //# sourceMappingURL=webhook.d.ts.map