import { MESSENGER } from '../constant'; import type { PSIDTarget, UserRefTarget } from '../types'; /** * @category Event Mixin */ export interface EventBase { readonly platform: typeof MESSENGER; /** Indicate whether the event is sent to a standby channel. */ readonly isStandby: boolean; /** Indicate whether the event is an echo. */ readonly isEcho: boolean; /** The user that triggered the webhook event. */ readonly sender: PSIDTarget | UserRefTarget; readonly timestamp: number; readonly [Symbol.toStringTag]: 'MessengerEvent'; } export declare const EventBase: EventBase; /** * @category Event Mixin */ export interface Message { /** Message ID. */ readonly messageId: string; /** Reference to the message id (mid) that this message is replying to. */ readonly replyTo: undefined | string; /** * Reference to the product id when the user sends a message from Facebook * Shops product detail page. */ readonly referralProductId: undefined | string; } export declare const Message: Message; /** * @category Event Mixin */ export interface Text { /** Text of message. */ readonly text: string; } export declare const Text: Text; /** * @category Event Mixin */ export interface Fallback { /** The fallback payload. */ readonly fallback: undefined | { title: string; url: string; }; } export declare const Fallback: Fallback; /** * @category Event Mixin */ export interface Media { /** URL of the attachment type. */ readonly url: string; } export declare const Media: Media; /** * @category Event Mixin */ export interface Sticker { /** Persistent id of the sticker if a sticker is sent. */ readonly stickerId: undefined | number; } export declare const Sticker: Sticker; /** * @category Event Mixin */ export interface QuickReply { /** Custom data provided by the app with the quick_reply. */ readonly data: string; } export declare const QuickReply: QuickReply; /** * @category Event Mixin */ export interface NLP { /** The raw nlp object. */ readonly nlp?: any; } export declare const NLP: NLP; /** * @category Event Mixin */ export interface Location { readonly latitude: number; readonly longitude: number; } export declare const Location: Location; declare type ReactionType = 'smile' | 'angry' | 'sad' | 'wow' | 'love' | 'like' | 'dislike' | 'other'; /** * @category Event Mixin */ export interface Reaction { /** Text description of the reaction. */ readonly reactionType: ReactionType; /** Reference to the emoji corresponding to the reaction. */ readonly emoji: string; /** Action performed by the user. */ readonly action: 'react' | 'unreact'; /** Reference to the Message ID that the user performed the reaction on. */ readonly messageId: string; } export declare const Reaction: Reaction; /** * @category Event Mixin */ export interface TemplateProduct { readonly products: { id: string; retailerId: string; imageUrl: string; title: string; subtitle: string; }[]; } export declare const TemplateProduct: TemplateProduct; /** * @category Event Mixin */ export interface Delivery { /** * Array containing message IDs of messages that were delivered. Field may not * be present. */ readonly messageIds: undefined | string[]; /** All messages that were sent before this timestamp were delivered. */ readonly watermark: number; } export declare const Delivery: Delivery; /** * @category Event Mixin */ export interface Read { /** All messages that were sent before or at this timestamp were read. */ readonly watermark: number; } export declare const Read: Read; /** * @category Event Mixin */ export interface Echo { /** Indicate whether the event is an echo. */ readonly isEcho: boolean; /** ID of the app from which the message was sent. */ readonly appId: string; /** * Custom string passed to the Send API as the metadata field. Only present * if the metadata property was set in the original message. */ readonly metadata: undefined | string; } export declare const Echo: Echo; /** * @category Event Mixin */ export interface Standby { /** Indicate whether the event is sent to a standby channel. */ readonly isStandby: boolean; } export declare const Standby: Standby; /** * @category Event Mixin */ export interface AccountLinking { /** Indicate whether the user linked or unlinked their account. */ readonly status: 'linked' | 'unlinked'; /** * Value of pass-through `authorization_code` provided in the Account Linking * flow. */ readonly authorizationCode: string; } export declare const AccountLinking: AccountLinking; /** * @category Event Mixin */ export interface GamePlay { /** App ID of the game */ readonly gameId: string; /** ID of the user in the Instant Game name-space. By linking this ID to the PSID received in the sender field, the bot can send messages to a user after a game play */ readonly playerId: string; /** Type of the social context a game is played in */ readonly contextType: 'SOLO' | 'THREAD' | 'GROUP'; /** ID of the context if not a SOLO type. This ID is in the Instant Game name-space */ readonly contextId: string; /** Best score achieved by this user in this game round. Only available to Classic score based games */ readonly score: undefined | number; /** JSON encoded payload data, set using FBInstant.setSessionData(). Only available to game with Rich Games Feature enabled */ readonly data: undefined | string; } export declare const GamePlay: GamePlay; /** * @category Event Mixin */ export interface PassThreadControl { /** App ID that thread control is passed to. */ readonly newOwnerAppId: string; /** Custom string specified in the API request. */ readonly metadata: string; } export declare const PassThreadControl: PassThreadControl; /** * @category Event Mixin */ export interface TakeThreadControl { /** App ID that thread control was taken from. */ readonly previousOwnerAppId: string; /** Custom string specified in the API request. */ readonly metadata: string; } export declare const TakeThreadControl: TakeThreadControl; /** * @category Event Mixin */ export interface RequestThreadControl { /** App ID of the Secondary Receiver that is requesting thread control. */ readonly requestedOwnerAppId: string; /** Custom string specified in the API request. */ readonly metadata: string; } export declare const RequestThreadControl: RequestThreadControl; /** * @category Event Mixin */ export interface AppRoles { /** The app id and roles mapping object. */ readonly appRoles: { [id: string]: string[]; }; } export declare const AppRoles: AppRoles; /** * @category Event Mixin */ export interface Optin { /** The `data-ref` attribute that was defined with the entry point. */ readonly dataRef: string; /** * [Checkbox plugin](https://developers.facebook.com/docs/messenger-platform/discovery/checkbox-plugin) * only. user_ref attribute that was defined in the checkbox plugin include. */ readonly userRef: undefined | string; } export declare const Optin: Optin; /** * @category Event Mixin */ export interface OneTimeNotifOptin { /** The payload attached with the request message */ readonly data: string; /** The token to send one time notification with */ readonly token: string; } export declare const OneTimeNotifOptin: OneTimeNotifOptin; /** * @category Event Mixin */ export interface PolicyEnforcement { readonly action: 'warning' | 'block' | 'unblock'; /** * The reason for being warned or blocked. This field is absent if `action` is * `'unblock'`. */ readonly reason: undefined | string; } export declare const PolicyEnforcement: PolicyEnforcement; declare type ReferralSource = 'MESSENGER_CODE' | 'DISCOVER_TAB' | 'ADS' | 'SHORTLINK' | 'CUSTOMER_CHAT_PLUGIN'; declare type RawReferral = { source: ReferralSource; type: 'OPEN_THREAD'; ref: string; ad_id: undefined | string; referer_uri: undefined | string; is_guest_user: undefined | boolean; }; /** * @category Event Mixin */ export interface Referral { /** The source of the referral. */ readonly source: ReferralSource; /** The optional `ref` attribute set in the referrer. */ readonly ref: string; /** Id of ad if `source` is `'ADS'` */ readonly adId: undefined | string; /** * The URI of the site where the message was sent in the Facebook chat plugin. */ readonly refererUri: undefined | string; /** * A flag indicating whether the user is a guest user from Facebook Chat * Plugin. */ readonly isGuestUser: boolean; } export declare const Referral: Referral; /** * @category Event Mixin */ export interface Postback { /** * Title for the CTA that was clicked on. This is sent to all apps subscribed * to the page. For apps other than the original CTA sender, the postback * event will be delivered via the standby channel. */ readonly title: string; /** * Payload parameter that was defined with the button. This is only visible to * the app that send the original template message. */ readonly data: string; /** Referral information for how the user got into the thread. */ readonly referral: undefined | RawReferral; /** The source of the referral if referral exist. */ readonly referralSource: undefined | ReferralSource; /** The optional `ref` attribute set in the referrer if referral exist. */ readonly referralRef: undefined | string; /** Id of ad if `referral.source` is `'ADS'`. */ readonly referralAdId: undefined | string; } export declare const Postback: Postback; export {};