naystack 1.8.17 → 1.8.18
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/dist/socials/index.cjs.js +15 -0
- package/dist/socials/index.d.mts +5 -2
- package/dist/socials/index.d.ts +5 -2
- package/dist/socials/index.esm.js +11 -0
- package/dist/socials/instagram/setters.cjs.js +9 -0
- package/dist/socials/instagram/setters.d.mts +23 -1
- package/dist/socials/instagram/setters.d.ts +23 -1
- package/dist/socials/instagram/setters.esm.js +8 -0
- package/dist/socials/instagram/utils.d.mts +25 -4
- package/dist/socials/instagram/utils.d.ts +25 -4
- package/dist/socials/threads/utils.d.mts +8 -4
- package/dist/socials/threads/utils.d.ts +8 -4
- package/package.json +1 -1
|
@@ -29,12 +29,16 @@ __export(socials_exports, {
|
|
|
29
29
|
getInstagramConversationByUser: () => getInstagramConversationByUser,
|
|
30
30
|
getInstagramConversations: () => getInstagramConversations,
|
|
31
31
|
getInstagramConversationsByUser: () => getInstagramConversationsByUser,
|
|
32
|
+
getInstagramData: () => getInstagramData,
|
|
32
33
|
getInstagramMedia: () => getInstagramMedia,
|
|
33
34
|
getInstagramMessage: () => getInstagramMessage,
|
|
34
35
|
getInstagramUser: () => getInstagramUser,
|
|
35
36
|
getThread: () => getThread,
|
|
36
37
|
getThreads: () => getThreads,
|
|
38
|
+
getThreadsData: () => getThreadsData,
|
|
37
39
|
getThreadsReplies: () => getThreadsReplies,
|
|
40
|
+
readGraphID: () => readGraphID,
|
|
41
|
+
replyToInstagramComment: () => replyToInstagramComment,
|
|
38
42
|
sendInstagramMessage: () => sendInstagramMessage,
|
|
39
43
|
setupInstagramWebhook: () => setupInstagramWebhook,
|
|
40
44
|
setupThreadsWebhook: () => setupThreadsWebhook
|
|
@@ -352,6 +356,13 @@ var createInstagramPost = async (token, input) => {
|
|
|
352
356
|
input.retry
|
|
353
357
|
);
|
|
354
358
|
};
|
|
359
|
+
var replyToInstagramComment = async (token, commentID, text) => readGraphID(
|
|
360
|
+
"Instagram comment reply",
|
|
361
|
+
await getInstagramData(token, `${commentID}/replies`, {
|
|
362
|
+
params: { message: text },
|
|
363
|
+
method: "POST"
|
|
364
|
+
})
|
|
365
|
+
);
|
|
355
366
|
var sendInstagramMessage = (token, to, text) => {
|
|
356
367
|
return getInstagramData(token, "me/messages", {
|
|
357
368
|
body: {
|
|
@@ -511,12 +522,16 @@ var setupThreadsWebhook = (options) => {
|
|
|
511
522
|
getInstagramConversationByUser,
|
|
512
523
|
getInstagramConversations,
|
|
513
524
|
getInstagramConversationsByUser,
|
|
525
|
+
getInstagramData,
|
|
514
526
|
getInstagramMedia,
|
|
515
527
|
getInstagramMessage,
|
|
516
528
|
getInstagramUser,
|
|
517
529
|
getThread,
|
|
518
530
|
getThreads,
|
|
531
|
+
getThreadsData,
|
|
519
532
|
getThreadsReplies,
|
|
533
|
+
readGraphID,
|
|
534
|
+
replyToInstagramComment,
|
|
520
535
|
sendInstagramMessage,
|
|
521
536
|
setupInstagramWebhook,
|
|
522
537
|
setupThreadsWebhook
|
package/dist/socials/index.d.mts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { canPublishToInstagram, getInstagramConversation, getInstagramConversationByUser, getInstagramConversations, getInstagramConversationsByUser, getInstagramMedia, getInstagramMessage, getInstagramUser } from './instagram/getters.mjs';
|
|
2
|
-
export { createInstagramPost, sendInstagramMessage } from './instagram/setters.mjs';
|
|
2
|
+
export { createInstagramPost, replyToInstagramComment, sendInstagramMessage } from './instagram/setters.mjs';
|
|
3
3
|
export { InstagramConversation, InstagramMedia, InstagramMessage, InstagramPostInput, InstagramPostMedia, InstagramUser } from './instagram/types.mjs';
|
|
4
|
+
export { getInstagramData } from './instagram/utils.mjs';
|
|
4
5
|
export { setupInstagramWebhook } from './instagram/webhook.mjs';
|
|
5
6
|
export { RetryOptions, WaitForContainerOptions } from './meta/container.mjs';
|
|
6
|
-
export {
|
|
7
|
+
export { GraphClient, GraphRequestOptions, readGraphID } from './meta/request.mjs';
|
|
8
|
+
export { GraphError, GraphParams, MetaMediaType } from './meta/types.mjs';
|
|
7
9
|
export { getThread, getThreads, getThreadsReplies } from './threads/getters.mjs';
|
|
8
10
|
export { createThread, createThreadsPost } from './threads/setters.mjs';
|
|
11
|
+
export { getThreadsData } from './threads/utils.mjs';
|
|
9
12
|
export { ThreadsPost, ThreadsPostInput, ThreadsPostMedia } from './threads/types.mjs';
|
|
10
13
|
export { setupThreadsWebhook } from './threads/webhook.mjs';
|
|
11
14
|
import 'next/server';
|
package/dist/socials/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { canPublishToInstagram, getInstagramConversation, getInstagramConversationByUser, getInstagramConversations, getInstagramConversationsByUser, getInstagramMedia, getInstagramMessage, getInstagramUser } from './instagram/getters.js';
|
|
2
|
-
export { createInstagramPost, sendInstagramMessage } from './instagram/setters.js';
|
|
2
|
+
export { createInstagramPost, replyToInstagramComment, sendInstagramMessage } from './instagram/setters.js';
|
|
3
3
|
export { InstagramConversation, InstagramMedia, InstagramMessage, InstagramPostInput, InstagramPostMedia, InstagramUser } from './instagram/types.js';
|
|
4
|
+
export { getInstagramData } from './instagram/utils.js';
|
|
4
5
|
export { setupInstagramWebhook } from './instagram/webhook.js';
|
|
5
6
|
export { RetryOptions, WaitForContainerOptions } from './meta/container.js';
|
|
6
|
-
export {
|
|
7
|
+
export { GraphClient, GraphRequestOptions, readGraphID } from './meta/request.js';
|
|
8
|
+
export { GraphError, GraphParams, MetaMediaType } from './meta/types.js';
|
|
7
9
|
export { getThread, getThreads, getThreadsReplies } from './threads/getters.js';
|
|
8
10
|
export { createThread, createThreadsPost } from './threads/setters.js';
|
|
11
|
+
export { getThreadsData } from './threads/utils.js';
|
|
9
12
|
export { ThreadsPost, ThreadsPostInput, ThreadsPostMedia } from './threads/types.js';
|
|
10
13
|
export { setupThreadsWebhook } from './threads/webhook.js';
|
|
11
14
|
import 'next/server';
|
|
@@ -309,6 +309,13 @@ var createInstagramPost = async (token, input) => {
|
|
|
309
309
|
input.retry
|
|
310
310
|
);
|
|
311
311
|
};
|
|
312
|
+
var replyToInstagramComment = async (token, commentID, text) => readGraphID(
|
|
313
|
+
"Instagram comment reply",
|
|
314
|
+
await getInstagramData(token, `${commentID}/replies`, {
|
|
315
|
+
params: { message: text },
|
|
316
|
+
method: "POST"
|
|
317
|
+
})
|
|
318
|
+
);
|
|
312
319
|
var sendInstagramMessage = (token, to, text) => {
|
|
313
320
|
return getInstagramData(token, "me/messages", {
|
|
314
321
|
body: {
|
|
@@ -467,12 +474,16 @@ export {
|
|
|
467
474
|
getInstagramConversationByUser,
|
|
468
475
|
getInstagramConversations,
|
|
469
476
|
getInstagramConversationsByUser,
|
|
477
|
+
getInstagramData,
|
|
470
478
|
getInstagramMedia,
|
|
471
479
|
getInstagramMessage,
|
|
472
480
|
getInstagramUser,
|
|
473
481
|
getThread,
|
|
474
482
|
getThreads,
|
|
483
|
+
getThreadsData,
|
|
475
484
|
getThreadsReplies,
|
|
485
|
+
readGraphID,
|
|
486
|
+
replyToInstagramComment,
|
|
476
487
|
sendInstagramMessage,
|
|
477
488
|
setupInstagramWebhook,
|
|
478
489
|
setupThreadsWebhook
|
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var setters_exports = {};
|
|
22
22
|
__export(setters_exports, {
|
|
23
23
|
createInstagramPost: () => createInstagramPost,
|
|
24
|
+
replyToInstagramComment: () => replyToInstagramComment,
|
|
24
25
|
sendInstagramMessage: () => sendInstagramMessage
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(setters_exports);
|
|
@@ -242,6 +243,13 @@ var createInstagramPost = async (token, input) => {
|
|
|
242
243
|
input.retry
|
|
243
244
|
);
|
|
244
245
|
};
|
|
246
|
+
var replyToInstagramComment = async (token, commentID, text) => readGraphID(
|
|
247
|
+
"Instagram comment reply",
|
|
248
|
+
await getInstagramData(token, `${commentID}/replies`, {
|
|
249
|
+
params: { message: text },
|
|
250
|
+
method: "POST"
|
|
251
|
+
})
|
|
252
|
+
);
|
|
245
253
|
var sendInstagramMessage = (token, to, text) => {
|
|
246
254
|
return getInstagramData(token, "me/messages", {
|
|
247
255
|
body: {
|
|
@@ -255,5 +263,6 @@ var sendInstagramMessage = (token, to, text) => {
|
|
|
255
263
|
// Annotate the CommonJS export names for ESM import in node:
|
|
256
264
|
0 && (module.exports = {
|
|
257
265
|
createInstagramPost,
|
|
266
|
+
replyToInstagramComment,
|
|
258
267
|
sendInstagramMessage
|
|
259
268
|
});
|
|
@@ -40,6 +40,28 @@ import '../meta/container.mjs';
|
|
|
40
40
|
* @category Socials
|
|
41
41
|
*/
|
|
42
42
|
declare const createInstagramPost: (token: string, input: InstagramPostInput) => Promise<string | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Replies to a comment on one of your Instagram posts, as your account.
|
|
45
|
+
*
|
|
46
|
+
* Needs the `instagram_business_manage_comments` scope. The reply lands in the
|
|
47
|
+
* comment's own thread — Instagram nests one level, so replying to a reply
|
|
48
|
+
* attaches to the same top-level comment.
|
|
49
|
+
*
|
|
50
|
+
* @param token - Instagram access token.
|
|
51
|
+
* @param commentID - The comment being replied to.
|
|
52
|
+
* @param text - Reply text.
|
|
53
|
+
* @returns Promise of the new comment's id, or `null` if the call failed (the API's error is logged).
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { replyToInstagramComment } from "naystack/socials";
|
|
58
|
+
*
|
|
59
|
+
* await replyToInstagramComment(accessToken, commentId, "Applications are open in our bio!");
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @category Socials
|
|
63
|
+
*/
|
|
64
|
+
declare const replyToInstagramComment: (token: string, commentID: string, text: string) => Promise<string | null>;
|
|
43
65
|
/**
|
|
44
66
|
* Sends a text message to an Instagram user via the Instagram Messaging API.
|
|
45
67
|
*
|
|
@@ -63,4 +85,4 @@ declare const sendInstagramMessage: (token: string, to: string, text: string) =>
|
|
|
63
85
|
message_id?: string;
|
|
64
86
|
} & GraphError) | null>;
|
|
65
87
|
|
|
66
|
-
export { createInstagramPost, sendInstagramMessage };
|
|
88
|
+
export { createInstagramPost, replyToInstagramComment, sendInstagramMessage };
|
|
@@ -40,6 +40,28 @@ import '../meta/container.js';
|
|
|
40
40
|
* @category Socials
|
|
41
41
|
*/
|
|
42
42
|
declare const createInstagramPost: (token: string, input: InstagramPostInput) => Promise<string | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Replies to a comment on one of your Instagram posts, as your account.
|
|
45
|
+
*
|
|
46
|
+
* Needs the `instagram_business_manage_comments` scope. The reply lands in the
|
|
47
|
+
* comment's own thread — Instagram nests one level, so replying to a reply
|
|
48
|
+
* attaches to the same top-level comment.
|
|
49
|
+
*
|
|
50
|
+
* @param token - Instagram access token.
|
|
51
|
+
* @param commentID - The comment being replied to.
|
|
52
|
+
* @param text - Reply text.
|
|
53
|
+
* @returns Promise of the new comment's id, or `null` if the call failed (the API's error is logged).
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { replyToInstagramComment } from "naystack/socials";
|
|
58
|
+
*
|
|
59
|
+
* await replyToInstagramComment(accessToken, commentId, "Applications are open in our bio!");
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @category Socials
|
|
63
|
+
*/
|
|
64
|
+
declare const replyToInstagramComment: (token: string, commentID: string, text: string) => Promise<string | null>;
|
|
43
65
|
/**
|
|
44
66
|
* Sends a text message to an Instagram user via the Instagram Messaging API.
|
|
45
67
|
*
|
|
@@ -63,4 +85,4 @@ declare const sendInstagramMessage: (token: string, to: string, text: string) =>
|
|
|
63
85
|
message_id?: string;
|
|
64
86
|
} & GraphError) | null>;
|
|
65
87
|
|
|
66
|
-
export { createInstagramPost, sendInstagramMessage };
|
|
88
|
+
export { createInstagramPost, replyToInstagramComment, sendInstagramMessage };
|
|
@@ -215,6 +215,13 @@ var createInstagramPost = async (token, input) => {
|
|
|
215
215
|
input.retry
|
|
216
216
|
);
|
|
217
217
|
};
|
|
218
|
+
var replyToInstagramComment = async (token, commentID, text) => readGraphID(
|
|
219
|
+
"Instagram comment reply",
|
|
220
|
+
await getInstagramData(token, `${commentID}/replies`, {
|
|
221
|
+
params: { message: text },
|
|
222
|
+
method: "POST"
|
|
223
|
+
})
|
|
224
|
+
);
|
|
218
225
|
var sendInstagramMessage = (token, to, text) => {
|
|
219
226
|
return getInstagramData(token, "me/messages", {
|
|
220
227
|
body: {
|
|
@@ -227,5 +234,6 @@ var sendInstagramMessage = (token, to, text) => {
|
|
|
227
234
|
};
|
|
228
235
|
export {
|
|
229
236
|
createInstagramPost,
|
|
237
|
+
replyToInstagramComment,
|
|
230
238
|
sendInstagramMessage
|
|
231
239
|
};
|
|
@@ -2,12 +2,33 @@ import { GraphError } from '../meta/types.mjs';
|
|
|
2
2
|
import { GraphRequestOptions } from '../meta/request.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Calls the Instagram Graph API directly — the escape hatch for endpoints this
|
|
6
|
+
* module doesn't wrap. Despite the name it does POSTs too: Graph mutations take
|
|
7
|
+
* their arguments as query `params`, so pass `method: "POST"` with `params`.
|
|
8
|
+
*
|
|
9
|
+
* The base URL and API version stay pinned here, so callers never hardcode either.
|
|
10
|
+
* Pair it with {@link readGraphID} to unwrap an `id` and log the API's own error.
|
|
6
11
|
*
|
|
7
12
|
* @param token - Instagram access token.
|
|
8
|
-
* @param path - API path.
|
|
9
|
-
* @param options - `params` (query), `method`, `body`.
|
|
10
|
-
* @returns Promise of `(T & GraphError) | null`.
|
|
13
|
+
* @param path - API path, relative to the versioned root (e.g. `"me/media"`).
|
|
14
|
+
* @param options - See {@link GraphRequestOptions} — `params` (query), `method`, `body`.
|
|
15
|
+
* @returns Promise of `(T & GraphError) | null` — check `.error` before reading `T`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { getInstagramData, readGraphID } from "naystack/socials";
|
|
20
|
+
*
|
|
21
|
+
* // An endpoint with no dedicated helper.
|
|
22
|
+
* const id = readGraphID(
|
|
23
|
+
* "Instagram comment reply",
|
|
24
|
+
* await getInstagramData<{ id: string }>(token, `${commentID}/replies`, {
|
|
25
|
+
* params: { message: "thanks!" },
|
|
26
|
+
* method: "POST",
|
|
27
|
+
* }),
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @category Socials
|
|
11
32
|
*/
|
|
12
33
|
declare const getInstagramData: <T>(token: string, path: string, options?: GraphRequestOptions) => Promise<(T & GraphError) | null>;
|
|
13
34
|
|
|
@@ -2,12 +2,33 @@ import { GraphError } from '../meta/types.js';
|
|
|
2
2
|
import { GraphRequestOptions } from '../meta/request.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Calls the Instagram Graph API directly — the escape hatch for endpoints this
|
|
6
|
+
* module doesn't wrap. Despite the name it does POSTs too: Graph mutations take
|
|
7
|
+
* their arguments as query `params`, so pass `method: "POST"` with `params`.
|
|
8
|
+
*
|
|
9
|
+
* The base URL and API version stay pinned here, so callers never hardcode either.
|
|
10
|
+
* Pair it with {@link readGraphID} to unwrap an `id` and log the API's own error.
|
|
6
11
|
*
|
|
7
12
|
* @param token - Instagram access token.
|
|
8
|
-
* @param path - API path.
|
|
9
|
-
* @param options - `params` (query), `method`, `body`.
|
|
10
|
-
* @returns Promise of `(T & GraphError) | null`.
|
|
13
|
+
* @param path - API path, relative to the versioned root (e.g. `"me/media"`).
|
|
14
|
+
* @param options - See {@link GraphRequestOptions} — `params` (query), `method`, `body`.
|
|
15
|
+
* @returns Promise of `(T & GraphError) | null` — check `.error` before reading `T`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { getInstagramData, readGraphID } from "naystack/socials";
|
|
20
|
+
*
|
|
21
|
+
* // An endpoint with no dedicated helper.
|
|
22
|
+
* const id = readGraphID(
|
|
23
|
+
* "Instagram comment reply",
|
|
24
|
+
* await getInstagramData<{ id: string }>(token, `${commentID}/replies`, {
|
|
25
|
+
* params: { message: "thanks!" },
|
|
26
|
+
* method: "POST",
|
|
27
|
+
* }),
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @category Socials
|
|
11
32
|
*/
|
|
12
33
|
declare const getInstagramData: <T>(token: string, path: string, options?: GraphRequestOptions) => Promise<(T & GraphError) | null>;
|
|
13
34
|
|
|
@@ -2,12 +2,16 @@ import { GraphError } from '../meta/types.mjs';
|
|
|
2
2
|
import { GraphRequestOptions } from '../meta/request.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Calls the Threads Graph API directly — the escape hatch for endpoints this
|
|
6
|
+
* module doesn't wrap. The Instagram counterpart is {@link getInstagramData};
|
|
7
|
+
* see it for the POST-via-`params` convention and an example.
|
|
6
8
|
*
|
|
7
9
|
* @param token - Threads access token.
|
|
8
|
-
* @param path - API path.
|
|
9
|
-
* @param options - `params` (query), `method`, `body`.
|
|
10
|
-
* @returns Promise of `(T & GraphError) | null`.
|
|
10
|
+
* @param path - API path, relative to the versioned root (e.g. `"me/threads"`).
|
|
11
|
+
* @param options - See {@link GraphRequestOptions} — `params` (query), `method`, `body`.
|
|
12
|
+
* @returns Promise of `(T & GraphError) | null` — check `.error` before reading `T`.
|
|
13
|
+
*
|
|
14
|
+
* @category Socials
|
|
11
15
|
*/
|
|
12
16
|
declare const getThreadsData: <T>(token: string, path: string, options?: GraphRequestOptions) => Promise<(T & GraphError) | null>;
|
|
13
17
|
|
|
@@ -2,12 +2,16 @@ import { GraphError } from '../meta/types.js';
|
|
|
2
2
|
import { GraphRequestOptions } from '../meta/request.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Calls the Threads Graph API directly — the escape hatch for endpoints this
|
|
6
|
+
* module doesn't wrap. The Instagram counterpart is {@link getInstagramData};
|
|
7
|
+
* see it for the POST-via-`params` convention and an example.
|
|
6
8
|
*
|
|
7
9
|
* @param token - Threads access token.
|
|
8
|
-
* @param path - API path.
|
|
9
|
-
* @param options - `params` (query), `method`, `body`.
|
|
10
|
-
* @returns Promise of `(T & GraphError) | null`.
|
|
10
|
+
* @param path - API path, relative to the versioned root (e.g. `"me/threads"`).
|
|
11
|
+
* @param options - See {@link GraphRequestOptions} — `params` (query), `method`, `body`.
|
|
12
|
+
* @returns Promise of `(T & GraphError) | null` — check `.error` before reading `T`.
|
|
13
|
+
*
|
|
14
|
+
* @category Socials
|
|
11
15
|
*/
|
|
12
16
|
declare const getThreadsData: <T>(token: string, path: string, options?: GraphRequestOptions) => Promise<(T & GraphError) | null>;
|
|
13
17
|
|