@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 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/instagram/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAoBH,OAAO,EACL,cAAc,EACd,UAAU,GACX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAkB5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,mDAAmD;AACnD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAY7B,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA6B;IACjE,OAAO,IAAI,eAAe,CAAC,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AC;IACnC,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,cAAc,CAAC,MAAsB;IAClD,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IAElC,SAAS,CAAC;QACR,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5C,IAAI,IAAI;YAAE,MAAM;QAChB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module instagram/format
|
|
3
|
+
*
|
|
4
|
+
* Instagram-specific text format converter.
|
|
5
|
+
*
|
|
6
|
+
* Instagram DMs do not support any rich text formatting (no bold, italic,
|
|
7
|
+
* strikethrough, etc.). All Markdown formatting is stripped and messages
|
|
8
|
+
* are delivered as plain text.
|
|
9
|
+
*
|
|
10
|
+
* This converter handles bidirectional translation between Markdown and
|
|
11
|
+
* plain text for the Instagram platform.
|
|
12
|
+
*/
|
|
13
|
+
import { BaseFormatConverter } from '@ariaflowagents/messaging';
|
|
14
|
+
/**
|
|
15
|
+
* Converts text between Markdown and Instagram's plain text format.
|
|
16
|
+
*
|
|
17
|
+
* Instagram DMs are plain-text only, so `toPlatformFormat` strips all
|
|
18
|
+
* Markdown formatting. `toMarkdown` passes text through unchanged since
|
|
19
|
+
* Instagram messages are already plain text.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const converter = new InstagramFormatConverter();
|
|
24
|
+
*
|
|
25
|
+
* // Markdown to Instagram (plain text)
|
|
26
|
+
* converter.toPlatformFormat('**bold** and ~~strike~~');
|
|
27
|
+
* // => 'bold and strike'
|
|
28
|
+
*
|
|
29
|
+
* // Instagram to Markdown (passthrough)
|
|
30
|
+
* converter.toMarkdown('Hello world');
|
|
31
|
+
* // => 'Hello world'
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class InstagramFormatConverter extends BaseFormatConverter {
|
|
35
|
+
/**
|
|
36
|
+
* Convert standard Markdown to plain text for Instagram.
|
|
37
|
+
*
|
|
38
|
+
* Strips all Markdown formatting since Instagram DMs do not support
|
|
39
|
+
* rich text rendering.
|
|
40
|
+
*
|
|
41
|
+
* @param markdown - Markdown-formatted text.
|
|
42
|
+
* @returns Plain text with all formatting markers removed.
|
|
43
|
+
*/
|
|
44
|
+
toPlatformFormat(markdown: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Convert Instagram text to Markdown.
|
|
47
|
+
*
|
|
48
|
+
* Instagram messages are plain text, so this is a passthrough.
|
|
49
|
+
*
|
|
50
|
+
* @param text - Plain text from Instagram.
|
|
51
|
+
* @returns The same text unchanged.
|
|
52
|
+
*/
|
|
53
|
+
toMarkdown(text: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Strip all Markdown formatting to produce plain text.
|
|
56
|
+
*
|
|
57
|
+
* @param markdown - Markdown-formatted text.
|
|
58
|
+
* @returns Plain text with all formatting markers removed.
|
|
59
|
+
*/
|
|
60
|
+
toPlainText(markdown: string): string;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/instagram/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,wBAAyB,SAAQ,mBAAmB;IAC/D;;;;;;;;OAQG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI1C;;;;;;;OAOG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIhC;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAsCtC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module instagram/format
|
|
3
|
+
*
|
|
4
|
+
* Instagram-specific text format converter.
|
|
5
|
+
*
|
|
6
|
+
* Instagram DMs do not support any rich text formatting (no bold, italic,
|
|
7
|
+
* strikethrough, etc.). All Markdown formatting is stripped and messages
|
|
8
|
+
* are delivered as plain text.
|
|
9
|
+
*
|
|
10
|
+
* This converter handles bidirectional translation between Markdown and
|
|
11
|
+
* plain text for the Instagram platform.
|
|
12
|
+
*/
|
|
13
|
+
import { BaseFormatConverter } from '@ariaflowagents/messaging';
|
|
14
|
+
/**
|
|
15
|
+
* Converts text between Markdown and Instagram's plain text format.
|
|
16
|
+
*
|
|
17
|
+
* Instagram DMs are plain-text only, so `toPlatformFormat` strips all
|
|
18
|
+
* Markdown formatting. `toMarkdown` passes text through unchanged since
|
|
19
|
+
* Instagram messages are already plain text.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const converter = new InstagramFormatConverter();
|
|
24
|
+
*
|
|
25
|
+
* // Markdown to Instagram (plain text)
|
|
26
|
+
* converter.toPlatformFormat('**bold** and ~~strike~~');
|
|
27
|
+
* // => 'bold and strike'
|
|
28
|
+
*
|
|
29
|
+
* // Instagram to Markdown (passthrough)
|
|
30
|
+
* converter.toMarkdown('Hello world');
|
|
31
|
+
* // => 'Hello world'
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class InstagramFormatConverter extends BaseFormatConverter {
|
|
35
|
+
/**
|
|
36
|
+
* Convert standard Markdown to plain text for Instagram.
|
|
37
|
+
*
|
|
38
|
+
* Strips all Markdown formatting since Instagram DMs do not support
|
|
39
|
+
* rich text rendering.
|
|
40
|
+
*
|
|
41
|
+
* @param markdown - Markdown-formatted text.
|
|
42
|
+
* @returns Plain text with all formatting markers removed.
|
|
43
|
+
*/
|
|
44
|
+
toPlatformFormat(markdown) {
|
|
45
|
+
return this.toPlainText(markdown);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Convert Instagram text to Markdown.
|
|
49
|
+
*
|
|
50
|
+
* Instagram messages are plain text, so this is a passthrough.
|
|
51
|
+
*
|
|
52
|
+
* @param text - Plain text from Instagram.
|
|
53
|
+
* @returns The same text unchanged.
|
|
54
|
+
*/
|
|
55
|
+
toMarkdown(text) {
|
|
56
|
+
return text;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Strip all Markdown formatting to produce plain text.
|
|
60
|
+
*
|
|
61
|
+
* @param markdown - Markdown-formatted text.
|
|
62
|
+
* @returns Plain text with all formatting markers removed.
|
|
63
|
+
*/
|
|
64
|
+
toPlainText(markdown) {
|
|
65
|
+
let text = markdown;
|
|
66
|
+
// Remove code blocks but keep content
|
|
67
|
+
text = text.replace(/```(?:\w*\n)?([\s\S]*?)```/g, '$1');
|
|
68
|
+
// Remove inline code markers
|
|
69
|
+
text = text.replace(/`([^`]+)`/g, '$1');
|
|
70
|
+
// Remove heading markers
|
|
71
|
+
text = text.replace(/^#{1,6}\s+/gm, '');
|
|
72
|
+
// Remove images
|
|
73
|
+
text = text.replace(/!\[([^\]]*)\]\([^)]+\)/g, '$1');
|
|
74
|
+
// Remove links but keep text
|
|
75
|
+
text = text.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
|
|
76
|
+
// Remove bold (Markdown)
|
|
77
|
+
text = text.replace(/\*\*(.+?)\*\*/g, '$1');
|
|
78
|
+
text = text.replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g, '$1');
|
|
79
|
+
// Remove italic
|
|
80
|
+
text = text.replace(/__(.+?)__/g, '$1');
|
|
81
|
+
text = text.replace(/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g, '$1');
|
|
82
|
+
// Remove strikethrough
|
|
83
|
+
text = text.replace(/~~(.+?)~~/g, '$1');
|
|
84
|
+
text = text.replace(/(?<!~)~(?!~)(.+?)(?<!~)~(?!~)/g, '$1');
|
|
85
|
+
// Remove blockquote markers
|
|
86
|
+
text = text.replace(/^>\s?/gm, '');
|
|
87
|
+
// Remove horizontal rules
|
|
88
|
+
text = text.replace(/^(?:---+|\*\*\*+|___+)\s*$/gm, '');
|
|
89
|
+
return text.trim();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/instagram/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,wBAAyB,SAAQ,mBAAmB;IAC/D;;;;;;;;OAQG;IACH,gBAAgB,CAAC,QAAgB;QAC/B,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,QAAgB;QAC1B,IAAI,IAAI,GAAG,QAAQ,CAAC;QAEpB,sCAAsC;QACtC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,6BAA6B,EAAE,IAAI,CAAC,CAAC;QAEzD,6BAA6B;QAC7B,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAExC,yBAAyB;QACzB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAExC,gBAAgB;QAChB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,IAAI,CAAC,CAAC;QAErD,6BAA6B;QAC7B,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;QAEpD,yBAAyB;QACzB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAC5C,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,sCAAsC,EAAE,IAAI,CAAC,CAAC;QAElE,gBAAgB;QAChB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QACxC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;QAE5D,uBAAuB;QACvB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QACxC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;QAE5D,4BAA4B;QAC5B,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAEnC,0BAA0B;QAC1B,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;QAExD,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module instagram/ice-breakers
|
|
3
|
+
*
|
|
4
|
+
* Ice breaker types and helper utilities for the Instagram Messaging API.
|
|
5
|
+
*
|
|
6
|
+
* Ice breakers are conversation starters that appear when a user opens
|
|
7
|
+
* a DM thread with your Instagram professional account for the first time.
|
|
8
|
+
* When tapped, they deliver a `messaging_postback` webhook event with the
|
|
9
|
+
* configured payload.
|
|
10
|
+
*
|
|
11
|
+
* Ice breaker management is exposed on the {@link InstagramClient} as
|
|
12
|
+
* `client.iceBreakers.set()`, `client.iceBreakers.get()`, and
|
|
13
|
+
* `client.iceBreakers.delete()`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { createInstagramClient } from '@ariaflowagents/messaging-meta/instagram';
|
|
18
|
+
* import { buildIceBreakerConfig } from '@ariaflowagents/messaging-meta/instagram';
|
|
19
|
+
*
|
|
20
|
+
* const client = createInstagramClient({ ... });
|
|
21
|
+
*
|
|
22
|
+
* // Set ice breakers using the helper
|
|
23
|
+
* const config = buildIceBreakerConfig([
|
|
24
|
+
* { question: 'What are your hours?', payload: 'HOURS' },
|
|
25
|
+
* { question: 'Where are you located?', payload: 'LOCATION' },
|
|
26
|
+
* ]);
|
|
27
|
+
* await client.iceBreakers.set([config]);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
import type { IceBreaker, IceBreakerConfig } from './types.js';
|
|
31
|
+
export type { IceBreaker, IceBreakerConfig };
|
|
32
|
+
/** Maximum number of ice breakers allowed per locale. */
|
|
33
|
+
export declare const MAX_ICE_BREAKERS = 4;
|
|
34
|
+
/**
|
|
35
|
+
* Build an {@link IceBreakerConfig} from an array of question-payload pairs.
|
|
36
|
+
*
|
|
37
|
+
* Validates that the number of items does not exceed the maximum of 4
|
|
38
|
+
* per locale and truncates if necessary.
|
|
39
|
+
*
|
|
40
|
+
* @param items - Array of ice breaker question-payload pairs.
|
|
41
|
+
* @param locale - Optional BCP 47 locale code (e.g. `"en_US"`).
|
|
42
|
+
* @returns A fully formed {@link IceBreakerConfig}.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const config = buildIceBreakerConfig([
|
|
47
|
+
* { question: 'What services do you offer?', payload: 'SERVICES' },
|
|
48
|
+
* { question: 'How do I book an appointment?', payload: 'BOOKING' },
|
|
49
|
+
* ]);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildIceBreakerConfig(items: IceBreaker[], locale?: string): IceBreakerConfig;
|
|
53
|
+
/**
|
|
54
|
+
* Validate an array of {@link IceBreakerConfig} entries.
|
|
55
|
+
*
|
|
56
|
+
* Checks that each config has at most {@link MAX_ICE_BREAKERS} items
|
|
57
|
+
* and that every item has both a `question` and `payload` string.
|
|
58
|
+
*
|
|
59
|
+
* @param configs - The ice breaker configurations to validate.
|
|
60
|
+
* @returns An array of validation error strings (empty if valid).
|
|
61
|
+
*/
|
|
62
|
+
export declare function validateIceBreakers(configs: IceBreakerConfig[]): string[];
|
|
63
|
+
//# sourceMappingURL=ice-breakers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ice-breakers.d.ts","sourceRoot":"","sources":["../../src/instagram/ice-breakers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG/D,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC;AAE7C,yDAAyD;AACzD,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,UAAU,EAAE,EACnB,MAAM,CAAC,EAAE,MAAM,GACd,gBAAgB,CAUlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,MAAM,EAAE,CAyBzE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module instagram/ice-breakers
|
|
3
|
+
*
|
|
4
|
+
* Ice breaker types and helper utilities for the Instagram Messaging API.
|
|
5
|
+
*
|
|
6
|
+
* Ice breakers are conversation starters that appear when a user opens
|
|
7
|
+
* a DM thread with your Instagram professional account for the first time.
|
|
8
|
+
* When tapped, they deliver a `messaging_postback` webhook event with the
|
|
9
|
+
* configured payload.
|
|
10
|
+
*
|
|
11
|
+
* Ice breaker management is exposed on the {@link InstagramClient} as
|
|
12
|
+
* `client.iceBreakers.set()`, `client.iceBreakers.get()`, and
|
|
13
|
+
* `client.iceBreakers.delete()`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { createInstagramClient } from '@ariaflowagents/messaging-meta/instagram';
|
|
18
|
+
* import { buildIceBreakerConfig } from '@ariaflowagents/messaging-meta/instagram';
|
|
19
|
+
*
|
|
20
|
+
* const client = createInstagramClient({ ... });
|
|
21
|
+
*
|
|
22
|
+
* // Set ice breakers using the helper
|
|
23
|
+
* const config = buildIceBreakerConfig([
|
|
24
|
+
* { question: 'What are your hours?', payload: 'HOURS' },
|
|
25
|
+
* { question: 'Where are you located?', payload: 'LOCATION' },
|
|
26
|
+
* ]);
|
|
27
|
+
* await client.iceBreakers.set([config]);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
/** Maximum number of ice breakers allowed per locale. */
|
|
31
|
+
export const MAX_ICE_BREAKERS = 4;
|
|
32
|
+
/**
|
|
33
|
+
* Build an {@link IceBreakerConfig} from an array of question-payload pairs.
|
|
34
|
+
*
|
|
35
|
+
* Validates that the number of items does not exceed the maximum of 4
|
|
36
|
+
* per locale and truncates if necessary.
|
|
37
|
+
*
|
|
38
|
+
* @param items - Array of ice breaker question-payload pairs.
|
|
39
|
+
* @param locale - Optional BCP 47 locale code (e.g. `"en_US"`).
|
|
40
|
+
* @returns A fully formed {@link IceBreakerConfig}.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const config = buildIceBreakerConfig([
|
|
45
|
+
* { question: 'What services do you offer?', payload: 'SERVICES' },
|
|
46
|
+
* { question: 'How do I book an appointment?', payload: 'BOOKING' },
|
|
47
|
+
* ]);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export function buildIceBreakerConfig(items, locale) {
|
|
51
|
+
const config = {
|
|
52
|
+
call_to_actions: items.slice(0, MAX_ICE_BREAKERS),
|
|
53
|
+
};
|
|
54
|
+
if (locale) {
|
|
55
|
+
config.locale = locale;
|
|
56
|
+
}
|
|
57
|
+
return config;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Validate an array of {@link IceBreakerConfig} entries.
|
|
61
|
+
*
|
|
62
|
+
* Checks that each config has at most {@link MAX_ICE_BREAKERS} items
|
|
63
|
+
* and that every item has both a `question` and `payload` string.
|
|
64
|
+
*
|
|
65
|
+
* @param configs - The ice breaker configurations to validate.
|
|
66
|
+
* @returns An array of validation error strings (empty if valid).
|
|
67
|
+
*/
|
|
68
|
+
export function validateIceBreakers(configs) {
|
|
69
|
+
const errors = [];
|
|
70
|
+
for (let i = 0; i < configs.length; i++) {
|
|
71
|
+
const config = configs[i];
|
|
72
|
+
if (config.call_to_actions.length > MAX_ICE_BREAKERS) {
|
|
73
|
+
errors.push(`Config at index ${i}: exceeds maximum of ${MAX_ICE_BREAKERS} ice breakers (has ${config.call_to_actions.length})`);
|
|
74
|
+
}
|
|
75
|
+
for (let j = 0; j < config.call_to_actions.length; j++) {
|
|
76
|
+
const item = config.call_to_actions[j];
|
|
77
|
+
if (!item.question || typeof item.question !== 'string') {
|
|
78
|
+
errors.push(`Config[${i}].call_to_actions[${j}]: missing or invalid "question"`);
|
|
79
|
+
}
|
|
80
|
+
if (!item.payload || typeof item.payload !== 'string') {
|
|
81
|
+
errors.push(`Config[${i}].call_to_actions[${j}]: missing or invalid "payload"`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return errors;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=ice-breakers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ice-breakers.js","sourceRoot":"","sources":["../../src/instagram/ice-breakers.ts"],"names":[],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nF,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;gBACtD,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,iCAAiC,CAAC,CAAC;YAClF,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module instagram
|
|
3
|
+
*
|
|
4
|
+
* Instagram Messaging API client for the AriaFlow messaging framework.
|
|
5
|
+
*
|
|
6
|
+
* This module provides a complete, production-ready Instagram Messaging
|
|
7
|
+
* integration implementing the `PlatformClient` interface from
|
|
8
|
+
* `@ariaflowagents/messaging`.
|
|
9
|
+
*
|
|
10
|
+
* Key features:
|
|
11
|
+
* - Text, image, quick reply, and template messages
|
|
12
|
+
* - Generic template (carousel) and button template messages
|
|
13
|
+
* - Private replies to comments on posts and reels
|
|
14
|
+
* - Ice breaker management (set, get, delete)
|
|
15
|
+
* - Typing indicator support
|
|
16
|
+
* - Smart message splitting for the 1000-byte limit
|
|
17
|
+
* - Webhook handling with HMAC-SHA256 signature verification
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import {
|
|
22
|
+
* createInstagramClient,
|
|
23
|
+
* InstagramFormatConverter,
|
|
24
|
+
* } from '@ariaflowagents/messaging-meta/instagram';
|
|
25
|
+
*
|
|
26
|
+
* const client = createInstagramClient({
|
|
27
|
+
* accessToken: process.env.INSTAGRAM_ACCESS_TOKEN!,
|
|
28
|
+
* appSecret: process.env.META_APP_SECRET!,
|
|
29
|
+
* igId: process.env.INSTAGRAM_ACCOUNT_ID!,
|
|
30
|
+
* verifyToken: process.env.INSTAGRAM_VERIFY_TOKEN!,
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* client.onMessage(async (msg) => {
|
|
34
|
+
* await client.sendText(msg.from.id, `Echo: ${msg.text}`);
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @packageDocumentation
|
|
39
|
+
*/
|
|
40
|
+
export { InstagramClient, createInstagramClient } from './client.js';
|
|
41
|
+
export type { InstagramClientConfig, InstagramThreadId, InstagramSendResponse, InstagramQuickReply, InstagramButton, InstagramGenericElement, InstagramGenericTemplate, InstagramButtonTemplate, PrivateReplyOptions, IceBreaker, IceBreakerConfig, InstagramMessageTag, } from './types.js';
|
|
42
|
+
export { InstagramFormatConverter } from './format.js';
|
|
43
|
+
export { buildIceBreakerConfig, validateIceBreakers, MAX_ICE_BREAKERS, } from './ice-breakers.js';
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/instagram/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGrE,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module instagram
|
|
3
|
+
*
|
|
4
|
+
* Instagram Messaging API client for the AriaFlow messaging framework.
|
|
5
|
+
*
|
|
6
|
+
* This module provides a complete, production-ready Instagram Messaging
|
|
7
|
+
* integration implementing the `PlatformClient` interface from
|
|
8
|
+
* `@ariaflowagents/messaging`.
|
|
9
|
+
*
|
|
10
|
+
* Key features:
|
|
11
|
+
* - Text, image, quick reply, and template messages
|
|
12
|
+
* - Generic template (carousel) and button template messages
|
|
13
|
+
* - Private replies to comments on posts and reels
|
|
14
|
+
* - Ice breaker management (set, get, delete)
|
|
15
|
+
* - Typing indicator support
|
|
16
|
+
* - Smart message splitting for the 1000-byte limit
|
|
17
|
+
* - Webhook handling with HMAC-SHA256 signature verification
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import {
|
|
22
|
+
* createInstagramClient,
|
|
23
|
+
* InstagramFormatConverter,
|
|
24
|
+
* } from '@ariaflowagents/messaging-meta/instagram';
|
|
25
|
+
*
|
|
26
|
+
* const client = createInstagramClient({
|
|
27
|
+
* accessToken: process.env.INSTAGRAM_ACCESS_TOKEN!,
|
|
28
|
+
* appSecret: process.env.META_APP_SECRET!,
|
|
29
|
+
* igId: process.env.INSTAGRAM_ACCOUNT_ID!,
|
|
30
|
+
* verifyToken: process.env.INSTAGRAM_VERIFY_TOKEN!,
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* client.onMessage(async (msg) => {
|
|
34
|
+
* await client.sendText(msg.from.id, `Echo: ${msg.text}`);
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @packageDocumentation
|
|
39
|
+
*/
|
|
40
|
+
// --- Client ---------------------------------------------------------------
|
|
41
|
+
export { InstagramClient, createInstagramClient } from './client.js';
|
|
42
|
+
// --- Format converter -----------------------------------------------------
|
|
43
|
+
export { InstagramFormatConverter } from './format.js';
|
|
44
|
+
// --- Ice breakers ---------------------------------------------------------
|
|
45
|
+
export { buildIceBreakerConfig, validateIceBreakers, MAX_ICE_BREAKERS, } from './ice-breakers.js';
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/instagram/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,6EAA6E;AAC7E,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAkBrE,6EAA6E;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,6EAA6E;AAC7E,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,188 @@
|
|
|
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
|
+
import type { MediaCache } from '@ariaflowagents/messaging';
|
|
19
|
+
import type { Logger } from '../graph-api/client.js';
|
|
20
|
+
import type { RetryConfig } from '../graph-api/retry.js';
|
|
21
|
+
import type { RateLimiterConfig } from '../graph-api/rate-limiter.js';
|
|
22
|
+
/**
|
|
23
|
+
* Configuration for creating an {@link InstagramClient}.
|
|
24
|
+
*
|
|
25
|
+
* The `accessToken` is an Instagram User access token obtained via
|
|
26
|
+
* the Meta Developer Dashboard. The `igId` is the Instagram professional
|
|
27
|
+
* account ID (not the IGSID of a user).
|
|
28
|
+
*/
|
|
29
|
+
export interface InstagramClientConfig {
|
|
30
|
+
/** Instagram User access token for the Graph API. */
|
|
31
|
+
accessToken: string;
|
|
32
|
+
/** App secret for webhook signature verification. */
|
|
33
|
+
appSecret: string;
|
|
34
|
+
/** Instagram professional account ID (sender identity). */
|
|
35
|
+
igId: string;
|
|
36
|
+
/** Custom verify token for webhook subscription validation. */
|
|
37
|
+
verifyToken: string;
|
|
38
|
+
/** Graph API version (e.g. `"v24.0"`). Default `"v24.0"`. */
|
|
39
|
+
apiVersion?: string;
|
|
40
|
+
/** Base URL for the Instagram Graph API. Default `"https://graph.instagram.com"`. */
|
|
41
|
+
baseUrl?: string;
|
|
42
|
+
/** Optional structured logger. */
|
|
43
|
+
logger?: Logger;
|
|
44
|
+
/** Retry behaviour configuration. */
|
|
45
|
+
retry?: Partial<RetryConfig>;
|
|
46
|
+
/** Rate limiter configuration. */
|
|
47
|
+
rateLimiter?: Partial<RateLimiterConfig>;
|
|
48
|
+
/** Optional in-memory media cache for downloaded attachments. */
|
|
49
|
+
mediaCache?: MediaCache;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Composite thread identifier for an Instagram conversation.
|
|
53
|
+
*
|
|
54
|
+
* Uniquely identifies a conversation between a specific Instagram
|
|
55
|
+
* professional account and a user.
|
|
56
|
+
*/
|
|
57
|
+
export interface InstagramThreadId {
|
|
58
|
+
/** The Instagram professional account ID. */
|
|
59
|
+
igId: string;
|
|
60
|
+
/** The Instagram-scoped user ID (IGSID). */
|
|
61
|
+
igsId: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Raw response from the Instagram Messaging API messages endpoint.
|
|
65
|
+
*
|
|
66
|
+
* NOTE: Unlike Messenger, Instagram does NOT return `recipient_id`
|
|
67
|
+
* in the send response.
|
|
68
|
+
*/
|
|
69
|
+
export interface InstagramSendResponse {
|
|
70
|
+
/** Platform-assigned message identifier. */
|
|
71
|
+
message_id: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A quick reply option for Instagram messages.
|
|
75
|
+
*
|
|
76
|
+
* Instagram only supports `content_type: "text"` quick replies.
|
|
77
|
+
* Maximum 13 quick replies per message.
|
|
78
|
+
*/
|
|
79
|
+
export interface InstagramQuickReply {
|
|
80
|
+
/** Must be `"text"`. Instagram only supports text quick replies. */
|
|
81
|
+
content_type: 'text';
|
|
82
|
+
/** Display text for the quick reply button (max 20 chars). */
|
|
83
|
+
title: string;
|
|
84
|
+
/** Payload string returned when the user taps this quick reply. */
|
|
85
|
+
payload: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A button within an Instagram template message.
|
|
89
|
+
*
|
|
90
|
+
* Instagram supports `postback` (sends payload to webhook) and
|
|
91
|
+
* `web_url` (opens a URL in the browser) button types.
|
|
92
|
+
*/
|
|
93
|
+
export interface InstagramButton {
|
|
94
|
+
/** Button type. */
|
|
95
|
+
type: 'postback' | 'web_url';
|
|
96
|
+
/** Display text on the button. */
|
|
97
|
+
title: string;
|
|
98
|
+
/** Payload string (required for `postback` type). */
|
|
99
|
+
payload?: string;
|
|
100
|
+
/** URL to open (required for `web_url` type). */
|
|
101
|
+
url?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* An element within a generic template carousel.
|
|
105
|
+
*
|
|
106
|
+
* Generic templates render as horizontally scrollable cards, each with
|
|
107
|
+
* an optional image, title, subtitle, default tap action, and buttons.
|
|
108
|
+
*/
|
|
109
|
+
export interface InstagramGenericElement {
|
|
110
|
+
/** Card title (required, max 80 chars). */
|
|
111
|
+
title: string;
|
|
112
|
+
/** Image URL displayed at the top of the card. */
|
|
113
|
+
image_url?: string;
|
|
114
|
+
/** Subtitle text below the title (max 80 chars). */
|
|
115
|
+
subtitle?: string;
|
|
116
|
+
/** Action triggered when the card is tapped (outside of buttons). */
|
|
117
|
+
default_action?: {
|
|
118
|
+
type: 'web_url';
|
|
119
|
+
url: string;
|
|
120
|
+
};
|
|
121
|
+
/** Up to 3 buttons displayed at the bottom of the card. */
|
|
122
|
+
buttons?: InstagramButton[];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* A generic template (carousel) message.
|
|
126
|
+
*
|
|
127
|
+
* Supports up to 10 elements displayed as horizontally scrollable cards.
|
|
128
|
+
*/
|
|
129
|
+
export interface InstagramGenericTemplate {
|
|
130
|
+
/** Array of carousel card elements (max 10). */
|
|
131
|
+
elements: InstagramGenericElement[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* A button template message.
|
|
135
|
+
*
|
|
136
|
+
* Displays a text message with up to 3 buttons below it.
|
|
137
|
+
*/
|
|
138
|
+
export interface InstagramButtonTemplate {
|
|
139
|
+
/** Body text displayed above the buttons (max 640 chars). */
|
|
140
|
+
text: string;
|
|
141
|
+
/** Up to 3 buttons. */
|
|
142
|
+
buttons: InstagramButton[];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Options for sending a private reply to an Instagram comment.
|
|
146
|
+
*
|
|
147
|
+
* Uses `recipient.comment_id` instead of `recipient.id` to initiate
|
|
148
|
+
* a DM thread from a comment on a post or reel.
|
|
149
|
+
*/
|
|
150
|
+
export interface PrivateReplyOptions {
|
|
151
|
+
/** The comment ID to reply to privately. */
|
|
152
|
+
commentId: string;
|
|
153
|
+
/** The text message to send as a private reply. */
|
|
154
|
+
text: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* A single ice breaker question-payload pair.
|
|
158
|
+
*
|
|
159
|
+
* Ice breakers appear as suggested conversation starters when a user
|
|
160
|
+
* opens a DM thread for the first time. Tapping one sends a
|
|
161
|
+
* `messaging_postback` webhook event with the specified payload.
|
|
162
|
+
*/
|
|
163
|
+
export interface IceBreaker {
|
|
164
|
+
/** The question text displayed to the user. */
|
|
165
|
+
question: string;
|
|
166
|
+
/** Payload string sent as a postback when the user taps this ice breaker. */
|
|
167
|
+
payload: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Configuration for a set of ice breakers.
|
|
171
|
+
*
|
|
172
|
+
* Each config contains an array of call-to-action items and an
|
|
173
|
+
* optional locale for localization.
|
|
174
|
+
*/
|
|
175
|
+
export interface IceBreakerConfig {
|
|
176
|
+
/** Array of ice breaker items (max 4 per locale). */
|
|
177
|
+
call_to_actions: IceBreaker[];
|
|
178
|
+
/** BCP 47 locale code (e.g. `"en_US"`). Optional. */
|
|
179
|
+
locale?: string;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Message tags supported by Instagram.
|
|
183
|
+
*
|
|
184
|
+
* Instagram only supports the `HUMAN_AGENT` tag, which extends
|
|
185
|
+
* the messaging window to 7 days for live agent handoff scenarios.
|
|
186
|
+
*/
|
|
187
|
+
export type InstagramMessageTag = 'HUMAN_AGENT';
|
|
188
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/instagram/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAMtE;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qFAAqF;IACrF,O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