///
import type { NativeComponent, EventMiddleware, DispatchMiddleware, PlatformUtilities, MachinatNode } from '@machinat/core';
import type { DispatchFrame, DispatchResponse } from '@machinat/core/engine';
import type { MaybeContainer } from '@machinat/core/service';
import type { IntermediateSegment } from '@machinat/core/renderer';
import type { WebhookMetadata } from '@machinat/http/webhook';
import type { MessengerBot } from './Bot';
import type MessengerChat from './Chat';
import type SendTarget from './SendTarget';
import type { MessengerEvent } from './event/types';
import type { API_PATH, ATTACHMENT_DATA, ATTACHMENT_INFO } from './constant';
export * from './event/types';
export declare type MessengerChannel = MessengerChat | SendTarget;
export declare type PSIDTarget = {
id: string;
};
export declare type UserRefTarget = {
user_ref: string;
};
export declare type PostPrivateReplyTarget = {
post_id: string;
};
export declare type CommentPrivateReplyTarget = {
comment_id: string;
};
export declare type MessengerTarget = PSIDTarget | UserRefTarget | PostPrivateReplyTarget | CommentPrivateReplyTarget;
export declare type MessengerRawEvent = any;
export declare type RawMessage = any;
declare type MessagingType = 'RESPONSE' | 'UPDATE' | 'MESSAGE_TAG';
declare type NotificationType = 'REGULAR' | 'SILENT_PUSH' | 'NO_PUSH';
declare type MessageTags = 'CONFIRMED_EVENT_UPDATE' | 'POST_PURCHASE_UPDATE' | 'ACCOUNT_UPDATE' | 'HUMAN_AGENT';
export declare type FileInfo = {
filename?: string;
filepath?: string;
contentType?: string;
knownLength?: number;
};
export declare type MessageValue = {
message: RawMessage;
messaging_type?: MessagingType;
notification_type?: NotificationType;
tag?: MessageTags;
persona_id?: string;
[ATTACHMENT_DATA]?: string | Buffer | NodeJS.ReadableStream;
[ATTACHMENT_INFO]?: FileInfo;
};
export declare type SenderActionValue = {
sender_action: 'mark_seen' | 'typing_on' | 'typing_off';
};
export declare type PassThreadControlValue = {
target_app_id: number;
metadata?: string;
[API_PATH]: any;
};
export declare type RequestThreadControlValue = {
metadata?: string;
[API_PATH]: any;
};
export declare type TakeThreadControlValue = RequestThreadControlValue;
export declare type HandoverProtocolValue = PassThreadControlValue | RequestThreadControlValue | TakeThreadControlValue;
export declare type MessengerSegmentValue = MessageValue | SenderActionValue | HandoverProtocolValue;
export declare type MessengerComponent = IntermediateSegment> = NativeComponent;
export declare type BatchApiRequest = {
method: string;
relative_url: string;
body: null | any;
name?: string;
depends_on?: string;
attached_files?: string;
omit_response_on_success?: boolean;
};
export declare type MessengerJob = {
request: BatchApiRequest;
key?: string;
assetTag?: string;
fileData?: string | Buffer | NodeJS.ReadableStream;
fileInfo?: {
filename?: string;
filepath?: string;
contentType?: string;
knownLength?: number;
};
};
export declare type FbGraphApiResult = Record;
export declare type MessengerResult = {
code: number;
headers: Record;
body: FbGraphApiResult;
};
export declare type GraphApiErrorInfo = {
message: string;
type: string;
code: number;
error_subcode: number;
fbtrace_id: string;
};
export declare type GraphApiErrorBody = {
error: GraphApiErrorInfo;
};
export declare type RawUserProfile = {
id: string;
name: string;
first_name: string;
last_name: string;
profile_pic: string;
locale?: string;
timezone?: number;
gender?: string;
};
export declare type MessengerDispatchResponse = DispatchResponse;
export declare type MessengerEventContext = {
platform: 'messenger';
event: MessengerEvent;
metadata: WebhookMetadata;
bot: MessengerBot;
reply(message: MachinatNode): Promise;
};
export declare type MessengerEventMiddleware = EventMiddleware;
export declare type MessengerDispatchFrame = DispatchFrame;
export declare type MessengerDispatchMiddleware = DispatchMiddleware;
export declare type MessengerConfigs = {
/** The Facebook page id */
pageId: string;
/** The page access token for the app */
accessToken: string;
/** The Facebook app secret */
appSecret?: string;
/** To verify the webhook request by the signature or not. Default to `true` */
shouldVerifyRequest?: boolean;
/** To handle the webhook challenge request or not. Default to `true` */
shouldHandleChallenge?: boolean;
/** The secret string to verify the webhook challenge request */
verifyToken?: string;
/** The webhook path to receive events. Default to `/` */
webhookPath?: string;
/** The graph API version to make API calls */
graphApiVersion?: string;
/** Request additional info of user profile. This requires addtional permisions of your app */
optionalProfileFields?: ('locale' | 'timezone' | 'gender')[];
apiBatchRequestInterval?: number;
eventMiddlewares?: MaybeContainer[];
dispatchMiddlewares?: MaybeContainer[];
};
export declare type MessengerSendOptions = {
messagingType?: MessagingType;
tag?: string;
notificationType?: NotificationType;
personaId?: string;
oneTimeNotifToken?: string;
};
export declare type MessengerPlatformUtilities = PlatformUtilities;