@ariaflowagents/messaging-meta 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +236 -0
- package/dist/graph-api/client.d.ts +125 -0
- package/dist/graph-api/client.d.ts.map +1 -0
- package/dist/graph-api/client.js +204 -0
- package/dist/graph-api/client.js.map +1 -0
- package/dist/graph-api/errors.d.ts +41 -0
- package/dist/graph-api/errors.d.ts.map +1 -0
- package/dist/graph-api/errors.js +72 -0
- package/dist/graph-api/errors.js.map +1 -0
- package/dist/graph-api/index.d.ts +15 -0
- package/dist/graph-api/index.d.ts.map +1 -0
- package/dist/graph-api/index.js +11 -0
- package/dist/graph-api/index.js.map +1 -0
- package/dist/graph-api/rate-limiter.d.ts +90 -0
- package/dist/graph-api/rate-limiter.d.ts.map +1 -0
- package/dist/graph-api/rate-limiter.js +172 -0
- package/dist/graph-api/rate-limiter.js.map +1 -0
- package/dist/graph-api/retry.d.ts +55 -0
- package/dist/graph-api/retry.d.ts.map +1 -0
- package/dist/graph-api/retry.js +103 -0
- package/dist/graph-api/retry.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/instagram/client.d.ts +365 -0
- package/dist/instagram/client.d.ts.map +1 -0
- package/dist/instagram/client.js +857 -0
- package/dist/instagram/client.js.map +1 -0
- package/dist/instagram/format.d.ts +62 -0
- package/dist/instagram/format.d.ts.map +1 -0
- package/dist/instagram/format.js +92 -0
- package/dist/instagram/format.js.map +1 -0
- package/dist/instagram/ice-breakers.d.ts +63 -0
- package/dist/instagram/ice-breakers.d.ts.map +1 -0
- package/dist/instagram/ice-breakers.js +87 -0
- package/dist/instagram/ice-breakers.js.map +1 -0
- package/dist/instagram/index.d.ts +44 -0
- package/dist/instagram/index.d.ts.map +1 -0
- package/dist/instagram/index.js +46 -0
- package/dist/instagram/index.js.map +1 -0
- package/dist/instagram/types.d.ts +188 -0
- package/dist/instagram/types.d.ts.map +1 -0
- package/dist/instagram/types.js +19 -0
- package/dist/instagram/types.js.map +1 -0
- package/dist/messenger/client.d.ts +339 -0
- package/dist/messenger/client.d.ts.map +1 -0
- package/dist/messenger/client.js +782 -0
- package/dist/messenger/client.js.map +1 -0
- package/dist/messenger/format.d.ts +69 -0
- package/dist/messenger/format.d.ts.map +1 -0
- package/dist/messenger/format.js +98 -0
- package/dist/messenger/format.js.map +1 -0
- package/dist/messenger/index.d.ts +34 -0
- package/dist/messenger/index.d.ts.map +1 -0
- package/dist/messenger/index.js +35 -0
- package/dist/messenger/index.js.map +1 -0
- package/dist/messenger/types.d.ts +181 -0
- package/dist/messenger/types.d.ts.map +1 -0
- package/dist/messenger/types.js +10 -0
- package/dist/messenger/types.js.map +1 -0
- package/dist/server.d.ts +31 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +29 -0
- package/dist/server.js.map +1 -0
- package/dist/webhook/index.d.ts +10 -0
- package/dist/webhook/index.d.ts.map +1 -0
- package/dist/webhook/index.js +8 -0
- package/dist/webhook/index.js.map +1 -0
- package/dist/webhook/normalizer.d.ts +169 -0
- package/dist/webhook/normalizer.d.ts.map +1 -0
- package/dist/webhook/normalizer.js +301 -0
- package/dist/webhook/normalizer.js.map +1 -0
- package/dist/webhook/verifier.d.ts +45 -0
- package/dist/webhook/verifier.d.ts.map +1 -0
- package/dist/webhook/verifier.js +62 -0
- package/dist/webhook/verifier.js.map +1 -0
- package/dist/whatsapp/client.d.ts +481 -0
- package/dist/whatsapp/client.d.ts.map +1 -0
- package/dist/whatsapp/client.js +1043 -0
- package/dist/whatsapp/client.js.map +1 -0
- package/dist/whatsapp/flows.d.ts +74 -0
- package/dist/whatsapp/flows.d.ts.map +1 -0
- package/dist/whatsapp/flows.js +77 -0
- package/dist/whatsapp/flows.js.map +1 -0
- package/dist/whatsapp/format.d.ts +78 -0
- package/dist/whatsapp/format.d.ts.map +1 -0
- package/dist/whatsapp/format.js +195 -0
- package/dist/whatsapp/format.js.map +1 -0
- package/dist/whatsapp/index.d.ts +39 -0
- package/dist/whatsapp/index.d.ts.map +1 -0
- package/dist/whatsapp/index.js +42 -0
- package/dist/whatsapp/index.js.map +1 -0
- package/dist/whatsapp/split.d.ts +35 -0
- package/dist/whatsapp/split.d.ts.map +1 -0
- package/dist/whatsapp/split.js +76 -0
- package/dist/whatsapp/split.js.map +1 -0
- package/dist/whatsapp/templates.d.ts +129 -0
- package/dist/whatsapp/templates.d.ts.map +1 -0
- package/dist/whatsapp/templates.js +125 -0
- package/dist/whatsapp/templates.js.map +1 -0
- package/dist/whatsapp/types.d.ts +440 -0
- package/dist/whatsapp/types.d.ts.map +1 -0
- package/dist/whatsapp/types.js +11 -0
- package/dist/whatsapp/types.js.map +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module instagram/types
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive TypeScript types for the Instagram Messaging API.
|
|
5
|
+
*
|
|
6
|
+
* These types cover configuration, message payloads (text, image, quick replies,
|
|
7
|
+
* generic templates, button templates), ice breakers, private replies, and API
|
|
8
|
+
* response shapes.
|
|
9
|
+
*
|
|
10
|
+
* Key differences from WhatsApp / Messenger:
|
|
11
|
+
* - Base URL is `graph.instagram.com` (not `graph.facebook.com`).
|
|
12
|
+
* - Only IMAGE attachments are supported (no video, audio, or file).
|
|
13
|
+
* - Message limit is 1000 bytes (UTF-8), not characters.
|
|
14
|
+
* - Send response contains `message_id` only (no `recipient_id`).
|
|
15
|
+
* - Only `HUMAN_AGENT` message tag is supported (7-day window).
|
|
16
|
+
* - Ice breakers replace persistent menus.
|
|
17
|
+
*/
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/instagram/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module messenger/client
|
|
3
|
+
*
|
|
4
|
+
* Facebook Messenger Platform client implementing the {@link PlatformClient}
|
|
5
|
+
* interface from `@ariaflowagents/messaging`.
|
|
6
|
+
*
|
|
7
|
+
* Provides a complete, production-ready integration with Meta's Messenger
|
|
8
|
+
* Platform including:
|
|
9
|
+
*
|
|
10
|
+
* - Sending text, media, interactive (button/generic templates), and quick replies
|
|
11
|
+
* - Webhook handling with signature verification
|
|
12
|
+
* - Sender actions (typing indicators, mark-seen)
|
|
13
|
+
* - User profile retrieval
|
|
14
|
+
* - Persona management (create, delete)
|
|
15
|
+
* - Media upload and download
|
|
16
|
+
* - Messenger-specific format conversion (plain text)
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { createMessengerClient } from '@ariaflowagents/messaging-meta/messenger';
|
|
21
|
+
*
|
|
22
|
+
* const client = createMessengerClient({
|
|
23
|
+
* pageAccessToken: process.env.MESSENGER_PAGE_ACCESS_TOKEN!,
|
|
24
|
+
* appSecret: process.env.META_APP_SECRET!,
|
|
25
|
+
* pageId: process.env.MESSENGER_PAGE_ID!,
|
|
26
|
+
* verifyToken: process.env.MESSENGER_VERIFY_TOKEN!,
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* client.onMessage(async (msg) => {
|
|
30
|
+
* await client.sendText(msg.from.id, `Echo: ${msg.text}`);
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
import type { PlatformClient, SendResult, MediaPayload, MediaHandle, MediaDownload, MediaUploadOptions, InteractiveMessage, MessageHandler, StatusHandler, ReactionHandler, FormatConverter } from '@ariaflowagents/messaging';
|
|
35
|
+
import type { NormalizedMessage } from '../webhook/normalizer.js';
|
|
36
|
+
import type { MessengerClientConfig, ButtonTemplate, GenericTemplate, QuickReply, UserProfile, PersonaConfig, PersonaInfo, SenderAction } from './types.js';
|
|
37
|
+
/** Raw inbound type (the normalised message from the webhook). */
|
|
38
|
+
type MessengerInbound = NormalizedMessage;
|
|
39
|
+
/** Raw outbound type (arbitrary JSON payload). */
|
|
40
|
+
type MessengerOutbound = Record<string, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Create a new {@link MessengerClient} instance.
|
|
43
|
+
*
|
|
44
|
+
* This is the recommended entry point. It constructs the client with all
|
|
45
|
+
* internal dependencies wired up (Graph API client, format converter).
|
|
46
|
+
*
|
|
47
|
+
* @param config - Messenger client configuration.
|
|
48
|
+
* @returns A fully configured {@link MessengerClient}.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const messenger = createMessengerClient({
|
|
53
|
+
* pageAccessToken: process.env.MESSENGER_PAGE_ACCESS_TOKEN!,
|
|
54
|
+
* appSecret: process.env.META_APP_SECRET!,
|
|
55
|
+
* pageId: process.env.MESSENGER_PAGE_ID!,
|
|
56
|
+
* verifyToken: process.env.MESSENGER_VERIFY_TOKEN!,
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function createMessengerClient(config: MessengerClientConfig): MessengerClient;
|
|
61
|
+
/**
|
|
62
|
+
* Full-featured Facebook Messenger Platform client.
|
|
63
|
+
*
|
|
64
|
+
* Implements the `PlatformClient` interface from `@ariaflowagents/messaging`
|
|
65
|
+
* so it can be plugged into the messaging adapter layer, while also exposing
|
|
66
|
+
* Messenger-specific capabilities (button templates, generic templates,
|
|
67
|
+
* quick replies, personas, user profiles).
|
|
68
|
+
*
|
|
69
|
+
* Use {@link createMessengerClient} to instantiate.
|
|
70
|
+
*/
|
|
71
|
+
export declare class MessengerClient implements PlatformClient<MessengerClientConfig, string, MessengerInbound, MessengerOutbound> {
|
|
72
|
+
/** @inheritdoc */
|
|
73
|
+
readonly platform: "messenger";
|
|
74
|
+
private readonly graphApi;
|
|
75
|
+
private readonly config;
|
|
76
|
+
private readonly messageHandlers;
|
|
77
|
+
private readonly statusHandlers;
|
|
78
|
+
private readonly reactionHandlers;
|
|
79
|
+
private readonly formatConverterInstance;
|
|
80
|
+
private readonly mediaCache?;
|
|
81
|
+
constructor(config: MessengerClientConfig);
|
|
82
|
+
/** Messenger-specific format converter. */
|
|
83
|
+
get formatConverter(): FormatConverter;
|
|
84
|
+
/**
|
|
85
|
+
* Register a handler for inbound messages.
|
|
86
|
+
*
|
|
87
|
+
* Multiple handlers can be registered; they are called in order for
|
|
88
|
+
* each incoming message.
|
|
89
|
+
*
|
|
90
|
+
* @param handler - Callback invoked with the normalised message and raw payload.
|
|
91
|
+
*/
|
|
92
|
+
onMessage(handler: MessageHandler<MessengerInbound>): void;
|
|
93
|
+
/**
|
|
94
|
+
* Register a handler for delivery/read status updates.
|
|
95
|
+
*
|
|
96
|
+
* @param handler - Callback invoked with the normalised status update.
|
|
97
|
+
*/
|
|
98
|
+
onStatus(handler: StatusHandler): void;
|
|
99
|
+
/**
|
|
100
|
+
* Register a handler for reaction events.
|
|
101
|
+
*
|
|
102
|
+
* @param handler - Callback invoked with the normalised reaction data.
|
|
103
|
+
*/
|
|
104
|
+
onReaction(handler: ReactionHandler): void;
|
|
105
|
+
/**
|
|
106
|
+
* Handle an incoming webhook request from Meta.
|
|
107
|
+
*
|
|
108
|
+
* - **GET** requests are treated as subscription verification challenges.
|
|
109
|
+
* - **POST** requests are validated via HMAC-SHA256 signature, normalised,
|
|
110
|
+
* and dispatched to registered handlers.
|
|
111
|
+
*
|
|
112
|
+
* @param request - The incoming HTTP request.
|
|
113
|
+
* @returns An HTTP response (200 OK, 401 Unauthorized, or 403 Forbidden).
|
|
114
|
+
*/
|
|
115
|
+
handleWebhook(request: Request): Promise<Response>;
|
|
116
|
+
/**
|
|
117
|
+
* Handle webhook verification (GET) from Meta.
|
|
118
|
+
*
|
|
119
|
+
* @param request - The GET request with `hub.mode`, `hub.verify_token`, and `hub.challenge`.
|
|
120
|
+
* @returns 200 with the challenge string, or 403 Forbidden.
|
|
121
|
+
*/
|
|
122
|
+
private handleVerification;
|
|
123
|
+
/**
|
|
124
|
+
* Send a text message.
|
|
125
|
+
*
|
|
126
|
+
* Messages exceeding the 2000-character Messenger limit are truncated.
|
|
127
|
+
*
|
|
128
|
+
* @param to - Recipient PSID.
|
|
129
|
+
* @param text - The text content to send.
|
|
130
|
+
* @returns The send result.
|
|
131
|
+
*/
|
|
132
|
+
sendText(to: string, text: string): Promise<SendResult>;
|
|
133
|
+
/**
|
|
134
|
+
* Send a media message (image, video, audio, or file).
|
|
135
|
+
*
|
|
136
|
+
* Accepts URLs (string), Buffers (uploaded automatically), or ReadableStreams.
|
|
137
|
+
*
|
|
138
|
+
* @param to - Recipient PSID.
|
|
139
|
+
* @param media - The media payload to send.
|
|
140
|
+
* @returns The send result.
|
|
141
|
+
*/
|
|
142
|
+
sendMedia(to: string, media: MediaPayload): Promise<SendResult>;
|
|
143
|
+
/**
|
|
144
|
+
* Send an interactive message (buttons or list).
|
|
145
|
+
*
|
|
146
|
+
* Converts the platform-agnostic {@link InteractiveMessage} into
|
|
147
|
+
* Messenger's template format:
|
|
148
|
+
* - `action.type === 'buttons'` maps to a button template
|
|
149
|
+
* - `action.type === 'list'` maps to a generic template (carousel)
|
|
150
|
+
*
|
|
151
|
+
* @param to - Recipient PSID.
|
|
152
|
+
* @param msg - The interactive message definition.
|
|
153
|
+
* @returns The send result.
|
|
154
|
+
* @throws {@link MessagingError} if the interactive type is unsupported.
|
|
155
|
+
*/
|
|
156
|
+
sendInteractive(to: string, msg: InteractiveMessage): Promise<SendResult>;
|
|
157
|
+
/**
|
|
158
|
+
* Send a raw platform-specific payload.
|
|
159
|
+
*
|
|
160
|
+
* This is an escape hatch for features not covered by the normalised
|
|
161
|
+
* interface. The payload is merged with the standard messaging envelope.
|
|
162
|
+
*
|
|
163
|
+
* @param to - Recipient PSID.
|
|
164
|
+
* @param payload - Raw Messenger API payload fields.
|
|
165
|
+
* @returns The send result.
|
|
166
|
+
*/
|
|
167
|
+
sendRaw(to: string, payload: MessengerOutbound): Promise<SendResult>;
|
|
168
|
+
/**
|
|
169
|
+
* Mark a conversation as seen.
|
|
170
|
+
*
|
|
171
|
+
* Sends a `mark_seen` sender action to the recipient. Note that unlike
|
|
172
|
+
* WhatsApp, Messenger's mark-seen operates on the recipient (PSID) rather
|
|
173
|
+
* than a specific message ID.
|
|
174
|
+
*
|
|
175
|
+
* @param messageId - The message ID (used to identify the recipient via
|
|
176
|
+
* stored mapping; falls back to treating it as a PSID).
|
|
177
|
+
*/
|
|
178
|
+
markAsRead(messageId: string): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Send a typing indicator to a recipient.
|
|
181
|
+
*
|
|
182
|
+
* Sends the `typing_on` sender action. The indicator is automatically
|
|
183
|
+
* dismissed after 20 seconds or when a message is sent.
|
|
184
|
+
*
|
|
185
|
+
* @param to - Recipient PSID.
|
|
186
|
+
*/
|
|
187
|
+
sendTypingIndicator(to: string): Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Send a button template message.
|
|
190
|
+
*
|
|
191
|
+
* Displays a text message with up to 3 buttons below it. Buttons can be
|
|
192
|
+
* postback (returns a payload to the webhook) or web URL (opens a browser).
|
|
193
|
+
*
|
|
194
|
+
* @param to - Recipient PSID.
|
|
195
|
+
* @param template - The button template payload.
|
|
196
|
+
* @returns The send result.
|
|
197
|
+
*/
|
|
198
|
+
sendButtonTemplate(to: string, template: ButtonTemplate): Promise<SendResult>;
|
|
199
|
+
/**
|
|
200
|
+
* Send a generic template (carousel) message.
|
|
201
|
+
*
|
|
202
|
+
* Displays a horizontally scrollable set of cards, each with an image,
|
|
203
|
+
* title, subtitle, and optional buttons.
|
|
204
|
+
*
|
|
205
|
+
* @param to - Recipient PSID.
|
|
206
|
+
* @param template - The generic template payload.
|
|
207
|
+
* @returns The send result.
|
|
208
|
+
*/
|
|
209
|
+
sendGenericTemplate(to: string, template: GenericTemplate): Promise<SendResult>;
|
|
210
|
+
/**
|
|
211
|
+
* Send quick reply options with a text message.
|
|
212
|
+
*
|
|
213
|
+
* Quick replies appear as pill-shaped buttons above the composer and
|
|
214
|
+
* disappear once the user taps one or types a message.
|
|
215
|
+
*
|
|
216
|
+
* @param to - Recipient PSID.
|
|
217
|
+
* @param text - The text message to display above the quick replies.
|
|
218
|
+
* @param replies - Array of quick reply options (max 13).
|
|
219
|
+
* @returns The send result.
|
|
220
|
+
*/
|
|
221
|
+
sendQuickReplies(to: string, text: string, replies: QuickReply[]): Promise<SendResult>;
|
|
222
|
+
/**
|
|
223
|
+
* Send a sender action (typing indicator or mark-seen).
|
|
224
|
+
*
|
|
225
|
+
* Sender actions cannot be combined with a `message` field — they must
|
|
226
|
+
* be sent as separate requests.
|
|
227
|
+
*
|
|
228
|
+
* @param to - Recipient PSID.
|
|
229
|
+
* @param action - The sender action (`"typing_on"`, `"typing_off"`, or `"mark_seen"`).
|
|
230
|
+
*/
|
|
231
|
+
sendSenderAction(to: string, action: SenderAction): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Retrieve a user's public profile information.
|
|
234
|
+
*
|
|
235
|
+
* Returns the first name, last name, and profile picture URL for the
|
|
236
|
+
* given PSID.
|
|
237
|
+
*
|
|
238
|
+
* @param psid - The user's page-scoped ID.
|
|
239
|
+
* @returns The user's profile information.
|
|
240
|
+
*/
|
|
241
|
+
getUserProfile(psid: string): Promise<UserProfile>;
|
|
242
|
+
/**
|
|
243
|
+
* Persona management operations.
|
|
244
|
+
*
|
|
245
|
+
* Personas allow the bot to respond as a named human agent with a
|
|
246
|
+
* custom profile picture. Useful for the HUMAN_AGENT message tag flow.
|
|
247
|
+
*/
|
|
248
|
+
readonly personas: {
|
|
249
|
+
/**
|
|
250
|
+
* Create a new persona for the page.
|
|
251
|
+
*
|
|
252
|
+
* @param config - The persona name and profile picture URL.
|
|
253
|
+
* @returns The created persona with its ID.
|
|
254
|
+
*/
|
|
255
|
+
create: (config: PersonaConfig) => Promise<PersonaInfo>;
|
|
256
|
+
/**
|
|
257
|
+
* Delete a persona.
|
|
258
|
+
*
|
|
259
|
+
* @param personaId - The persona ID to delete.
|
|
260
|
+
*/
|
|
261
|
+
delete: (personaId: string) => Promise<void>;
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Upload media to Messenger for later use in messages.
|
|
265
|
+
*
|
|
266
|
+
* Uses the Attachment Upload API to upload files and receive an
|
|
267
|
+
* `attachment_id` that can be reused across messages.
|
|
268
|
+
*
|
|
269
|
+
* @param file - The file content as a Buffer or ReadableStream.
|
|
270
|
+
* @param options - Upload options including MIME type and optional filename.
|
|
271
|
+
* @returns A handle containing the platform-assigned media ID.
|
|
272
|
+
*/
|
|
273
|
+
uploadMedia(file: Buffer | ReadableStream, options: MediaUploadOptions): Promise<MediaHandle>;
|
|
274
|
+
/**
|
|
275
|
+
* Download media from a URL.
|
|
276
|
+
*
|
|
277
|
+
* Messenger media URLs are typically publicly accessible (unlike WhatsApp
|
|
278
|
+
* which requires a two-step media-ID-to-URL lookup). This method fetches
|
|
279
|
+
* the binary content from the provided URL.
|
|
280
|
+
*
|
|
281
|
+
* @param mediaUrl - The media URL to download from.
|
|
282
|
+
* @returns The downloaded media content and MIME type.
|
|
283
|
+
*/
|
|
284
|
+
downloadMedia(mediaUrl: string): Promise<MediaDownload>;
|
|
285
|
+
/**
|
|
286
|
+
* Returns a Hono sub-application that handles webhook routes.
|
|
287
|
+
*
|
|
288
|
+
* Mounts GET (verification) and POST (event delivery) handlers at the
|
|
289
|
+
* root path. Use this to integrate the webhook into an existing Hono app.
|
|
290
|
+
*
|
|
291
|
+
* Requires `hono` to be installed as a peer dependency. The import is
|
|
292
|
+
* performed dynamically to avoid a hard compile-time dependency.
|
|
293
|
+
*
|
|
294
|
+
* @returns A Hono application with webhook routes.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```ts
|
|
298
|
+
* import { Hono } from 'hono';
|
|
299
|
+
*
|
|
300
|
+
* const app = new Hono();
|
|
301
|
+
* app.route('/webhooks/messenger', client.webhookRouter());
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
webhookRouter(): any;
|
|
305
|
+
/**
|
|
306
|
+
* Convert a normalised webhook message to a platform-agnostic {@link InboundMessage}.
|
|
307
|
+
*/
|
|
308
|
+
private toInboundMessage;
|
|
309
|
+
/**
|
|
310
|
+
* Convert a normalised webhook status to a platform-agnostic {@link StatusUpdate}.
|
|
311
|
+
*/
|
|
312
|
+
private toStatusUpdate;
|
|
313
|
+
/**
|
|
314
|
+
* Convert a normalised webhook reaction to a platform-agnostic {@link ReactionData}.
|
|
315
|
+
*/
|
|
316
|
+
private toReactionData;
|
|
317
|
+
/**
|
|
318
|
+
* Convert a {@link MessengerSendResponse} to a platform-agnostic {@link SendResult}.
|
|
319
|
+
*/
|
|
320
|
+
private toSendResult;
|
|
321
|
+
/**
|
|
322
|
+
* Map a Messenger message type string to the normalised {@link InboundMessage} type union.
|
|
323
|
+
*/
|
|
324
|
+
private mapMessageType;
|
|
325
|
+
/**
|
|
326
|
+
* Extract a text fallback from non-text message types.
|
|
327
|
+
*/
|
|
328
|
+
private extractTextFallback;
|
|
329
|
+
/**
|
|
330
|
+
* Extract a {@link MediaReference} from a normalised message if it contains media.
|
|
331
|
+
*/
|
|
332
|
+
private extractMedia;
|
|
333
|
+
/**
|
|
334
|
+
* Resolve a MIME type to a Messenger attachment type string.
|
|
335
|
+
*/
|
|
336
|
+
private resolveAttachmentType;
|
|
337
|
+
}
|
|
338
|
+
export {};
|
|
339
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/messenger/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EACV,cAAc,EAGd,UAAU,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,kBAAkB,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