interface ClientConfig {
    accessToken?: string;
    version: string;
    baseUrl?: string;
    timeout?: number;
    maxRetries?: number;
}
interface APIOptions {
    accessToken?: string;
}
interface RequestOptions {
    method: 'GET' | 'POST' | 'DELETE';
    path: string;
    body?: any;
    query?: Record<string, string | number | boolean>;
    accessToken?: string;
}
declare class HTTPClient {
    private readonly config;
    constructor(config: ClientConfig);
    request<T>(options: RequestOptions): Promise<T>;
    private buildUrl;
    private makeRequest;
    private handleResponse;
    private delay;
}

interface Recipient {
    id?: string;
    phone_number?: string;
    user_ref?: string;
    comment_id?: string;
    post_id?: string;
    name?: {
        first_name: string;
        last_name: string;
    };
}
interface QuickReply$1 {
    content_type: 'text' | 'user_phone_number' | 'user_email';
    title?: string;
    payload?: string;
    image_url?: string;
}
interface Message$2 {
    text?: string;
    attachment?: Attachment;
    quick_replies?: QuickReply$1[];
    metadata?: string;
}
interface Attachment {
    type: 'image' | 'audio' | 'video' | 'file' | 'template';
    payload: AttachmentPayload$1 | TemplatePayload;
}
interface AttachmentPayload$1 {
    url?: string;
    attachment_id?: string;
    is_reusable?: boolean;
}
interface TemplatePayload {
    template_type: 'generic' | 'button' | 'media' | 'product';
    elements?: any[];
    buttons?: any[];
    [key: string]: any;
}
type SenderAction = 'mark_seen' | 'typing_on' | 'typing_off' | 'react' | 'unreact';
interface ReactionPayload {
    message_id: string;
    reaction?: string;
}
type MessagingType = 'RESPONSE' | 'UPDATE' | 'MESSAGE_TAG';
interface SendMessageRequest {
    recipient: Recipient;
    messaging_type: MessagingType;
    message?: Message$2;
    sender_action?: SenderAction;
    sender_action_payload?: ReactionPayload;
    notification_type?: 'REGULAR' | 'SILENT_PUSH' | 'NO_PUSH';
    tag?: string;
}

interface SendMessageResponse {
    recipient_id?: string;
    message_id: string;
    attachment_id?: string;
}
interface MessengerError {
    message: string;
    type: string;
    code: number;
    error_subcode?: number;
    fbtrace_id: string;
}
interface ErrorResponse {
    error: MessengerError;
}

type AttachmentType$1 = 'image' | 'audio' | 'video' | 'file';
interface AttachmentUploadRequest {
    type: AttachmentType$1;
    url: string;
    is_reusable?: boolean;
}
interface AttachmentUploadResponse {
    attachment_id: string;
}

declare class SendAPI {
    private httpClient;
    constructor(httpClient: HTTPClient);
    message(request: SendMessageRequest, options?: APIOptions): Promise<SendMessageResponse>;
    action(recipientId: string, action: SenderAction, options?: APIOptions & {
        payload?: ReactionPayload;
    }): Promise<SendMessageResponse>;
    typingOn(recipientId: string, options?: APIOptions): Promise<SendMessageResponse>;
    typingOff(recipientId: string, options?: APIOptions): Promise<SendMessageResponse>;
    markSeen(recipientId: string, options?: APIOptions): Promise<SendMessageResponse>;
    setTyping(recipientId: string, state: boolean, options?: APIOptions): Promise<SendMessageResponse>;
    markRead(recipientId: string, options?: APIOptions): Promise<SendMessageResponse>;
    addReaction(recipientId: string, content: {
        messageId: string;
        emoji: string;
    }, options?: APIOptions): Promise<SendMessageResponse>;
    removeReaction(recipientId: string, messageId: string, options?: APIOptions): Promise<SendMessageResponse>;
    /**
     * Send an attachment using a previously uploaded attachment_id
     */
    attachment(options: {
        recipient: Recipient;
        type: AttachmentType$1;
        attachment_id: string;
        messaging_type?: 'RESPONSE' | 'UPDATE' | 'MESSAGE_TAG';
    }, apiOptions?: APIOptions): Promise<SendMessageResponse>;
    /**
     * Upload and send an attachment from URL in a single request
     */
    attachmentFromUrl(options: {
        recipient: Recipient;
        type: AttachmentType$1;
        url: string;
        messaging_type?: 'RESPONSE' | 'UPDATE' | 'MESSAGE_TAG';
    }, apiOptions?: APIOptions): Promise<SendMessageResponse>;
}

declare class AttachmentsAPI {
    private httpClient;
    constructor(httpClient: HTTPClient);
    upload(request: AttachmentUploadRequest, options?: APIOptions): Promise<AttachmentUploadResponse>;
}

interface UserId {
    id: string;
}
type ModerationAction = 'block_user' | 'unblock_user' | 'ban_user' | 'unban_user' | 'move_to_spam';
interface ModerateConversationsRequest {
    user_ids: UserId[];
    actions: ModerationAction[];
}
interface ModerateConversationsResponse {
    result: 'success' | 'failure';
}

declare class ModerationAPI {
    private httpClient;
    constructor(httpClient: HTTPClient);
    /**
     * Moderate conversations with specified actions
     * Up to 10 user IDs and up to 2 actions per request
     */
    moderate(request: ModerateConversationsRequest, options?: APIOptions): Promise<ModerateConversationsResponse>;
    /**
     * Block a user from messaging the page
     * Prevents messaging but user can still interact with page content on Facebook
     */
    blockUser(userIds: string | string[], options?: APIOptions): Promise<ModerateConversationsResponse>;
    /**
     * Unblock a user to allow messaging again
     */
    unblockUser(userIds: string | string[], options?: APIOptions): Promise<ModerateConversationsResponse>;
    /**
     * Ban a user from both messaging and Facebook interactions
     * More restrictive than blocking - prevents all interactions
     * Note: Cannot ban user who was unbanned in last 48 hours
     */
    banUser(userIds: string | string[], options?: APIOptions): Promise<ModerateConversationsResponse>;
    /**
     * Unban a user to restore all interactions
     * Note: Banned user cannot be unblocked, they must be unbanned first
     */
    unbanUser(userIds: string | string[], options?: APIOptions): Promise<ModerateConversationsResponse>;
    /**
     * Move conversation to spam folder in Meta Business Suite Inbox
     */
    moveToSpam(userIds: string | string[], options?: APIOptions): Promise<ModerateConversationsResponse>;
    /**
     * Block user and move to spam (common moderation action)
     */
    blockAndSpam(userIds: string | string[], options?: APIOptions): Promise<ModerateConversationsResponse>;
}

interface Button {
    type: 'web_url' | 'postback' | 'phone_number' | 'game_play' | 'account_link' | 'account_unlink';
    title?: string;
    url?: string;
    payload?: string;
    webview_height_ratio?: 'compact' | 'tall' | 'full';
    messenger_extensions?: boolean;
    fallback_url?: string;
    webview_share_button?: 'hide' | 'show';
    game_metadata?: {
        player_id?: string;
        context_id?: string;
    };
}
interface DefaultAction {
    type: 'web_url';
    url: string;
    webview_height_ratio?: 'compact' | 'tall' | 'full';
    messenger_extensions?: boolean;
    fallback_url?: string;
    webview_share_button?: 'hide' | 'show';
}
interface GenericTemplateElement {
    title: string;
    subtitle?: string;
    image_url?: string;
    default_action?: DefaultAction;
    buttons?: Button[];
}
interface GenericTemplatePayload {
    template_type: 'generic';
    elements: GenericTemplateElement[];
    image_aspect_ratio?: 'horizontal' | 'square';
}
interface ButtonTemplatePayload {
    template_type: 'button';
    text: string;
    buttons: Button[];
}
interface MediaTemplateElement {
    media_type: 'image' | 'video';
    url?: string;
    attachment_id?: string;
    buttons?: Button[];
    sharable?: boolean;
}
interface MediaTemplatePayload {
    template_type: 'media';
    elements: [MediaTemplateElement];
}
interface ProductTemplateElement {
    id: string;
}
interface ProductTemplatePayload {
    template_type: 'product';
    elements: ProductTemplateElement[];
}

declare class TemplatesAPI {
    private httpClient;
    constructor(httpClient: HTTPClient);
    generic(options: {
        recipient: Recipient;
        elements: GenericTemplateElement[];
        messaging_type?: MessagingType;
        image_aspect_ratio?: 'horizontal' | 'square';
        notification_type?: 'REGULAR' | 'SILENT_PUSH' | 'NO_PUSH';
        tag?: string;
    }, apiOptions?: APIOptions): Promise<SendMessageResponse>;
    button(options: {
        recipient: Recipient;
        text: string;
        buttons: Button[];
        messaging_type?: MessagingType;
        notification_type?: 'REGULAR' | 'SILENT_PUSH' | 'NO_PUSH';
        tag?: string;
    }, apiOptions?: APIOptions): Promise<SendMessageResponse>;
    media(options: {
        recipient: Recipient;
        element: MediaTemplateElement;
        messaging_type?: MessagingType;
        notification_type?: 'REGULAR' | 'SILENT_PUSH' | 'NO_PUSH';
        tag?: string;
    }, apiOptions?: APIOptions): Promise<SendMessageResponse>;
    product(options: {
        recipient: Recipient;
        elements: ProductTemplateElement[];
        messaging_type?: MessagingType;
        notification_type?: 'REGULAR' | 'SILENT_PUSH' | 'NO_PUSH';
        tag?: string;
    }, apiOptions?: APIOptions): Promise<SendMessageResponse>;
}

type ProfileField = 'id' | 'name' | 'first_name' | 'last_name' | 'profile_pic' | 'locale' | 'timezone' | 'gender';
interface GetProfileRequest {
    psid: string;
    fields?: ProfileField[];
}
interface UserProfile {
    id?: string;
    name?: string;
    first_name?: string;
    last_name?: string;
    profile_pic?: string;
    locale?: string;
    timezone?: number;
    gender?: string;
}

declare class ProfileAPI {
    private httpClient;
    constructor(httpClient: HTTPClient);
    /**
     * Get user profile information using PSID
     * Requires "Advanced User Profile Access" feature
     */
    get(request: GetProfileRequest, options?: APIOptions): Promise<UserProfile>;
    /**
     * Get user profile with default fields (first_name, last_name, profile_pic)
     */
    getBasic(psid: string, options?: APIOptions): Promise<UserProfile>;
    /**
     * Get comprehensive user profile with all available fields
     */
    getFull(psid: string, options?: APIOptions): Promise<UserProfile>;
    /**
     * Get user's name (first_name and last_name)
     */
    getName(psid: string, options?: APIOptions): Promise<UserProfile>;
    /**
     * Get user's profile picture URL
     */
    getProfilePicture(psid: string, options?: APIOptions): Promise<UserProfile>;
}

/**
 * Facebook Messenger Platform - Conversations API Types
 *
 * Type definitions for retrieving conversations and messages between users and Pages/Instagram Business accounts.
 *
 * @see https://developers.facebook.com/docs/messenger-platform/conversations
 */
/**
 * Platform type for conversations
 */
type ConversationPlatform = 'instagram' | 'messenger';
/**
 * Conversation folder types
 */
type ConversationFolder = 'inbox' | 'pending' | 'spam';
/**
 * Basic conversation information
 */
interface Conversation {
    /** The conversation ID */
    id: string;
    /** Timestamp of the most recent message (Unix timestamp) */
    updated_time: string;
}
/**
 * Participant in a conversation
 */
interface ConversationParticipant {
    /** Instagram-scoped ID or Page-scoped ID of a person, or Page ID, or Instagram Business Account ID */
    id: string;
    /** Email of the person or Page (Messenger only) */
    email?: string;
    /** Name of the person or Page (Messenger only) */
    name?: string;
    /** Instagram username of a person or your Instagram Business Account (Instagram only) */
    username?: string;
}
/**
 * Detailed conversation with messages and participants
 */
interface ConversationDetail {
    /** The conversation ID */
    id: string;
    /** Messages in the conversation */
    messages?: {
        data: MessageBasic[];
        paging?: {
            cursors?: {
                before?: string;
                after?: string;
            };
            next?: string;
            previous?: string;
        };
    };
    /** Participants in the conversation */
    participants?: {
        data: ConversationParticipant[];
    };
    /** Timestamp of the most recent message */
    updated_time?: string;
}
/**
 * Basic message information (ID and timestamp)
 */
interface MessageBasic {
    /** The message ID */
    id: string;
    /** When the message was created (ISO 8601 timestamp) */
    created_time: string;
}
/**
 * Message sender/recipient information
 */
interface MessageParticipant {
    /** Instagram-scoped ID or Page-scoped ID or Instagram Business Account ID */
    id: string;
    /** Email (Messenger only) */
    email?: string;
    /** Name (Messenger only) */
    name?: string;
    /** Instagram username (Instagram only) */
    username?: string;
}
/**
 * Message attachment types
 */
type MessageAttachmentType = 'image' | 'video' | 'audio' | 'file';
/**
 * Image data in attachment
 */
interface ImageData {
    /** Preview URL of the image */
    preview_url?: string;
    /** Full URL of the image */
    url?: string;
    /** Width in pixels */
    width?: number;
    /** Height in pixels */
    height?: number;
    /** Max width in pixels */
    max_width?: number;
    /** Max height in pixels */
    max_height?: number;
    /** URL of animated GIF preview */
    animated_gif_preview_url?: string;
    /** URL of animated GIF */
    animated_gif_url?: string;
    /** Whether to render as sticker */
    render_as_sticker?: boolean;
}
/**
 * Video data in attachment
 */
interface VideoData {
    /** URL of the video */
    url?: string;
    /** Width in pixels */
    width?: number;
    /** Height in pixels */
    height?: number;
    /** Preview URL */
    preview_url?: string;
}
/**
 * Generic template in attachment
 */
interface GenericTemplate {
    /** Call-to-action button */
    cta?: {
        title?: string;
        type?: string;
        url?: string;
    };
    /** Media URL */
    media_url?: string;
    /** Subtitle text */
    subtitle?: string;
    /** Title text */
    title?: string;
}
/**
 * Message attachment
 */
interface MessageAttachment$1 {
    /** Attachment ID */
    id?: string;
    /** File URL */
    file_url?: string;
    /** Image data */
    image_data?: ImageData;
    /** Video data */
    video_data?: VideoData;
    /** Generic template */
    generic_template?: GenericTemplate;
    /** File name */
    name?: string;
}
/**
 * Reaction to a message
 */
interface MessageReaction {
    /** Emoji reaction (e.g., "❤️", "😂", "👍") */
    reaction: string;
    /** Users who reacted with this emoji */
    users: Array<{
        id: string;
        username?: string;
    }>;
}
/**
 * Reply information
 */
interface ReplyInfo {
    /** Message ID being replied to */
    mid: string;
    /** Whether this is a self-reply (reply to own message) */
    is_self_reply?: boolean;
}
/**
 * Story share/mention
 */
interface StoryShare {
    /** CDN URL of the story */
    link: string;
    /** Story ID */
    id: string;
}
/**
 * Product in a share
 */
interface SharedProduct {
    /** Product ID (0 if business can't see this product) */
    id: string;
    /** ID assigned by the retailer */
    retailer_id?: string;
    /** Product image URL */
    image_url?: string;
    /** Product name */
    name?: string;
    /** Product price */
    price?: string;
}
/**
 * Share template payload
 */
interface ShareTemplatePayload {
    product?: {
        elements?: {
            data: SharedProduct[];
        };
    };
}
/**
 * Shared content
 */
interface MessageShare {
    /** Share template */
    template?: {
        payload?: ShareTemplatePayload;
    };
}
/**
 * Message tags
 */
interface MessageTag {
    /** Tag name (e.g., "inbox", "read", "source:chat") */
    name: string;
}
/**
 * Detailed message information
 */
interface Message$1 {
    /** The message ID */
    id: string;
    /** When the message was created */
    created_time: string;
    /** Sender information */
    from?: MessageParticipant;
    /** Recipient information */
    to?: {
        data: MessageParticipant[];
    };
    /** Text content of the message (empty if no text) */
    message?: string;
    /** Message attachments */
    attachments?: {
        data: MessageAttachment$1[];
    };
    /** Reactions to the message */
    reactions?: {
        data: MessageReaction[];
    };
    /** Shared content (posts, products, etc.) */
    shares?: {
        data: MessageShare[];
    };
    /** Story reply or mention */
    story?: StoryShare;
    /** Reply information */
    reply_to?: ReplyInfo;
    /** Message tags */
    tags?: {
        data: MessageTag[];
    };
    /** Whether the message contains unsupported content */
    is_unsupported?: boolean;
}
/**
 * Request parameters for listing conversations
 */
interface ListConversationsParams {
    /** Platform to filter by */
    platform?: ConversationPlatform;
    /** User ID to find conversations with specific user */
    user_id?: string;
    /** Folder to filter by */
    folder?: ConversationFolder;
    /** Number of conversations to return */
    limit?: number;
    /** Pagination cursor */
    after?: string;
    /** Pagination cursor */
    before?: string;
}
/**
 * Request parameters for getting conversation details
 */
interface GetConversationParams {
    /** Fields to retrieve (e.g., 'messages', 'participants') */
    fields?: string[];
    /** Number of messages to return */
    limit?: number;
    /** Pagination cursor */
    after?: string;
    /** Pagination cursor */
    before?: string;
}
/**
 * Request parameters for getting message details
 */
interface GetMessageParams {
    /** Fields to retrieve */
    fields?: string[];
}
/**
 * Response for listing conversations
 */
interface ListConversationsResponse {
    data: Conversation[];
    paging?: {
        cursors?: {
            before?: string;
            after?: string;
        };
        next?: string;
        previous?: string;
    };
}
/**
 * Response for getting messages in a conversation
 */
interface ListMessagesResponse {
    data: MessageBasic[];
    paging?: {
        cursors?: {
            before?: string;
            after?: string;
        };
        next?: string;
        previous?: string;
    };
}

/**
 * Conversations API Resource
 *
 * Handles retrieving conversations and messages between users and Pages/Instagram Business accounts.
 *
 * @see https://developers.facebook.com/docs/messenger-platform/conversations
 */

/**
 * Conversations API class for retrieving conversation and message data
 *
 * @example
 * ```typescript
 * const messenger = new Messenger({ accessToken: 'PAGE_TOKEN' });
 *
 * // List all conversations
 * const conversations = await messenger.conversations.list('PAGE_ID', {
 *   platform: 'messenger'
 * });
 *
 * // Get conversation details
 * const conversation = await messenger.conversations.get('CONVERSATION_ID');
 *
 * // Get message details
 * const message = await messenger.conversations.getMessage('MESSAGE_ID');
 * ```
 */
declare class ConversationsAPI {
    private httpClient;
    constructor(httpClient: HTTPClient);
    /**
     * Get a list of conversations for a Page or Instagram Business Account
     *
     * @param pageId - The Page ID or Instagram Business Account ID
     * @param params - Optional parameters for filtering and pagination
     * @param options - Optional request options (e.g., token override)
     * @returns List of conversations
     *
     * @example
     * ```typescript
     * // List Messenger conversations
     * const conversations = await messenger.conversations.list('PAGE_ID', {
     *   platform: 'messenger',
     *   limit: 25
     * });
     *
     * // Find conversation with specific user
     * const userConvos = await messenger.conversations.list('PAGE_ID', {
     *   platform: 'instagram',
     *   user_id: 'USER_INSTAGRAM_SCOPED_ID'
     * });
     *
     * // Paginate through conversations
     * const nextPage = await messenger.conversations.list('PAGE_ID', {
     *   platform: 'messenger',
     *   after: conversations.paging?.cursors?.after
     * });
     * ```
     */
    list(pageId: string, params?: ListConversationsParams, options?: APIOptions): Promise<ListConversationsResponse>;
    /**
     * Get details about a specific conversation
     *
     * @param conversationId - The conversation ID
     * @param params - Optional parameters for fields and pagination
     * @param options - Optional request options (e.g., token override)
     * @returns Conversation details
     *
     * @example
     * ```typescript
     * // Get conversation with messages
     * const conversation = await messenger.conversations.get('CONVERSATION_ID', {
     *   fields: ['messages', 'participants']
     * });
     *
     * // Get only participants
     * const participants = await messenger.conversations.get('CONVERSATION_ID', {
     *   fields: ['participants']
     * });
     * ```
     */
    get(conversationId: string, params?: GetConversationParams, options?: APIOptions): Promise<ConversationDetail>;
    /**
     * Get messages in a conversation
     *
     * @param conversationId - The conversation ID
     * @param params - Optional parameters for pagination
     * @param options - Optional request options (e.g., token override)
     * @returns List of messages
     *
     * @example
     * ```typescript
     * // Get messages in a conversation
     * const messages = await messenger.conversations.getMessages('CONVERSATION_ID', {
     *   limit: 20
     * });
     *
     * // Paginate through messages
     * const nextPage = await messenger.conversations.getMessages('CONVERSATION_ID', {
     *   after: messages.paging?.cursors?.after
     * });
     * ```
     */
    getMessages(conversationId: string, params?: {
        limit?: number;
        after?: string;
        before?: string;
    }, options?: APIOptions): Promise<ListMessagesResponse>;
    /**
     * Get details about a specific message
     *
     * Note: You can only retrieve details for the 20 most recent messages in a conversation.
     * Older messages will return an error indicating the message was deleted.
     *
     * @param messageId - The message ID
     * @param params - Optional parameters for fields to retrieve
     * @param options - Optional request options (e.g., token override)
     * @returns Message details
     *
     * @example
     * ```typescript
     * // Get full message details
     * const message = await messenger.conversations.getMessage('MESSAGE_ID', {
     *   fields: ['id', 'created_time', 'from', 'to', 'message', 'attachments', 'reactions']
     * });
     *
     * // Get basic message info
     * const basicMessage = await messenger.conversations.getMessage('MESSAGE_ID');
     * ```
     */
    getMessage(messageId: string, params?: GetMessageParams, options?: APIOptions): Promise<Message$1>;
    /**
     * Get the 20 most recent messages in a conversation with full details
     *
     * This is a convenience method that retrieves message IDs and then fetches
     * full details for each message. Note that only the 20 most recent messages
     * can have their details retrieved.
     *
     * @param conversationId - The conversation ID
     * @param options - Optional request options (e.g., token override)
     * @returns Array of detailed messages
     *
     * @example
     * ```typescript
     * // Get recent messages with full details
     * const messages = await messenger.conversations.getRecentMessages('CONVERSATION_ID');
     *
     * for (const message of messages) {
     *   console.log(`${message.from?.username}: ${message.message}`);
     * }
     * ```
     */
    getRecentMessages(conversationId: string, options?: APIOptions): Promise<Message$1[]>;
    /**
     * Find a conversation between a Page and a specific user
     *
     * This is a convenience method that finds a conversation with a specific user.
     *
     * @param pageId - The Page ID or Instagram Business Account ID
     * @param userId - The user's Instagram-scoped ID or Page-scoped ID
     * @param platform - The platform ('instagram' or 'messenger')
     * @param options - Optional request options (e.g., token override)
     * @returns The conversation ID, or null if not found
     *
     * @example
     * ```typescript
     * // Find conversation with Instagram user
     * const conversationId = await messenger.conversations.findByUser(
     *   'PAGE_ID',
     *   'USER_INSTAGRAM_SCOPED_ID',
     *   'instagram'
     * );
     *
     * if (conversationId) {
     *   const messages = await messenger.conversations.getRecentMessages(conversationId);
     * }
     * ```
     */
    findByUser(pageId: string, userId: string, platform: 'instagram' | 'messenger', options?: APIOptions): Promise<string | null>;
}

interface MessengerConfig {
    accessToken?: string;
    version?: string;
    baseUrl?: string;
    timeout?: number;
    maxRetries?: number;
}
declare class Messenger {
    readonly send: SendAPI;
    readonly attachments: AttachmentsAPI;
    readonly moderation: ModerationAPI;
    readonly templates: TemplatesAPI;
    readonly profile: ProfileAPI;
    readonly conversations: ConversationsAPI;
    private readonly httpClient;
    constructor(config?: MessengerConfig);
    private validateConfig;
}

/**
 * Facebook Messenger Platform - Base Webhook Types
 *
 * This file contains the common base types and interfaces shared across
 * all webhook event types. It provides the foundation for a properly
 * structured type system with inheritance and discriminated unions.
 *
 * @module webhooks/base-types
 */
/**
 * Common sender interface for all webhook events.
 * Represents the user who initiated the action.
 */
interface WebhookSender {
    /**
     * Page-scoped ID (PSID) of the user.
     * This is the unique identifier for the user within the context of your page.
     */
    id: string;
    /**
     * User reference provided by the chat plugin, if applicable.
     * Only present for chat plugin events where the user hasn't been identified yet.
     */
    user_ref?: string;
}
/**
 * Common recipient interface for all webhook events.
 * Represents the Facebook Page that received the event.
 */
interface WebhookRecipient {
    /** Facebook Page ID that received the event */
    id: string;
}
/**
 * Base interface for all webhook events.
 * Contains the common properties shared by all event types.
 */
interface BaseWebhookEvent {
    /** Information about the user who initiated the event */
    sender: WebhookSender;
    /** Information about the page that received the event */
    recipient: WebhookRecipient;
    /**
     * Unix timestamp when the event occurred (in milliseconds since epoch).
     * Represents when the action was performed, not when the webhook was sent.
     */
    timestamp: number;
}
/**
 * Webhook event types enum with discriminator values.
 * Used for type narrowing in discriminated unions.
 */
declare enum WebhookEventType {
    MESSAGE = "message",
    MESSAGE_ECHO = "message_echo",
    MESSAGE_EDIT = "message_edit",
    MESSAGE_REACTION = "reaction",
    MESSAGE_READ = "read",
    MESSAGING_FEEDBACK = "messaging_feedback",
    MESSAGING_POSTBACK = "postback",
    FEED = "feed",
    VIDEOS = "videos",
    LIVE_VIDEOS = "live_videos"
}
/**
 * Generic webhook entry structure.
 * Represents a single entry in the webhook payload.
 */
interface WebhookEntry<T extends BaseWebhookEvent = BaseWebhookEvent> {
    /** Unique ID of the page */
    id: string;
    /** Time of update (epoch time in milliseconds) */
    time: number;
    /** Array of messaging events */
    messaging: T[];
}
/**
 * Generic webhook payload structure.
 * This is the top-level structure received from Facebook webhooks.
 */
interface WebhookPayload<T extends BaseWebhookEvent = BaseWebhookEvent> {
    /** Always 'page' for Messenger webhooks */
    object: 'page';
    /** Array of entry objects containing the actual events */
    entry: WebhookEntry<T>[];
}
/**
 * Generic webhook entry structure for Page webhooks (uses 'changes' instead of 'messaging').
 * Represents a single entry in a Page webhook payload.
 */
interface PageWebhookEntry<T = any> {
    /** Unique ID of the page */
    id: string;
    /** Time of update (epoch time in milliseconds) */
    time: number;
    /** Array of change events */
    changes: T[];
}
/**
 * Generic webhook payload structure for Page webhooks.
 * This is the top-level structure received from Facebook Page webhooks.
 */
interface PageWebhookPayload<T = any> {
    /** Always 'page' for Page webhooks */
    object: 'page';
    /** Array of entry objects containing the actual events */
    entry: PageWebhookEntry<T>[];
}
/**
 * Extract all events from a Page webhook payload (uses 'changes' array)
 *
 * @param payload - The Page webhook payload to extract events from
 * @returns Array of Page webhook events
 */
declare function extractPageEvents<T>(payload: PageWebhookPayload<T>): T[];
/**
 * Common processing context for all webhook events
 */
interface BaseProcessingContext {
    /** The user who initiated the event (PSID or user_ref) */
    senderId?: string;
    /** User reference for anonymous users */
    userRef?: string;
    /** The page that received the event */
    recipientId: string;
    /** When the event occurred */
    timestamp: number;
    /** Whether the sender is identified (has PSID) */
    isIdentifiedUser: boolean;
    /** Human-readable datetime for the event timestamp */
    eventDate: Date;
}
/**
 * Get event types from a Page webhook payload (uses 'changes' array)
 *
 * @param payload - The Page webhook payload to extract event types from
 * @returns Array of unique WebhookEventType values found in the payload
 *
 * @example
 * ```typescript
 * const eventTypes = getPageWebhookEventTypes(payload);
 * console.log('Page events:', eventTypes); // [WebhookEventType.FEED, WebhookEventType.VIDEOS]
 *
 * if (eventTypes.includes(WebhookEventType.FEED)) {
 *   // Process feed events
 * }
 * ```
 */
declare function getPageWebhookEventTypes(payload: PageWebhookPayload): WebhookEventType[];

/**
 * Facebook Messenger Platform - Message Edits Webhook Types
 *
 * These types represent the webhook event structure for message_edits events.
 * Triggered when a user edits a previously sent message.
 *
 * @see https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/message-edits/
 */

/**
 * Represents the edited message information
 */
interface MessageEdit {
    /**
     * Unique message identifier for the edited message
     */
    mid: string;
    /**
     * New message content after the edit.
     * Contains the updated text of the message.
     */
    text: string;
    /**
     * Number of times the message has been edited.
     * Maximum value is 5 (client-side constraint).
     */
    num_edit: number;
}
/**
 * Main webhook event structure for message edits with discriminator
 *
 * This event is triggered when a user edits a previously sent message.
 * The webhook provides the updated message content and edit count.
 *
 * @example
 * ```json
 * {
 *   "type": "message_edit",
 *   "sender": {
 *     "id": "1234567890123456"
 *   },
 *   "recipient": {
 *     "id": "9876543210987654"
 *   },
 *   "timestamp": 1458668856463,
 *   "message_edit": {
 *     "mid": "mid.1458668856218:ed81099e15d3f4f233",
 *     "text": "This is the updated message content",
 *     "num_edit": 2
 *   }
 * }
 * ```
 */
interface MessageEditWebhookEvent extends BaseWebhookEvent {
    /** Discriminator for type narrowing */
    type: WebhookEventType.MESSAGE_EDIT;
    /** Details about the edited message */
    message_edit: MessageEdit;
}
/**
 * Complete webhook payload structure that includes the message edit event
 * along with other webhook metadata
 */
interface MessageEditWebhookPayload extends WebhookPayload<MessageEditWebhookEvent> {
}
/**
 * Type guard to check if a webhook event is a message edit event
 *
 * @param event - The webhook event to check
 * @returns True if the event contains a message_edit property
 *
 * @example
 * ```typescript
 * if (isMessageEditEvent(event)) {
 *   // TypeScript now knows event has message_edit property
 *   console.log(`Message edited ${event.message_edit.num_edit} times`);
 * }
 * ```
 */
declare function isMessageEditEvent(event: any): event is MessageEditWebhookEvent;
/**
 * Utility type for common message edit properties that might be used in processing
 */
interface MessageEditProcessingContext extends BaseProcessingContext {
    /** The edited message ID */
    messageId: string;
    /** Updated message content */
    updatedText: string;
    /** Number of edits made */
    editCount: number;
}
/**
 * Helper function to extract processing context from a message edit event
 *
 * @param event - The message edit webhook event
 * @returns Simplified processing context
 *
 * @example
 * ```typescript
 * const context = extractMessageEditContext(webhookEvent);
 * console.log(`User ${context.senderId} edited message to: "${context.updatedText}"`);
 * ```
 */
declare function extractMessageEditContext(event: MessageEditWebhookEvent): MessageEditProcessingContext;
/**
 * Constants related to message editing limits and constraints
 */
declare const MESSAGE_EDIT_CONSTANTS: {
    /** Maximum number of edits allowed per message */
    readonly MAX_EDITS: 5;
    /** Webhook event type identifier */
    readonly EVENT_TYPE: "message_edit";
};

/**
 * Facebook Messenger Platform Message Reactions Webhook Types
 *
 * These types define the structure of webhook events received when users
 * react to messages in Messenger conversations.
 *
 * @see https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/message-reactions
 */

/**
 * Types of reactions that can be applied to messages in Messenger.
 * These are the predefined reaction types supported by Facebook.
 */
declare enum MessageReactionType {
    /** Standard like reaction */
    LIKE = "like",
    /** Dislike reaction */
    DISLIKE = "dislike",
    /** Love reaction (heart) */
    LOVE = "love",
    /** Sad reaction */
    SAD = "sad",
    /** Angry reaction */
    ANGRY = "angry",
    /** Wow/surprised reaction */
    WOW = "wow",
    /** Smile/laugh reaction */
    SMILE = "smile",
    /** Other/unrecognized emoji reactions */
    OTHER = "other"
}
/**
 * Actions that can be performed on message reactions.
 */
declare enum MessageReactionAction {
    /** Adding a reaction to a message */
    REACT = "react",
    /** Removing a reaction from a message */
    UNREACT = "unreact"
}

/**
 * Contains the detailed information about the reaction.
 */
interface MessageReactionData {
    /**
     * The type of reaction applied to the message.
     * Can be one of the predefined types or "other" for unrecognized emojis.
     */
    reaction: MessageReactionType;
    /**
     * The UTF-8 emoji representation of the reaction (optional).
     * Example: "\u{2764}\u{FE0F}" for heart emoji
     */
    emoji?: string;
    /**
     * The action performed - either adding or removing the reaction.
     */
    action: MessageReactionAction;
    /**
     * The message ID that the reaction was applied to.
     * This corresponds to the 'mid' field of the original message.
     */
    mid: string;
}
/**
 * Complete webhook event structure for message reactions with discriminator.
 * This is the main payload received when a user reacts to a message.
 */
interface MessageReactionWebhookEvent extends BaseWebhookEvent {
    /** Discriminator for type narrowing */
    type: WebhookEventType.MESSAGE_REACTION;
    /** Detailed information about the reaction */
    reaction: MessageReactionData;
}
/**
 * The complete webhook payload containing the message reaction event.
 * This matches the structure of the webhook POST request body.
 */
interface MessageReactionWebhookPayload extends WebhookPayload<MessageReactionWebhookEvent> {
}
/**
 * Context object for processing message reaction webhooks.
 * Useful for handlers that need additional processing information.
 */
interface MessageReactionProcessingContext {
    /** The original webhook event */
    event: MessageReactionWebhookEvent;
    /** Page ID that received the reaction */
    pageId: string;
    /** User ID who performed the reaction */
    userId: string;
    /** ID of the message that was reacted to */
    messageId: string;
    /** Whether this is a new reaction (true) or removal (false) */
    isReactionAdded: boolean;
    /** The type of reaction */
    reactionType: MessageReactionType;
    /** Raw emoji string if available */
    emoji?: string;
    /** Timestamp when the reaction occurred */
    timestamp: Date;
}
/**
 * Helper type for reaction statistics and aggregation.
 * Useful for tracking reaction counts on messages.
 */
interface MessageReactionStats {
    /** The message ID these stats apply to */
    messageId: string;
    /** Count of each reaction type */
    reactions: {
        [K in MessageReactionType]?: number;
    };
    /** Total number of reactions */
    totalReactions: number;
    /** Last updated timestamp */
    lastUpdated: Date;
}
/**
 * Configuration options for handling message reaction webhooks.
 */
interface MessageReactionWebhookConfig {
    /** Whether to track reaction statistics */
    enableStats?: boolean;
    /** Whether to handle emoji reactions beyond predefined types */
    handleCustomEmojis?: boolean;
    /** Maximum age of reactions to process (in milliseconds) */
    maxReactionAge?: number;
    /** Whether to validate webhook signatures */
    validateSignature?: boolean;
}

/**
 * Facebook Messenger Platform - Message Reads Webhook Types
 *
 * These types represent the webhook event structure for message_reads events.
 * Triggered when a user reads messages sent by a Page.
 *
 * The message_reads webhook event indicates that all messages up to a certain
 * watermark timestamp have been read by the recipient.
 *
 * @see https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/message-reads/
 */

/**
 * Represents the read receipt information
 */
interface MessageRead {
    /**
     * Watermark timestamp indicating all messages up to this point have been read.
     * This is a Unix timestamp in milliseconds.
     * All messages with a timestamp less than or equal to this value have been read.
     */
    watermark: number;
}
/**
 * Main webhook event structure for message reads with discriminator
 *
 * This event is triggered when a user reads messages sent by a Page.
 * The watermark indicates the timestamp up to which all messages have been read.
 *
 * @example
 * ```json
 * {
 *   "type": "read",
 *   "sender": {
 *     "id": "1234567890123456"
 *   },
 *   "recipient": {
 *     "id": "9876543210987654"
 *   },
 *   "timestamp": 1458668856463,
 *   "read": {
 *     "watermark": 1458668856253
 *   }
 * }
 * ```
 */
interface MessageReadsWebhookEvent extends BaseWebhookEvent {
    /** Discriminator for type narrowing */
    type: WebhookEventType.MESSAGE_READ;
    /** Read receipt information containing the watermark */
    read: MessageRead;
}
/**
 * Complete webhook payload structure that includes the message reads event
 * along with other webhook metadata
 */
interface MessageReadsWebhookPayload extends WebhookPayload<MessageReadsWebhookEvent> {
}
/**
 * Type guard to check if a webhook event is a message reads event
 *
 * @param event - The webhook event to check
 * @returns True if the event contains a read property
 *
 * @example
 * ```typescript
 * if (isMessageReadsEvent(event)) {
 *   // TypeScript now knows event has read property
 *   console.log(`Messages read up to timestamp: ${event.read.watermark}`);
 * }
 * ```
 */
declare function isMessageReadsEvent(event: any): event is MessageReadsWebhookEvent;
/**
 * Utility type for extracting just the read data from a webhook event
 */
type MessageReadData = MessageRead;
/**
 * Utility type for common message reads properties that might be used in processing
 */
interface MessageReadsProcessingContext {
    /** The user who read the messages */
    senderId: string;
    /** The page that sent the messages */
    recipientId: string;
    /** Timestamp up to which all messages have been read */
    watermarkTimestamp: number;
    /** When the read event occurred */
    readTimestamp: number;
    /**
     * Human-readable datetime for the watermark timestamp.
     * Useful for logging and debugging.
     */
    watermarkDate: Date;
    /**
     * Human-readable datetime for the read event timestamp.
     * Useful for logging and debugging.
     */
    readDate: Date;
}
/**
 * Helper function to extract processing context from a message reads event
 *
 * @param event - The message reads webhook event
 * @returns Simplified processing context with additional computed fields
 *
 * @example
 * ```typescript
 * const context = extractMessageReadsContext(webhookEvent);
 * console.log(`User ${context.senderId} read messages up to ${context.watermarkDate.toISOString()}`);
 * ```
 */
declare function extractMessageReadsContext(event: MessageReadsWebhookEvent): MessageReadsProcessingContext;
/**
 * Helper function to check if a specific message timestamp was read
 *
 * @param messageTimestamp - The timestamp of the message to check
 * @param watermark - The watermark timestamp from the read event
 * @returns True if the message with the given timestamp has been read
 *
 * @example
 * ```typescript
 * const messageTime = 1458668855000;
 * const watermark = 1458668856253;
 *
 * if (isMessageRead(messageTime, watermark)) {
 *   console.log('This message has been read');
 * }
 * ```
 */
declare function isMessageRead(messageTimestamp: number, watermark: number): boolean;
/**
 * Helper function to determine which messages in a list have been read
 *
 * @param messages - Array of messages with timestamp property
 * @param watermark - The watermark timestamp from the read event
 * @returns Array of messages that have been read
 *
 * @example
 * ```typescript
 * const messages = [
 *   { id: '1', timestamp: 1458668855000, text: 'Hello' },
 *   { id: '2', timestamp: 1458668857000, text: 'World' }
 * ];
 * const watermark = 1458668856253;
 *
 * const readMessages = getReadMessages(messages, watermark);
 * // Returns only the first message as it's before the watermark
 * ```
 */
declare function getReadMessages<T extends {
    timestamp: number;
}>(messages: T[], watermark: number): T[];
/**
 * Helper function to get the count of read messages from a list
 *
 * @param messages - Array of messages with timestamp property
 * @param watermark - The watermark timestamp from the read event
 * @returns Number of messages that have been read
 *
 * @example
 * ```typescript
 * const messages = [
 *   { id: '1', timestamp: 1458668855000 },
 *   { id: '2', timestamp: 1458668857000 }
 * ];
 * const watermark = 1458668856253;
 *
 * const readCount = getReadMessageCount(messages, watermark);
 * // Returns 1
 * ```
 */
declare function getReadMessageCount<T extends {
    timestamp: number;
}>(messages: T[], watermark: number): number;
/**
 * Constants related to message reads functionality
 */
declare const MESSAGE_READS_CONSTANTS: {
    /** Webhook event type identifier */
    readonly EVENT_TYPE: "message_reads";
    /**
     * Property name in the webhook event that contains read data.
     * Used for type guards and event identification.
     */
    readonly READ_PROPERTY: "read";
};
/**
 * Type for the watermark timestamp
 * Represents a Unix timestamp in milliseconds indicating read status
 */
type WatermarkTimestamp = number;

/**
 * Facebook Messenger Platform - Messaging Postbacks Webhook Types
 *
 * These types represent the webhook event structure for messaging_postbacks events.
 * Triggered when a user clicks on a postback button, Get Started button, or persistent menu item.
 *
 * @see https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/messaging_postbacks
 */

/**
 * Represents referral information for postbacks that originated from external sources
 *
 * This object is included when a postback is triggered as part of a conversation
 * that was started via m.me links, Click to Messenger ads, Messenger QR codes,
 * or the Welcome Screen.
 */
interface PostbackReferral {
    /**
     * Arbitrary data that was included in the original referral.
     * This is the custom parameter you set when creating the referral link.
     */
    ref?: string;
    /**
     * Source of the referral. Indicates how the conversation was initiated.
     * Common values include:
     * - "SHORTLINK" - from m.me links
     * - "ADS" - from Click to Messenger ads
     * - "MESSENGER_CODE" - from Messenger QR codes
     */
    source?: string;
    ad_id?: string;
    ads_context_data?: {
        ad_title?: string;
        photo_url?: string;
        video_url?: string;
        post_id?: string;
    };
    /**
     * Type of referral action that initiated the conversation.
     * Common value is "OPEN_THREAD" for most referral types.
     */
    type?: string;
}
/**
 * Represents the postback data in a messaging postback webhook event
 */
interface PostbackData {
    /**
     * Message ID associated with the postback.
     * Unique identifier for the message that contained the postback button.
     */
    mid?: string;
    /**
     * Title of the postback button that was clicked.
     * This is the user-visible text that was displayed on the button.
     */
    title?: string;
    /**
     * Developer-defined payload that was associated with the postback button.
     * This contains the custom data you specified when creating the button.
     * Maximum length is 1000 characters.
     */
    payload: string;
    /**
     * Referral information if the postback is part of a referred conversation.
     * Only present when the conversation was initiated through external sources
     * like m.me links, ads, QR codes, or Welcome Screen.
     */
    referral?: PostbackReferral;
}
/**
 * Main webhook event structure for messaging postbacks with discriminator
 *
 * This event is triggered when a user interacts with postback buttons,
 * including regular postback buttons, Get Started button, and persistent menu items.
 *
 * @example
 * Basic postback from a button click:
 * ```json
 * {
 *   "type": "postback",
 *   "sender": {
 *     "id": "1234567890123456"
 *   },
 *   "recipient": {
 *     "id": "9876543210987654"
 *   },
 *   "timestamp": 1527459824,
 *   "postback": {
 *     "mid": "m_AG5Hz2Uq7tuwNEhXfYYKj8mJEM_QPpz5jdHtHaW",
 *     "title": "Get Started",
 *     "payload": "GET_STARTED_PAYLOAD"
 *   }
 * }
 * ```
 *
 * @example
 * Postback with referral data from m.me link:
 * ```json
 * {
 *   "type": "postback",
 *   "sender": {
 *     "user_ref": "unique_ref_param"
 *   },
 *   "recipient": {
 *     "id": "9876543210987654"
 *   },
 *   "timestamp": 1527459824,
 *   "postback": {
 *     "title": "Contact Sales",
 *     "payload": "CONTACT_SALES",
 *     "referral": {
 *       "ref": "landing_page_ad_campaign",
 *       "source": "SHORTLINK",
 *       "type": "OPEN_THREAD"
 *     }
 *   }
 * }
 * ```
 */
interface MessagingPostbackWebhookEvent extends BaseWebhookEvent {
    /** Discriminator for type narrowing */
    type: WebhookEventType.MESSAGING_POSTBACK;
    /** Details about the postback that was triggered */
    postback: PostbackData;
}
/**
 * Complete webhook payload structure that includes the messaging postback event
 * along with other webhook metadata
 */
interface MessagingPostbackWebhookPayload extends WebhookPayload<MessagingPostbackWebhookEvent> {
}
/**
 * Type guard to check if a webhook event is a messaging postback event
 *
 * @param event - The webhook event to check
 * @returns True if the event contains a postback property
 *
 * @example
 * ```typescript
 * if (isMessagingPostbackEvent(event)) {
 *   // TypeScript now knows event has postback property
 *   console.log(`User clicked: ${event.postback.title}`);
 *   console.log(`Payload: ${event.postback.payload}`);
 * }
 * ```
 */
declare function isMessagingPostbackEvent(event: any): event is MessagingPostbackWebhookEvent;
/**
 * Type guard to check if a postback event includes referral data
 *
 * @param event - The messaging postback event to check
 * @returns True if the event contains referral information
 *
 * @example
 * ```typescript
 * if (hasReferralData(event)) {
 *   // Handle referred conversation
 *   console.log(`Referred from: ${event.postback.referral.source}`);
 *   console.log(`Ref parameter: ${event.postback.referral.ref}`);
 * }
 * ```
 */
declare function hasReferralData(event: MessagingPostbackWebhookEvent): event is MessagingPostbackWebhookEvent & {
    postback: PostbackData & {
        referral: PostbackReferral;
    };
};
/**
 * Type guard to check if sender is identified (has PSID) vs anonymous (has user_ref)
 *
 * @param sender - The sender object to check
 * @returns True if sender has a PSID (is identified)
 *
 * @example
 * ```typescript
 * if (isIdentifiedSender(event.sender)) {
 *   // User has been identified and has a PSID
 *   console.log(`User PSID: ${event.sender.id}`);
 * } else {
 *   // Anonymous user with user_ref (likely from chat plugin)
 *   console.log(`Anonymous user ref: ${event.sender.user_ref}`);
 * }
 * ```
 */
declare function isIdentifiedSender(sender: WebhookSender): sender is WebhookSender & {
    id: string;
};
/**
 * Utility type for extracting just the postback data from a webhook event
 */
type PostbackEventData = PostbackData;
/**
 * Utility type for common postback properties that might be used in processing
 */
interface PostbackProcessingContext {
    /** The postback payload data */
    payload: string;
    /** The user who triggered the postback (PSID or user_ref) */
    senderId?: string;
    /** User reference for anonymous users */
    userRef?: string;
    /** The page that received the postback */
    recipientId: string;
    /** Button title if available */
    buttonTitle?: string;
    /** Message ID if available */
    messageId?: string;
    /** When the postback occurred */
    timestamp: number;
    /** Referral context if present */
    referralContext?: {
        ref?: string;
        source?: string;
        type?: string;
    };
    /** Whether this is from a referred conversation */
    isReferred: boolean;
    /** Whether the sender is identified (has PSID) */
    isIdentifiedUser: boolean;
}
/**
 * Helper function to extract processing context from a messaging postback event
 *
 * @param event - The messaging postback webhook event
 * @returns Simplified processing context with all relevant data
 *
 * @example
 * ```typescript
 * const context = extractPostbackContext(webhookEvent);
 *
 * if (context.isReferred) {
 *   console.log(`New conversation from ${context.referralContext?.source}`);
 * }
 *
 * if (context.isIdentifiedUser) {
 *   console.log(`Known user ${context.senderId} clicked: ${context.payload}`);
 * } else {
 *   console.log(`Anonymous user ${context.userRef} clicked: ${context.payload}`);
 * }
 * ```
 */
declare function extractPostbackContext(event: MessagingPostbackWebhookEvent): PostbackProcessingContext;
/**
 * Common postback payload patterns used in Messenger bots
 */
declare const COMMON_POSTBACK_PAYLOADS: {
    /** Get Started button payload */
    readonly GET_STARTED: "GET_STARTED";
    /** Main menu navigation */
    readonly MAIN_MENU: "MAIN_MENU";
    /** Help/Support options */
    readonly HELP: "HELP";
    readonly SUPPORT: "SUPPORT";
    /** Contact information */
    readonly CONTACT: "CONTACT";
    readonly CONTACT_SALES: "CONTACT_SALES";
    readonly CONTACT_SUPPORT: "CONTACT_SUPPORT";
    /** Navigation actions */
    readonly BACK: "BACK";
    readonly NEXT: "NEXT";
    readonly CANCEL: "CANCEL";
    /** User preferences */
    readonly SETTINGS: "SETTINGS";
    readonly PREFERENCES: "PREFERENCES";
};
/**
 * Constants related to postback events and constraints
 */
declare const POSTBACK_CONSTANTS: {
    /** Maximum payload length in characters */
    readonly MAX_PAYLOAD_LENGTH: 1000;
    /** Webhook event type identifier */
    readonly EVENT_TYPE: "postback";
    /** Common referral sources */
    readonly REFERRAL_SOURCES: {
        readonly SHORTLINK: "SHORTLINK";
        readonly ADS: "ADS";
        readonly MESSENGER_CODE: "MESSENGER_CODE";
    };
    /** Common referral types */
    readonly REFERRAL_TYPES: {
        readonly OPEN_THREAD: "OPEN_THREAD";
    };
};
/**
 * Type for postback payload values - can be custom strings or common patterns
 */
type PostbackPayload = string | typeof COMMON_POSTBACK_PAYLOADS[keyof typeof COMMON_POSTBACK_PAYLOADS];
/**
 * Type for referral sources
 */
type ReferralSource$1 = typeof POSTBACK_CONSTANTS.REFERRAL_SOURCES[keyof typeof POSTBACK_CONSTANTS.REFERRAL_SOURCES] | string;
/**
 * Type for referral types
 */
type ReferralType$1 = typeof POSTBACK_CONSTANTS.REFERRAL_TYPES[keyof typeof POSTBACK_CONSTANTS.REFERRAL_TYPES] | string;

/**
 * Facebook Messenger Platform - Customer Feedback Webhook Types
 *
 * These types represent the webhook event structure for messaging_feedback events.
 * Triggered when a user submits feedback through a Customer Feedback Template.
 *
 * @see https://developers.facebook.com/docs/messenger-platform/send-messages/templates/customer-feedback-template
 */

/**
 * Available feedback types for customer feedback templates
 */
declare enum FeedbackType {
    /** Customer Satisfaction - Score range 1-5 */
    CSAT = "csat",
    /** Net Promoter Score - Score range 0-10 */
    NPS = "nps",
    /** Customer Effort Score - Score range 1-7 */
    CES = "ces"
}
/**
 * Available display options for CSAT feedback type
 */
declare enum CSATDisplayOption {
    /** Numeric scale from 1 to 5 */
    ONE_TO_FIVE = "one_to_five",
    /** Five star rating display */
    FIVE_STARS = "five_stars",
    /** Five emoji rating display */
    FIVE_EMOJIS = "five_emojis"
}
/**
 * Available display options for NPS feedback type
 */
declare enum NPSDisplayOption {
    /** Numeric scale from 0 to 10 */
    ZERO_TO_TEN = "zero_to_ten"
}
/**
 * Available display options for CES feedback type
 */
declare enum CESDisplayOption {
    /** Numeric scale from 1 to 7 */
    ONE_TO_SEVEN = "one_to_seven"
}
/**
 * Follow-up feedback type for optional text input
 */
declare enum FollowUpType {
    /** Free-form text input (max 400 characters) */
    FREE_FORM = "free_form"
}

/**
 * Represents optional follow-up feedback data
 */
interface FeedbackFollowUp {
    /** Type of follow-up feedback - currently only supports free_form */
    type: FollowUpType.FREE_FORM;
    /**
     * User-provided text feedback.
     * Limited to 400 characters maximum.
     */
    payload: string;
}
/**
 * Represents individual question feedback data within a screen
 */
interface FeedbackQuestion {
    /**
     * Type of feedback question (CSAT, NPS, or CES).
     * Determines the scoring range and display format.
     */
    type: FeedbackType;
    /**
     * Numeric score provided by the user.
     * Range depends on feedback type:
     * - CSAT: 1-5
     * - NPS: 0-10
     * - CES: 1-7
     */
    payload: string;
    /**
     * Optional follow-up text feedback from the user.
     * Only present if the template included a text input field.
     */
    follow_up?: FeedbackFollowUp;
}
/**
 * Represents a feedback screen containing questions and responses
 */
interface FeedbackScreen {
    /**
     * Screen identifier within the feedback template.
     * Typically 0 for single-screen templates.
     */
    screen_id: number;
    /**
     * Map of question IDs to their corresponding feedback responses.
     * Question IDs are defined when creating the feedback template.
     */
    questions: Record<string, FeedbackQuestion>;
}
/**
 * Main messaging feedback data structure
 */
interface MessagingFeedbackData {
    /**
     * Array of feedback screens with user responses.
     * Each screen contains questions and their answers.
     */
    feedback_screens: FeedbackScreen[];
}
/**
 * Main webhook event structure for messaging feedback with discriminator
 *
 * This event is triggered when a user submits feedback through a
 * Customer Feedback Template. The webhook provides the user's
 * scores and optional text feedback.
 *
 * @example
 * ```json
 * {
 *   "type": "messaging_feedback",
 *   "sender": {
 *     "id": "1234567890123456"
 *   },
 *   "recipient": {
 *     "id": "9876543210987654"
 *   },
 *   "timestamp": 1458668856463,
 *   "messaging_feedback": {
 *     "feedback_screens": [{
 *       "screen_id": 0,
 *       "questions": {
 *         "satisfaction_q1": {
 *           "type": "csat",
 *           "payload": "4",
 *           "follow_up": {
 *             "type": "free_form",
 *             "payload": "Good service overall!"
 *           }
 *         }
 *       }
 *     }]
 *   }
 * }
 * ```
 */
interface MessagingFeedbackWebhookEvent extends BaseWebhookEvent {
    /** Discriminator for type narrowing */
    type: WebhookEventType.MESSAGING_FEEDBACK;
    /** The actual feedback data containing user responses */
    messaging_feedback: MessagingFeedbackData;
}
/**
 * Complete webhook payload structure that includes the messaging feedback event
 * along with other webhook metadata
 */
interface MessagingFeedbackWebhookPayload extends WebhookPayload<MessagingFeedbackWebhookEvent> {
}
/**
 * Type guard to check if a webhook event is a messaging feedback event
 *
 * @param event - The webhook event to check
 * @returns True if the event contains a messaging_feedback property
 *
 * @example
 * ```typescript
 * if (isMessagingFeedbackEvent(event)) {
 *   // TypeScript now knows event has messaging_feedback property
 *   console.log(`Received feedback with ${event.messaging_feedback.feedback_screens.length} screens`);
 * }
 * ```
 */
declare function isMessagingFeedbackEvent(event: any): event is MessagingFeedbackWebhookEvent;
/**
 * Utility type for common feedback properties that might be used in processing
 */
interface MessagingFeedbackProcessingContext {
    /** The user who submitted the feedback */
    senderId: string;
    /** The page that received the feedback */
    recipientId: string;
    /** When the feedback was submitted */
    submissionTimestamp: number;
    /** Total number of feedback screens */
    screenCount: number;
    /** All question responses flattened from all screens */
    allResponses: Array<{
        questionId: string;
        feedbackType: FeedbackType;
        score: number;
        textFeedback?: string;
        screenId: number;
    }>;
}
/**
 * Helper function to extract processing context from a messaging feedback event
 *
 * @param event - The messaging feedback webhook event
 * @returns Simplified processing context with flattened responses
 *
 * @example
 * ```typescript
 * const context = extractMessagingFeedbackContext(webhookEvent);
 * console.log(`User ${context.senderId} submitted ${context.allResponses.length} feedback responses`);
 * context.allResponses.forEach(response => {
 *   console.log(`${response.questionId}: ${response.score}/10 (${response.feedbackType})`);
 * });
 * ```
 */
declare function extractMessagingFeedbackContext(event: MessagingFeedbackWebhookEvent): MessagingFeedbackProcessingContext;
/**
 * Helper function to get feedback scores by type from an event
 *
 * @param event - The messaging feedback webhook event
 * @returns Map of feedback types to their scores
 *
 * @example
 * ```typescript
 * const scores = getFeedbackScoresByType(webhookEvent);
 * const csatScore = scores.get(FeedbackType.CSAT); // number | undefined
 * const npsScore = scores.get(FeedbackType.NPS);   // number | undefined
 * ```
 */
declare function getFeedbackScoresByType(event: MessagingFeedbackWebhookEvent): Map<FeedbackType, number[]>;
/**
 * Helper function to extract all text feedback from an event
 *
 * @param event - The messaging feedback webhook event
 * @returns Array of text feedback strings
 *
 * @example
 * ```typescript
 * const textFeedback = extractTextFeedback(webhookEvent);
 * textFeedback.forEach(feedback => {
 *   console.log(`User comment: "${feedback}"`);
 * });
 * ```
 */
declare function extractTextFeedback(event: MessagingFeedbackWebhookEvent): string[];
/**
 * Constants related to customer feedback constraints and limits
 */
declare const MESSAGING_FEEDBACK_CONSTANTS: {
    /** Maximum characters allowed in free-form text feedback */
    readonly MAX_TEXT_FEEDBACK_LENGTH: 400;
    /** Score ranges for different feedback types */
    readonly SCORE_RANGES: {
        readonly csat: {
            readonly min: 1;
            readonly max: 5;
        };
        readonly nps: {
            readonly min: 0;
            readonly max: 10;
        };
        readonly ces: {
            readonly min: 1;
            readonly max: 7;
        };
    };
    /** Template expiry constraints */
    readonly TEMPLATE_EXPIRY: {
        /** Minimum expiry days */
        readonly MIN_DAYS: 1;
        /** Maximum expiry days */
        readonly MAX_DAYS: 7;
        /** Default expiry days */
        readonly DEFAULT_DAYS: 1;
    };
    /** Question ID constraints */
    readonly QUESTION_ID: {
        /** Maximum length for question IDs */
        readonly MAX_LENGTH: 80;
        /** Valid characters pattern (alphanumeric) */
        readonly VALID_PATTERN: RegExp;
    };
    /** Template limits */
    readonly TEMPLATE_LIMITS: {
        /** Maximum number of titles per template */
        readonly MAX_TITLES: 1;
        /** Maximum number of scoring components per template */
        readonly MAX_SCORING_COMPONENTS: 1;
    };
    /** Webhook event type identifier */
    readonly EVENT_TYPE: "messaging_feedback";
};
/**
 * Validation helper to check if a score is valid for a given feedback type
 *
 * @param feedbackType - The type of feedback being validated
 * @param score - The score to validate
 * @returns True if the score is within the valid range for the feedback type
 *
 * @example
 * ```typescript
 * const isValid = isValidFeedbackScore(FeedbackType.CSAT, 4); // true
 * const isInvalid = isValidFeedbackScore(FeedbackType.NPS, 15); // false
 * ```
 */
declare function isValidFeedbackScore(feedbackType: FeedbackType, score: number): boolean;
/**
 * Validation helper to check if a question ID is valid
 *
 * @param questionId - The question ID to validate
 * @returns True if the question ID meets the format requirements
 *
 * @example
 * ```typescript
 * const isValid = isValidQuestionId('satisfaction_q1'); // true
 * const isInvalid = isValidQuestionId('invalid-id!'); // false
 * ```
 */
declare function isValidQuestionId(questionId: string): boolean;
/**
 * Validation helper to check if text feedback is within character limits
 *
 * @param textFeedback - The text feedback to validate
 * @returns True if the text is within the character limit
 *
 * @example
 * ```typescript
 * const isValid = isValidTextFeedback('Great service!'); // true
 * const isInvalid = isValidTextFeedback('a'.repeat(500)); // false
 * ```
 */
declare function isValidTextFeedback(textFeedback: string): boolean;

/**
 * Facebook Page - Feed Webhook Types
 *
 * These types represent the webhook event structure for feed events.
 * Triggered when there are changes to a Page's feed, such as Posts, shares,
 * likes, comments, etc. Webhooks are not sent for Ad Posts, but are sent
 * for Comments on Ad Posts. Notifications for Page likes will only be sent
 * for Pages that have fewer than 10K likes.
 *
 * @see https://developers.facebook.com/docs/graph-api/webhooks/reference/page/#feed
 */

/**
 * Enumeration of item types in feed events
 */
declare enum FeedItemType {
    ALBUM = "album",
    ADDRESS = "address",
    COMMENT = "comment",
    CONNECTION = "connection",
    COUPON = "coupon",
    EVENT = "event",
    EXPERIENCE = "experience",
    GROUP = "group",
    GROUP_MESSAGE = "group_message",
    INTEREST = "interest",
    LINK = "link",
    MENTION = "mention",
    MILESTONE = "milestone",
    NOTE = "note",
    PAGE = "page",
    PICTURE = "picture",
    PLATFORM_STORY = "platform-story",
    PHOTO = "photo",
    PHOTO_ALBUM = "photo-album",
    POST = "post",
    PROFILE = "profile",
    QUESTION = "question",
    RATING = "rating",
    REACTION = "reaction",
    RELATIONSHIP_STATUS = "relationship-status",
    SHARE = "share",
    STATUS = "status",
    STORY = "story",
    TIMELINE_COVER = "timeline cover",
    TAG = "tag",
    VIDEO = "video"
}
/**
 * Enumeration of action verbs in feed events
 */
declare enum FeedActionVerb {
    ADD = "add",
    BLOCK = "block",
    EDIT = "edit",
    EDITED = "edited",
    DELETE = "delete",
    FOLLOW = "follow",
    HIDE = "hide",
    MUTE = "mute",
    REMOVE = "remove",
    UNBLOCK = "unblock",
    UNHIDE = "unhide",
    UPDATE = "update"
}
/**
 * Sender information in feed events
 */
interface FeedSender {
    /** The ID of the sender */
    id: string;
    /** The name of the sender */
    name?: string;
}
/**
 * Page post additional information
 */
interface FeedPagePost {
    /** Type of the post (e.g., photo, video) */
    type?: string;
    /** Status type (e.g., added_photos) */
    status_type?: string;
    /** Whether the post is published */
    is_published?: boolean;
    /** Timestamp of when the post was last updated */
    updated_time?: string;
    /** Permanent static URL to the post */
    permalink_url?: string;
    /** Promotion status (e.g., inactive, extendable) */
    promotion_status?: string;
}
/**
 * Feed event value data
 */
interface FeedEventValue {
    /** Edited time (datetime) */
    edited_time?: string;
    /** The sender information */
    from?: FeedSender;
    /** Additional post content information */
    post?: FeedPagePost;
    /** Description of the type of a status update */
    status_type?: string;
    /** Whether a scheduled post was published */
    is_published?: boolean;
    /** The time the post was last updated */
    updated_time?: string;
    /** The permanent static URL to the post on facebook.com */
    permalink_url?: string;
    /** Whether the post is hidden or not */
    is_hidden?: boolean;
    /** The link to attached content */
    link?: string;
    /** The message that is part of the content */
    message?: string;
    /** The link to an attached photo */
    photo?: string;
    /** The IDs of the photos that were added to an album */
    photo_ids?: string[];
    /** The links to any attached photos */
    photos?: string[];
    /** The post ID */
    post_id?: string;
    /** The story—only logged for a milestone item */
    story?: string;
    /** The title—only logged for a milestone item */
    title?: string;
    /** The link to an attached video */
    video?: string;
    /** The code why the video is flagged */
    video_flag_reason?: number;
    /** The type of action taken */
    action?: string;
    /** The album ID */
    album_id?: string;
    /** The comment ID */
    comment_id?: string;
    /** The timestamp of when the object was created */
    created_time?: string;
    /** The ID of the event, if the feed post is an event creation story */
    event_id?: string;
    /** The type of item */
    item?: FeedItemType;
    /** The ID of the open graph object */
    open_graph_story_id?: string;
    /** The parent ID */
    parent_id?: string;
    /** The photo ID */
    photo_id?: string;
    /** The type of the user reaction */
    reaction_type?: string;
    /** Whether the post is published */
    published?: number;
    /** The recipient ID */
    recipient_id?: string;
    /** The share ID */
    share_id?: string;
    /** The type of action taken */
    verb?: FeedActionVerb;
    /** The video ID */
    video_id?: string;
}
/**
 * Main webhook event structure for feed events
 *
 * This event is triggered when there are changes to a Page's feed.
 * The webhook provides information about posts, comments, likes, shares, etc.
 *
 * @example Post created:
 * ```json
 * {
 *   "field": "feed",
 *   "value": {
 *     "from": {
 *       "id": "123456789",
 *       "name": "Page Name"
 *     },
 *     "post_id": "123456789_987654321",
 *     "verb": "add",
 *     "item": "post",
 *     "created_time": "1234567890",
 *     "message": "Hello World!"
 *   }
 * }
 * ```
 */
interface FeedWebhookEvent {
    /** Name of the updated field */
    field: 'feed';
    /** The contents of the update */
    value: FeedEventValue;
}
/**
 * Complete webhook payload structure for feed events
 */
interface FeedWebhookPayload extends PageWebhookPayload<FeedWebhookEvent> {
}
/**
 * Type guard to check if a webhook event is a feed event
 *
 * @param event - The webhook event to check
 * @returns True if the event is a feed event
 *
 * @example
 * ```typescript
 * if (isFeedEvent(event)) {
 *   console.log(`Feed event: ${event.value.verb} ${event.value.item}`);
 * }
 * ```
 */
declare function isFeedEvent(event: any): event is FeedWebhookEvent;
/**
 * Type guard to check if a feed event is a post creation
 *
 * @param value - The feed event value to check
 * @returns True if the event is a post creation
 */
declare function isPostCreated(value: FeedEventValue): boolean;
/**
 * Type guard to check if a feed event is a comment
 *
 * @param value - The feed event value to check
 * @returns True if the event is a comment
 */
declare function isComment(value: FeedEventValue): boolean;
/**
 * Type guard to check if a feed event is a photo
 *
 * @param value - The feed event value to check
 * @returns True if the event is a photo
 */
declare function isPhoto(value: FeedEventValue): boolean;
/**
 * Type guard to check if a feed event is a video
 *
 * @param value - The feed event value to check
 * @returns True if the event is a video
 */
declare function isVideo(value: FeedEventValue): boolean;
/**
 * Type guard to check if a feed event is a reaction
 *
 * @param value - The feed event value to check
 * @returns True if the event is a reaction
 */
declare function isReaction(value: FeedEventValue): boolean;
/**
 * Type guard to check if a feed event has a message
 *
 * @param value - The feed event value to check
 * @returns True if the event has a message
 */
declare function hasMessage(value: FeedEventValue): value is FeedEventValue & {
    message: string;
};
/**
 * Utility type for extracting just the feed event data
 */
type FeedEventData = FeedEventValue;
/**
 * Processing context for feed events
 */
interface FeedProcessingContext {
    /** The page ID */
    pageId: string;
    /** When the event occurred */
    timestamp: number;
    /** Human-readable datetime for the event timestamp */
    eventDate: Date;
    /** The sender information */
    sender?: FeedSender;
    /** Post ID if available */
    postId?: string;
    /** Comment ID if available */
    commentId?: string;
    /** The action verb */
    verb?: FeedActionVerb;
    /** The item type */
    item?: FeedItemType;
    /** Message content if available */
    message?: string;
    /** Whether this is a post creation */
    isPostCreated: boolean;
    /** Whether this is a comment */
    isComment: boolean;
    /** Whether this is a photo */
    isPhoto: boolean;
    /** Whether this is a video */
    isVideo: boolean;
    /** Whether this is a reaction */
    isReaction: boolean;
}
/**
 * Helper function to extract processing context from a feed event
 *
 * @param pageId - The page ID from the webhook entry
 * @param timestamp - The timestamp from the webhook entry
 * @param event - The feed webhook event
 * @returns Simplified processing context
 *
 * @example
 * ```typescript
 * const context = extractFeedContext(entry.id, entry.time, event);
 * console.log(`Feed event: ${context.verb} ${context.item}`);
 * if (context.isPostCreated) {
 *   console.log(`New post created: ${context.message}`);
 * }
 * ```
 */
declare function extractFeedContext(pageId: string, timestamp: number, event: FeedWebhookEvent): FeedProcessingContext;
/**
 * Helper function to extract all photos from a feed event
 *
 * @param value - The feed event value
 * @returns Array of photo URLs and IDs
 *
 * @example
 * ```typescript
 * const photos = extractPhotos(event.value);
 * console.log(`Found ${photos.length} photo(s)`);
 * ```
 */
declare function extractPhotos(value: FeedEventValue): Array<{
    url?: string;
    id?: string;
}>;
/**
 * Constants related to feed events
 */
declare const FEED_CONSTANTS: {
    /** Webhook field name */
    readonly FIELD_NAME: "feed";
    /** Maximum Page likes threshold for notifications */
    readonly MAX_PAGE_LIKES_FOR_NOTIFICATIONS: 10000;
};

/**
 * Facebook Page - Videos Webhook Types
 *
 * These types represent the webhook event structure for video encoding events.
 * Triggered when there are changes to the encoding status of a video on a page.
 *
 * @see https://developers.facebook.com/docs/graph-api/webhooks/reference/page/#videos
 */

/**
 * Enumeration of video encoding statuses
 */
declare enum VideoStatus {
    /** Video encoding is in progress */
    PROCESSING = "processing",
    /** Video encoding is complete and ready */
    READY = "ready",
    /** Video encoding failed */
    ERROR = "error"
}
/**
 * Video status information
 */
interface VideoStatusInfo {
    /** Current status of the video encoding */
    video_status: VideoStatus;
}
/**
 * Video event value data
 */
interface VideoEventValue {
    /** The ID of the video */
    id: string;
    /** Status information of the video encoding */
    status: VideoStatusInfo;
}
/**
 * Main webhook event structure for videos
 *
 * This event is triggered when there are changes to a video's encoding status.
 * The webhook provides information about the video processing state.
 *
 * @example Video processing:
 * ```json
 * {
 *   "field": "videos",
 *   "value": {
 *     "id": "123456789",
 *     "status": {
 *       "video_status": "processing"
 *     }
 *   }
 * }
 * ```
 *
 * @example Video ready:
 * ```json
 * {
 *   "field": "videos",
 *   "value": {
 *     "id": "123456789",
 *     "status": {
 *       "video_status": "ready"
 *     }
 *   }
 * }
 * ```
 *
 * @example Video error:
 * ```json
 * {
 *   "field": "videos",
 *   "value": {
 *     "id": "123456789",
 *     "status": {
 *       "video_status": "error"
 *     }
 *   }
 * }
 * ```
 */
interface VideoWebhookEvent {
    /** Name of the updated field */
    field: 'videos';
    /** The contents of the update */
    value: VideoEventValue;
}
/**
 * Complete webhook payload structure for video events
 */
interface VideoWebhookPayload extends PageWebhookPayload<VideoWebhookEvent> {
}
/**
 * Type guard to check if a webhook event is a video event
 *
 * @param event - The webhook event to check
 * @returns True if the event is a video event
 *
 * @example
 * ```typescript
 * if (isVideoEvent(event)) {
 *   console.log(`Video ${event.value.id} status: ${event.value.status.video_status}`);
 * }
 * ```
 */
declare function isVideoEvent(event: any): event is VideoWebhookEvent;
/**
 * Type guard to check if a video is processing
 *
 * @param value - The video event value to check
 * @returns True if the video is being processed
 */
declare function isProcessing$1(value: VideoEventValue): boolean;
/**
 * Type guard to check if a video is ready
 *
 * @param value - The video event value to check
 * @returns True if the video encoding is complete
 */
declare function isReady(value: VideoEventValue): boolean;
/**
 * Type guard to check if a video encoding failed
 *
 * @param value - The video event value to check
 * @returns True if the video encoding failed
 */
declare function hasError(value: VideoEventValue): boolean;
/**
 * Utility type for extracting just the video event data
 */
type VideoEventData = VideoEventValue;
/**
 * Processing context for video events
 */
interface VideoProcessingContext {
    /** The page ID */
    pageId: string;
    /** When the event occurred */
    timestamp: number;
    /** Human-readable datetime for the event timestamp */
    eventDate: Date;
    /** The video ID */
    videoId: string;
    /** Current video status */
    status: VideoStatus;
    /** Whether the video is being processed */
    isProcessing: boolean;
    /** Whether the video is ready */
    isReady: boolean;
    /** Whether the video encoding failed */
    hasError: boolean;
}
/**
 * Helper function to extract processing context from a video event
 *
 * @param pageId - The page ID from the webhook entry
 * @param timestamp - The timestamp from the webhook entry
 * @param event - The video webhook event
 * @returns Simplified processing context
 *
 * @example
 * ```typescript
 * const context = extractVideoContext(entry.id, entry.time, event);
 * console.log(`Video ${context.videoId} is ${context.status}`);
 * if (context.isReady) {
 *   console.log('Video is ready to play!');
 * } else if (context.hasError) {
 *   console.log('Video encoding failed');
 * }
 * ```
 */
declare function extractVideoContext(pageId: string, timestamp: number, event: VideoWebhookEvent): VideoProcessingContext;
/**
 * Helper function to determine if a status change is a transition to ready
 *
 * @param fromStatus - The previous status
 * @param toStatus - The new status
 * @returns True if this represents completing encoding
 *
 * @example
 * ```typescript
 * if (isCompletingEncoding(previousStatus, event.value.status.video_status)) {
 *   console.log('Video encoding just completed!');
 * }
 * ```
 */
declare function isCompletingEncoding(fromStatus: VideoStatus | undefined, toStatus: VideoStatus): boolean;
/**
 * Helper function to determine if a status change is a transition to error
 *
 * @param fromStatus - The previous status
 * @param toStatus - The new status
 * @returns True if this represents encoding failure
 *
 * @example
 * ```typescript
 * if (isEncodingFailed(previousStatus, event.value.status.video_status)) {
 *   console.log('Video encoding failed');
 * }
 * ```
 */
declare function isEncodingFailed(fromStatus: VideoStatus | undefined, toStatus: VideoStatus): boolean;
/**
 * Constants related to video events
 */
declare const VIDEO_CONSTANTS: {
    /** Webhook field name */
    readonly FIELD_NAME: "videos";
    /** All possible video statuses */
    readonly STATUSES: VideoStatus[];
};

/**
 * Facebook Messenger Platform - Live Videos Webhook Types
 *
 * These types represent the webhook event structure for live video events.
 * Triggered when there are changes to a page's live video status, such as
 * when a live video starts, ends, or has status updates.
 *
 * @see https://developers.facebook.com/docs/graph-api/webhooks/reference/page/#live_videos
 */

/**
 * Enumeration of live video broadcast statuses
 * Based on Facebook Graph API BroadcastStatus enum
 *
 * @see https://developers.facebook.com/docs/graph-api/reference/live-video/
 */
declare enum LiveVideoStatus {
    /** Live broadcast is currently streaming */
    LIVE = "LIVE",
    /** Live broadcast has stopped */
    LIVE_STOPPED = "LIVE_STOPPED",
    /** Live broadcast is currently being processed */
    PROCESSING = "PROCESSING",
    /** Scheduled broadcast was canceled */
    SCHEDULED_CANCELED = "SCHEDULED_CANCELED",
    /** Scheduled broadcast has expired */
    SCHEDULED_EXPIRED = "SCHEDULED_EXPIRED",
    /** Live broadcast is scheduled and published */
    SCHEDULED_LIVE = "SCHEDULED_LIVE",
    /** Live broadcast is scheduled but unpublished */
    SCHEDULED_UNPUBLISHED = "SCHEDULED_UNPUBLISHED",
    /** Live broadcast is unpublished */
    UNPUBLISHED = "UNPUBLISHED",
    /** Live broadcast video on demand (VOD) is ready */
    VOD = "VOD"
}
/**
 * Live video event value data
 */
interface LiveVideoEventValue {
    /** The ID of the live video */
    id: string;
    /** Status of the live video (enum value directly) */
    status: LiveVideoStatus;
}
/**
 * Main webhook event structure for live videos
 *
 * This event is triggered when there are changes to a page's live video status.
 * The webhook provides information about the live video state changes.
 *
 * @example Live video started:
 * ```json
 * {
 *   "field": "live_videos",
 *   "value": {
 *     "id": "123456789",
 *     "status": "LIVE"
 *   }
 * }
 * ```
 *
 * @example Live video ended:
 * ```json
 * {
 *   "field": "live_videos",
 *   "value": {
 *     "id": "123456789",
 *     "status": "LIVE_STOPPED"
 *   }
 * }
 * ```
 */
interface LiveVideoWebhookEvent {
    /** Name of the updated field */
    field: 'live_videos';
    /** The contents of the update */
    value: LiveVideoEventValue;
}
/**
 * Complete webhook payload structure for live video events
 */
interface LiveVideoWebhookPayload extends PageWebhookPayload<LiveVideoWebhookEvent> {
}
/**
 * Type guard to check if a webhook event is a live video event
 *
 * @param event - The webhook event to check
 * @returns True if the event is a live video event
 *
 * @example
 * ```typescript
 * if (isLiveVideoEvent(event)) {
 *   console.log(`Live video ${event.value.id} status: ${event.value.status}`);
 * }
 * ```
 */
declare function isLiveVideoEvent(event: any): event is LiveVideoWebhookEvent;
/**
 * Type guard to check if a live video is currently live
 *
 * @param value - The live video event value to check
 * @returns True if the live video is currently streaming
 */
declare function isLive(value: LiveVideoEventValue): boolean;
/**
 * Type guard to check if a live video is scheduled
 *
 * @param value - The live video event value to check
 * @returns True if the live video is scheduled
 */
declare function isScheduled(value: LiveVideoEventValue): boolean;
/**
 * Type guard to check if a live video is processing
 *
 * @param value - The live video event value to check
 * @returns True if the live video is being processed
 */
declare function isProcessing(value: LiveVideoEventValue): boolean;
/**
 * Type guard to check if a live video has ended
 *
 * @param value - The live video event value to check
 * @returns True if the live video has stopped, was cancelled, or expired
 */
declare function hasEnded(value: LiveVideoEventValue): boolean;
/**
 * Type guard to check if a live video VOD is ready
 *
 * @param value - The live video event value to check
 * @returns True if the video on demand is ready
 */
declare function isVODReady(value: LiveVideoEventValue): boolean;
/**
 * Utility type for extracting just the live video event data
 */
type LiveVideoEventData = LiveVideoEventValue;
/**
 * Processing context for live video events
 */
interface LiveVideoProcessingContext {
    /** The page ID */
    pageId: string;
    /** When the event occurred */
    timestamp: number;
    /** Human-readable datetime for the event timestamp */
    eventDate: Date;
    /** The live video ID */
    videoId: string;
    /** Current video status */
    status: LiveVideoStatus;
    /** Whether the video is currently live */
    isLive: boolean;
    /** Whether the video is scheduled */
    isScheduled: boolean;
    /** Whether the video is being processed */
    isProcessing: boolean;
    /** Whether the video has ended */
    hasEnded: boolean;
    /** Whether the VOD is ready */
    isVODReady: boolean;
}
/**
 * Helper function to extract processing context from a live video event
 *
 * @param pageId - The page ID from the webhook entry
 * @param timestamp - The timestamp from the webhook entry
 * @param event - The live video webhook event
 * @returns Simplified processing context
 *
 * @example
 * ```typescript
 * const context = extractLiveVideoContext(entry.id, entry.time, event);
 * console.log(`Live video ${context.videoId} is ${context.status}`);
 * if (context.isLive) {
 *   console.log('Stream is currently live!');
 * } else if (context.hasEnded) {
 *   console.log('Stream has ended');
 * }
 * ```
 */
declare function extractLiveVideoContext(pageId: string, timestamp: number, event: LiveVideoWebhookEvent): LiveVideoProcessingContext;
/**
 * Helper function to determine if a status change is a transition to live
 *
 * @param fromStatus - The previous status
 * @param toStatus - The new status
 * @returns True if this represents going live
 *
 * @example
 * ```typescript
 * if (isGoingLive(previousStatus, event.value.status)) {
 *   console.log('Video just went live!');
 * }
 * ```
 */
declare function isGoingLive(fromStatus: LiveVideoStatus | undefined, toStatus: LiveVideoStatus): boolean;
/**
 * Helper function to determine if a status change is a transition from live to ended
 *
 * @param fromStatus - The previous status
 * @param toStatus - The new status
 * @returns True if this represents ending a live stream
 *
 * @example
 * ```typescript
 * if (isEndingLive(previousStatus, event.value.status)) {
 *   console.log('Live stream has ended');
 * }
 * ```
 */
declare function isEndingLive(fromStatus: LiveVideoStatus | undefined, toStatus: LiveVideoStatus): boolean;
/**
 * Constants related to live video events
 */
declare const LIVE_VIDEO_CONSTANTS: {
    /** Webhook field name */
    readonly FIELD_NAME: "live_videos";
    /** All possible video statuses */
    readonly STATUSES: LiveVideoStatus[];
};

/**
 * Facebook Messenger Platform - Messages Webhook Types
 *
 * These types represent the webhook event structure for messages events.
 * Triggered when a user sends a message to your page.
 *
 * @see https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/messages
 */

/**
 * Enumeration of attachment types supported by the Messenger Platform
 */
declare enum AttachmentType {
    AUDIO = "audio",
    FILE = "file",
    IMAGE = "image",
    VIDEO = "video",
    FALLBACK = "fallback",
    REEL = "reel",
    IG_REEL = "ig_reel"
}
/**
 * Enumeration of referral types for message referrals
 */
declare enum ReferralType {
    OPEN_THREAD = "OPEN_THREAD",
    PRODUCT = "product",
    ADS = "ads"
}
/**
 * Enumeration of referral sources
 */
declare enum ReferralSource {
    MESSENGER_CODE = "MESSENGER_CODE",
    DISCOVER_TAB = "DISCOVER_TAB",
    ADS = "ADS",
    SHORTLINK = "SHORTLINK",
    CUSTOMER_CHAT_PLUGIN = "CUSTOMER_CHAT_PLUGIN"
}

/**
 * Represents a quick reply payload in a message
 */
interface QuickReply {
    /**
     * The payload string that was defined when the quick reply was sent.
     * Maximum 1000 characters.
     */
    payload: string;
}
/**
 * Represents the reply-to information when a message is a reply
 */
interface ReplyTo {
    /**
     * Message ID of the message being replied to
     */
    mid: string;
    is_self_reply?: boolean;
}
/**
 * Base attachment payload interface
 */
interface BaseAttachmentPayload {
    /** URL to the attachment file */
    url: string;
}
/**
 * Attachment payload for media files (audio, image, video, file)
 */
interface MediaAttachmentPayload extends BaseAttachmentPayload {
    /** URL to the attachment file */
    url: string;
    /** Title of the attachment, if available */
    title?: string;
}
/**
 * Attachment payload for sticker attachments
 */
interface StickerAttachmentPayload extends BaseAttachmentPayload {
    /** URL to the sticker image */
    url: string;
    /** Sticker ID for the sent sticker */
    sticker_id: number;
}
/**
 * Attachment payload for reel attachments (Instagram Reels, Facebook Reels)
 */
interface ReelAttachmentPayload extends BaseAttachmentPayload {
    /** URL to the reel */
    url: string;
    /** Video ID of the reel */
    reel_video_id?: number;
}
/**
 * Attachment payload for fallback attachments
 */
interface FallbackAttachmentPayload extends BaseAttachmentPayload {
    /** URL to the attachment */
    url: string;
    /** Title of the fallback attachment */
    title?: string;
}
/**
 * Union type for all possible attachment payload types
 */
type AttachmentPayload = MediaAttachmentPayload | StickerAttachmentPayload | ReelAttachmentPayload | FallbackAttachmentPayload;
/**
 * Represents an attachment in a message
 */
interface MessageAttachment {
    /** The type of attachment */
    type: AttachmentType;
    /** The attachment payload containing the actual attachment data */
    payload: AttachmentPayload;
}
/**
 * Represents referral data in a message (for referral campaigns, ads, etc.)
 */
interface MessageReferral {
    /** The source of the referral */
    source: ReferralSource;
    /** The type of referral */
    type: ReferralType;
    /**
     * The optional ref parameter passed in the referral.
     * Maximum 250 characters.
     */
    ref?: string;
    /**
     * URL of the website where the referral was triggered.
     * Only present for CUSTOMER_CHAT_PLUGIN source.
     */
    referer_uri?: string;
    /**
     * Indicates whether the referral is from a guest user.
     * Only present for CUSTOMER_CHAT_PLUGIN source.
     */
    is_guest_user?: boolean;
    /**
     * Product information for product referrals.
     * Only present when type is 'product'.
     */
    product?: {
        /** Product ID */
        id: string;
    };
    /**
     * Ad information for ad referrals.
     * Only present when type is 'ads'.
     */
    ads?: {
        /** Ad ID */
        id: string;
        /** Ad title */
        title?: string;
        /** Ad image URL */
        image_url?: string;
    };
}
/**
 * Represents a command in a message (for bot commands)
 */
interface MessageCommand {
    /** The name of the command */
    name: string;
}
/**
 * Represents the main message content in a webhook event
 */
interface Message {
    /**
     * Unique message identifier
     */
    mid: string;
    is_echo?: boolean;
    app_id?: string | number;
    metadata?: string;
    /**
     * Text content of the message.
     * Present for text messages and messages with quick replies.
     * Maximum 2000 UTF-8 characters.
     */
    text?: string;
    /**
     * Quick reply payload, if the message was sent as a response to a quick reply.
     * Only present when the user taps a quick reply button.
     */
    quick_reply?: QuickReply;
    /**
     * Reply-to information, if this message is a reply to another message.
     * Only present when the user replies to a specific message.
     */
    reply_to?: ReplyTo;
    /**
     * Array of attachments sent with the message.
     * Can include images, audio, video, files, location, etc.
     */
    attachments?: MessageAttachment[];
    /**
     * Referral information, if the message came from a referral.
     * Present when users click on ads, m.me links, etc.
     */
    referral?: MessageReferral;
    /**
     * Array of commands, if the message contains bot commands.
     * Present when users send commands like /start, /help, etc.
     */
    commands?: MessageCommand[];
}
/**
 * Main webhook event structure for messages with discriminator
 *
 * This event is triggered when a user sends a message to your page.
 * The webhook provides the message content and metadata.
 *
 * @example Text message:
 * ```json
 * {
 *   "type": "message",
 *   "sender": {
 *     "id": "1234567890123456"
 *   },
 *   "recipient": {
 *     "id": "9876543210987654"
 *   },
 *   "timestamp": 1458668856463,
 *   "message": {
 *     "mid": "mid.1458668856218:ed81099e15d3f4f233",
 *     "text": "Hello, world!"
 *   }
 * }
 * ```
 *
 * @example Message with attachment:
 * ```json
 * {
 *   "type": "message",
 *   "sender": {
 *     "id": "1234567890123456"
 *   },
 *   "recipient": {
 *     "id": "9876543210987654"
 *   },
 *   "timestamp": 1458668856463,
 *   "message": {
 *     "mid": "mid.1458668856218:ed81099e15d3f4f233",
 *     "attachments": [
 *       {
 *         "type": "image",
 *         "payload": {
 *           "url": "https://scontent.xx.fbcdn.net/v/image.jpg"
 *         }
 *       }
 *     ]
 *   }
 * }
 * ```
 *
 * @example Message with quick reply:
 * ```json
 * {
 *   "type": "message",
 *   "sender": {
 *     "id": "1234567890123456"
 *   },
 *   "recipient": {
 *     "id": "9876543210987654"
 *   },
 *   "timestamp": 1458668856463,
 *   "message": {
 *     "mid": "mid.1458668856218:ed81099e15d3f4f233",
 *     "text": "Yes",
 *     "quick_reply": {
 *       "payload": "YES_PAYLOAD"
 *     }
 *   }
 * }
 * ```
 */
interface MessageWebhookEvent extends BaseWebhookEvent {
    /** Discriminator for type narrowing */
    type: WebhookEventType.MESSAGE;
    /** The message content and metadata */
    message: Message;
}
/**
 * Complete webhook payload structure that includes the message event
 * along with other webhook metadata
 */
interface MessageWebhookPayload extends WebhookPayload<MessageWebhookEvent> {
}
/**
 * Type guard to check if a webhook event is a message event
 *
 * @param event - The webhook event to check
 * @returns True if the event contains a message property
 *
 * @example
 * ```typescript
 * if (isMessageEvent(event)) {
 *   // TypeScript now knows event has message property
 *   console.log(`Received message: ${event.message.text || '[attachment]'}`);
 * }
 * ```
 */
declare function isMessageEvent(event: any): event is MessageWebhookEvent;
/**
 * Type guard to check if a message has text content
 *
 * @param message - The message to check
 * @returns True if the message has text content
 */
declare function isTextMessage(message: Message): message is Message & {
    text: string;
};
/**
 * Type guard to check if a message has attachments
 *
 * @param message - The message to check
 * @returns True if the message has attachments
 */
declare function hasAttachments(message: Message): message is Message & {
    attachments: MessageAttachment[];
};
/**
 * Type guard to check if a message has a quick reply
 *
 * @param message - The message to check
 * @returns True if the message has a quick reply
 */
declare function hasQuickReply(message: Message): message is Message & {
    quick_reply: QuickReply;
};
/**
 * Type guard to check if a message is a reply to another message
 *
 * @param message - The message to check
 * @returns True if the message is a reply
 */
declare function isReplyMessage(message: Message): message is Message & {
    reply_to: ReplyTo;
};
/**
 * Type guard to check if a message has referral data
 *
 * @param message - The message to check
 * @returns True if the message has referral data
 */
declare function hasReferral(message: Message): message is Message & {
    referral: MessageReferral;
};
/**
 * Type guard to check if an attachment is a specific type
 *
 * @param attachment - The attachment to check
 * @param type - The attachment type to check for
 * @returns True if the attachment is of the specified type
 */
declare function isAttachmentType<T extends AttachmentType>(attachment: MessageAttachment, type: T): attachment is MessageAttachment & {
    type: T;
};
/**
 * Utility type for common message properties that might be used in processing
 */
interface MessageProcessingContext extends BaseProcessingContext {
    /** The message ID */
    messageId: string;
    /** Message text content, if available */
    text?: string;
    /** Whether the message has attachments */
    hasAttachments: boolean;
    /** Whether the message is a quick reply */
    isQuickReply: boolean;
    /** Whether the message is a reply to another message */
    isReply: boolean;
    /** Whether the message has referral data */
    hasReferral: boolean;
    /** Quick reply payload, if available */
    quickReplyPayload?: string;
    /** Replied message ID, if this is a reply */
    repliedToMessageId?: string;
}
/**
 * Helper function to extract processing context from a message event
 *
 * @param event - The message webhook event
 * @returns Simplified processing context
 *
 * @example
 * ```typescript
 * const context = extractMessageContext(webhookEvent);
 * console.log(`User ${context.senderId} sent: "${context.text || '[attachment]'}"`);
 * if (context.isQuickReply) {
 *   console.log(`Quick reply payload: ${context.quickReplyPayload}`);
 * }
 * ```
 */
declare function extractMessageContext(event: MessageWebhookEvent): MessageProcessingContext;
/**
 * Helper function to get attachments of a specific type from a message
 *
 * @param message - The message to extract attachments from
 * @param type - The attachment type to filter by
 * @returns Array of attachments of the specified type
 *
 * @example
 * ```typescript
 * const images = getAttachmentsByType(message, AttachmentType.IMAGE);
 * console.log(`Message contains ${images.length} image(s)`);
 * ```
 */
declare function getAttachmentsByType<T extends AttachmentType>(message: Message, type: T): Array<MessageAttachment & {
    type: T;
}>;
/**
 * Helper function to extract all URLs from message attachments
 *
 * @param message - The message to extract URLs from
 * @returns Array of attachment URLs
 *
 * @example
 * ```typescript
 * const urls = getAttachmentUrls(message);
 * console.log(`Message contains ${urls.length} attachment(s)`);
 * ```
 */
declare function getAttachmentUrls(message: Message): string[];
/**
 * Constants related to message limits and constraints
 */
declare const MESSAGE_CONSTANTS: {
    /** Maximum length of message text */
    readonly MAX_TEXT_LENGTH: 2000;
    /** Maximum length of quick reply payload */
    readonly MAX_QUICK_REPLY_PAYLOAD_LENGTH: 1000;
    /** Maximum length of referral ref parameter */
    readonly MAX_REFERRAL_REF_LENGTH: 250;
    /** Webhook event type identifier */
    readonly EVENT_TYPE: "message";
};
/**
 * Common attachment MIME types for validation
 */
declare const ATTACHMENT_MIME_TYPES: {
    readonly image: readonly ["image/jpeg", "image/png", "image/gif", "image/webp"];
    readonly video: readonly ["video/mp4", "video/avi", "video/quicktime", "video/webm"];
    readonly audio: readonly ["audio/mpeg", "audio/mp4", "audio/wav", "audio/ogg"];
    readonly file: readonly ["application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "text/plain"];
};

interface EchoMessage extends Message {
    is_echo: true;
    app_id?: string | number;
    metadata?: string;
}
interface MessageEchoWebhookEvent extends BaseWebhookEvent {
    type: WebhookEventType.MESSAGE_ECHO;
    message: EchoMessage;
}
interface MessageEchoWebhookPayload extends WebhookPayload<MessageEchoWebhookEvent> {
}

/**
 * Facebook Messenger Webhook Events - Main Entry Point
 *
 * This file provides the unified type system for all webhook events supported
 * by the Messenger Platform. It uses discriminated unions with proper type
 * narrowing to ensure type safety.
 *
 * @module webhooks/webhook-events
 */

/**
 * Discriminated union type of all possible webhook events.
 * Each event has a 'type' field that allows TypeScript to narrow the type.
 */
type MessengerWebhookEvent = MessageEditWebhookEvent | MessageReactionWebhookEvent | MessageWebhookEvent | MessageEchoWebhookEvent | MessageReadsWebhookEvent | MessagingFeedbackWebhookEvent | MessagingPostbackWebhookEvent;
/**
 * Union type of all possible webhook payloads
 */
type MessengerWebhookPayload = MessageEditWebhookPayload | MessageReactionWebhookPayload | MessageWebhookPayload | MessageEchoWebhookPayload | MessageReadsWebhookPayload | MessagingFeedbackWebhookPayload | MessagingPostbackWebhookPayload;
/**
 * Type guard to check webhook event type for a SINGLE event.
 * This function now properly handles individual events from the messaging array.
 *
 * @param event - A single webhook event from the messaging array
 * @returns The event type or null if unknown
 *
 * @example
 * ```typescript
 * const events = extractWebhookEvents(payload);
 * for (const event of events) {
 *   const eventType = getWebhookEventType(event);
 *   console.log(`Event type: ${eventType}`);
 * }
 * ```
 */
declare function getWebhookEventType(event: MessengerWebhookEvent | any): WebhookEventType | null;
/**
 * Extract event types from a complete webhook payload.
 * This is the correct function to use when processing the full webhook payload.
 *
 * @param payload - The complete webhook payload from Facebook
 * @returns Array of unique event types found in the payload
 *
 * @example
 * ```typescript
 * app.post('/webhook', (req, res) => {
 *   const payload = req.body;
 *   const eventTypes = getWebhookPayloadEventTypes(payload);
 *
 *   if (eventTypes.includes(WebhookEventType.MESSAGE)) {
 *     // Process message events
 *   }
 * });
 * ```
 */
declare function getWebhookPayloadEventTypes(payload: WebhookPayload): WebhookEventType[];
/**
 * Extract all events from a webhook payload.
 * This properly extracts individual events from the nested structure.
 *
 * @param payload - The complete webhook payload
 * @returns Array of individual webhook events
 *
 * @example
 * ```typescript
 * const events = extractWebhookEvents(payload);
 * events.forEach(event => {
 *   const type = getWebhookEventType(event);
 *   console.log(`Processing ${type} event`);
 * });
 * ```
 */
declare function extractWebhookEvents(payload: WebhookPayload): MessengerWebhookEvent[];
/**
 * Process webhook events by type with proper type narrowing.
 * This uses the discriminated union for automatic type narrowing.
 *
 * @param payload - The complete webhook payload
 * @param handlers - Object with handler functions for each event type
 *
 * @example
 * ```typescript
 * processWebhookEvents(payload, {
 *   onMessage: async (event) => {
 *     // TypeScript knows event is MessageWebhookEvent
 *     console.log(`Message: ${event.message.text}`);
 *   },
 *   onMessageEdit: async (event) => {
 *     // TypeScript knows event is MessageEditWebhookEvent
 *     console.log(`Edited to: ${event.message_edit.text}`);
 *   }
 * });
 * ```
 */
interface WebhookEventHandlers {
    onMessage?: (event: MessageWebhookEvent) => void | Promise<void>;
    onMessageEcho?: (event: MessageEchoWebhookEvent) => void | Promise<void>;
    onMessageEdit?: (event: MessageEditWebhookEvent) => void | Promise<void>;
    onMessageReaction?: (event: MessageReactionWebhookEvent) => void | Promise<void>;
    onMessageRead?: (event: MessageReadsWebhookEvent) => void | Promise<void>;
    onMessagingFeedback?: (event: MessagingFeedbackWebhookEvent) => void | Promise<void>;
    onMessagingPostback?: (event: MessagingPostbackWebhookEvent) => void | Promise<void>;
    onUnknown?: (event: any) => void | Promise<void>;
}
declare function processWebhookEvents(payload: WebhookPayload, handlers: WebhookEventHandlers): Promise<void>;
/**
 * Webhook verification parameters for subscription verification
 */
interface WebhookVerificationParams {
    'hub.mode': string;
    'hub.verify_token': string;
    'hub.challenge': string;
}
/**
 * Webhook signature verification result
 */
interface WebhookSignatureVerificationResult {
    isValid: boolean;
    error?: string;
}
/**
 * Verify webhook subscription during initial setup
 *
 * @param params - Query parameters from Facebook's verification request
 * @param verifyToken - Your webhook verify token
 * @returns The challenge string if valid, null if invalid
 *
 * @example
 * ```typescript
 * app.get('/webhook', (req, res) => {
 *   const challenge = verifyWebhookSubscription(req.query, process.env.VERIFY_TOKEN);
 *   if (challenge) {
 *     res.send(challenge);
 *   } else {
 *     res.status(403).send('Forbidden');
 *   }
 * });
 * ```
 */
declare function verifyWebhookSubscription(params: WebhookVerificationParams, verifyToken: string): string | null;
/**
 * Verify webhook signature from Facebook
 *
 * **Note**: This function requires Node.js crypto module and is only supported in server-side environments.
 * For browser environments, you should handle signature verification on your backend.
 *
 * @param rawBody - The raw request body as Buffer
 * @param signature - The X-Hub-Signature-256 header value from Facebook
 * @param appSecret - Your Facebook app secret
 * @returns Promise that resolves to verification result with validity and optional error message
 *
 * @example
 * ```typescript
 * import express from 'express';
 * import { verifyWebhookSignature } from '@warriorteam/messenger-sdk';
 *
 * app.post('/webhook', express.raw({type: 'application/json'}), async (req, res) => {
 *   const signature = req.get('X-Hub-Signature-256');
 *   const result = await verifyWebhookSignature(req.body, signature, process.env.APP_SECRET);
 *
 *   if (!result.isValid) {
 *     return res.status(401).json({error: result.error});
 *   }
 *
 *   // Process webhook...
 *   const payload = JSON.parse(req.body.toString());
 *   // Handle webhook events...
 * });
 * ```
 */
declare function verifyWebhookSignature(rawBody: Buffer, signature: string | undefined, appSecret: string): Promise<WebhookSignatureVerificationResult>;

declare class MessengerAPIError extends Error {
    readonly code: number;
    readonly type: string;
    readonly subcode?: number;
    readonly fbtrace_id?: string;
    readonly statusCode: number;
    readonly response?: any;
    constructor(error: MessengerError, statusCode: number, response?: any);
}
declare class MessengerNetworkError extends Error {
    readonly cause?: Error;
    constructor(message: string, cause?: Error);
}
declare class MessengerTimeoutError extends Error {
    readonly timeout: number;
    constructor(timeout: number);
}
declare class MessengerConfigError extends Error {
    constructor(message: string);
}

declare class TemplateValidationError extends Error {
    constructor(message: string);
}

declare class MessageValidationError extends Error {
    constructor(message: string);
}

declare const MESSAGE_LIMITS: {
    readonly TEXT_MESSAGE_MAX_CHARS: 2000;
};
declare const ATTACHMENT_LIMITS: {
    readonly IMAGE_MAX_SIZE: number;
    readonly OTHER_MAX_SIZE: number;
    readonly VIDEO_TIMEOUT: 75;
    readonly OTHER_TIMEOUT: 10;
};
declare const TEMPLATE_LIMITS: {
    readonly GENERIC_ELEMENTS_MAX: 10;
    readonly GENERIC_TITLE_MAX_CHARS: 80;
    readonly GENERIC_SUBTITLE_MAX_CHARS: 80;
    readonly BUTTON_TEXT_MAX_CHARS: 640;
    readonly BUTTONS_MAX_COUNT: 3;
    readonly BUTTON_TITLE_MAX_CHARS: 20;
    readonly POSTBACK_PAYLOAD_MAX_CHARS: 1000;
    readonly MEDIA_ELEMENTS_COUNT: 1;
    readonly MEDIA_BUTTONS_MAX_COUNT: 3;
};

export { ATTACHMENT_LIMITS, ATTACHMENT_MIME_TYPES, type AttachmentPayload, type AttachmentType$1 as AttachmentType, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsAPI, type Button, type ButtonTemplatePayload, CESDisplayOption, COMMON_POSTBACK_PAYLOADS, CSATDisplayOption, type Conversation, type ConversationDetail, type ConversationFolder, type Message$1 as ConversationMessage, type MessageAttachment$1 as ConversationMessageAttachment, type MessageReaction as ConversationMessageReaction, type ConversationParticipant, type ConversationPlatform, ConversationsAPI, type DefaultAction, type ErrorResponse, FEED_CONSTANTS, type FallbackAttachmentPayload, FeedActionVerb, type FeedEventData, type FeedEventValue, FeedItemType, type FeedPagePost, type FeedProcessingContext, type FeedSender, type FeedWebhookEvent, type FeedWebhookPayload, type FeedbackFollowUp, type FeedbackQuestion, type FeedbackScreen, FeedbackType, FollowUpType, type GenericTemplate, type GenericTemplateElement, type GenericTemplatePayload, type WebhookPayload as GenericWebhookPayload, type GetConversationParams, type GetMessageParams, type GetProfileRequest, type ImageData, LIVE_VIDEO_CONSTANTS, type ListConversationsParams, type ListConversationsResponse, type ListMessagesResponse, type LiveVideoEventData, type LiveVideoEventValue, type LiveVideoProcessingContext, LiveVideoStatus, type LiveVideoWebhookEvent, type LiveVideoWebhookPayload, MESSAGE_CONSTANTS, MESSAGE_EDIT_CONSTANTS, MESSAGE_LIMITS, MESSAGE_READS_CONSTANTS, MESSAGING_FEEDBACK_CONSTANTS, type MediaAttachmentPayload, type MediaTemplateElement, type MediaTemplatePayload, type Message$2 as Message, type MessageAttachment, type MessageAttachmentType, type MessageBasic, type MessageCommand, type MessageEdit, type MessageEditProcessingContext, type WebhookRecipient as MessageEditRecipient, type WebhookSender as MessageEditSender, type MessageEditWebhookEvent, type MessageEditWebhookPayload, type MessageParticipant, type MessageProcessingContext, MessageReactionAction, type MessageReactionData, type MessageReactionProcessingContext, type WebhookRecipient as MessageReactionRecipient, type WebhookSender as MessageReactionSender, type MessageReactionStats, MessageReactionType, type MessageReactionWebhookConfig, type MessageReactionWebhookEvent, type MessageReactionWebhookPayload, type MessageReadData, type MessageReadsProcessingContext, type MessageReadsWebhookEvent, type MessageReadsWebhookPayload, type WebhookRecipient as MessageRecipient, type MessageReferral, ReferralSource as MessageReferralSource, ReferralType as MessageReferralType, type WebhookSender as MessageSender, type MessageShare, type MessageTag, MessageValidationError, type MessageWebhookEvent, type MessageWebhookPayload, type MessagingFeedbackData, type MessagingFeedbackProcessingContext, type MessagingFeedbackWebhookEvent, type MessagingFeedbackWebhookPayload, type MessagingPostbackWebhookEvent, type MessagingPostbackWebhookPayload, type MessagingType, Messenger, MessengerAPIError, type MessengerConfig, MessengerConfigError, type MessengerError, MessengerNetworkError, MessengerTimeoutError, type MessengerWebhookEvent, type MessengerWebhookPayload, type ModerateConversationsRequest, type ModerateConversationsResponse, ModerationAPI, type ModerationAction, NPSDisplayOption, POSTBACK_CONSTANTS, type PageWebhookEntry, type PageWebhookPayload, type PostbackData, type PostbackEventData, type PostbackPayload, type PostbackProcessingContext, type WebhookRecipient as PostbackRecipient, type PostbackReferral, type WebhookSender as PostbackSender, type ProductTemplateElement, type ProductTemplatePayload, ProfileAPI, type ProfileField, type QuickReply$1 as QuickReply, type Recipient, type ReelAttachmentPayload, type ReferralSource$1 as ReferralSource, type ReferralType$1 as ReferralType, type ReplyInfo, type ReplyTo, SendAPI, type SendMessageRequest, type SendMessageResponse, type SenderAction, type ShareTemplatePayload, type SharedProduct, type StickerAttachmentPayload, type StoryShare, TEMPLATE_LIMITS, TemplateValidationError, TemplatesAPI, type UserId, type UserProfile, VIDEO_CONSTANTS, type VideoData, type VideoEventData, type VideoEventValue, type VideoProcessingContext, VideoStatus, type VideoStatusInfo, type VideoWebhookEvent, type VideoWebhookPayload, type WatermarkTimestamp, AttachmentType as WebhookAttachmentType, type WebhookEntry, type WebhookEventHandlers, WebhookEventType, type Message as WebhookMessage, type QuickReply as WebhookQuickReply, type WebhookSignatureVerificationResult, type WebhookVerificationParams, extractFeedContext, extractLiveVideoContext, extractMessageContext, extractMessageEditContext, extractMessageReadsContext, extractMessagingFeedbackContext, extractPageEvents, extractPhotos, extractPostbackContext, extractTextFeedback, extractVideoContext, extractWebhookEvents, getAttachmentUrls, getAttachmentsByType, getFeedbackScoresByType, getPageWebhookEventTypes, getReadMessageCount, getReadMessages, getWebhookEventType, getWebhookPayloadEventTypes, hasAttachments, hasEnded, hasMessage, hasQuickReply, hasReferral, hasReferralData, isAttachmentType, isComment, isCompletingEncoding, isEncodingFailed, isEndingLive, isFeedEvent, isVideo as isFeedVideo, isGoingLive, isIdentifiedSender, isLive, isLiveVideoEvent, isProcessing as isLiveVideoProcessing, isMessageEditEvent, isMessageEvent, isMessageRead, isMessageReadsEvent, isMessagingFeedbackEvent, isMessagingPostbackEvent, isPhoto, isPostCreated, isReaction, isReplyMessage, isScheduled, isTextMessage, isVODReady, isValidFeedbackScore, isValidQuestionId, isValidTextFeedback, isVideoEvent, isProcessing$1 as isVideoProcessing, isReady as isVideoReady, processWebhookEvents, verifyWebhookSignature, verifyWebhookSubscription, hasError as videoHasError };
