naystack 1.1.9 → 1.1.10-beta.0
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.
|
@@ -33,7 +33,8 @@ __export(socials_exports, {
|
|
|
33
33
|
getThreads: () => getThreads,
|
|
34
34
|
getThreadsReplies: () => getThreadsReplies,
|
|
35
35
|
sendInstagramMessage: () => sendInstagramMessage,
|
|
36
|
-
setupInstagramWebhook: () => setupInstagramWebhook
|
|
36
|
+
setupInstagramWebhook: () => setupInstagramWebhook,
|
|
37
|
+
setupThreadsWebhook: () => setupThreadsWebhook
|
|
37
38
|
});
|
|
38
39
|
module.exports = __toCommonJS(socials_exports);
|
|
39
40
|
|
|
@@ -220,6 +221,21 @@ var createThread = async (token, threads) => {
|
|
|
220
221
|
}
|
|
221
222
|
return publishedIDs[0];
|
|
222
223
|
};
|
|
224
|
+
|
|
225
|
+
// src/socials/threads/webhook.ts
|
|
226
|
+
var setupThreadsWebhook = (options) => {
|
|
227
|
+
return {
|
|
228
|
+
GET: verifyWebhook(options.secret),
|
|
229
|
+
POST: async (req) => {
|
|
230
|
+
const payload = await req.json();
|
|
231
|
+
console.warn(payload.app_id, payload.target_id, payload.subscription_id);
|
|
232
|
+
for (const { value, field } of payload.values) {
|
|
233
|
+
await options.callback(field, value);
|
|
234
|
+
}
|
|
235
|
+
return new Response("OK");
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
};
|
|
223
239
|
// Annotate the CommonJS export names for ESM import in node:
|
|
224
240
|
0 && (module.exports = {
|
|
225
241
|
createThread,
|
|
@@ -235,5 +251,6 @@ var createThread = async (token, threads) => {
|
|
|
235
251
|
getThreads,
|
|
236
252
|
getThreadsReplies,
|
|
237
253
|
sendInstagramMessage,
|
|
238
|
-
setupInstagramWebhook
|
|
254
|
+
setupInstagramWebhook,
|
|
255
|
+
setupThreadsWebhook
|
|
239
256
|
});
|
package/dist/socials/index.d.mts
CHANGED
|
@@ -119,4 +119,12 @@ declare const getThreadsReplies: <T = ThreadsPost>(token: string, id: string, fi
|
|
|
119
119
|
declare const createThreadsPost: (token: string, text: string, reply_to_id?: string) => Promise<string | void | null>;
|
|
120
120
|
declare const createThread: (token: string, threads: string[]) => Promise<string | undefined>;
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
declare const setupThreadsWebhook: (options: {
|
|
123
|
+
secret: string;
|
|
124
|
+
callback: (type: string, value: any) => Promise<void>;
|
|
125
|
+
}) => {
|
|
126
|
+
GET: (req: NextRequest) => next_server.NextResponse<unknown> | undefined;
|
|
127
|
+
POST: (req: NextRequest) => Promise<Response>;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export { createThread, createThreadsPost, getInstagramConversation, getInstagramConversationByUser, getInstagramConversations, getInstagramConversationsByUser, getInstagramMedia, getInstagramMessage, getInstagramUser, getThread, getThreads, getThreadsReplies, sendInstagramMessage, setupInstagramWebhook, setupThreadsWebhook };
|
package/dist/socials/index.d.ts
CHANGED
|
@@ -119,4 +119,12 @@ declare const getThreadsReplies: <T = ThreadsPost>(token: string, id: string, fi
|
|
|
119
119
|
declare const createThreadsPost: (token: string, text: string, reply_to_id?: string) => Promise<string | void | null>;
|
|
120
120
|
declare const createThread: (token: string, threads: string[]) => Promise<string | undefined>;
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
declare const setupThreadsWebhook: (options: {
|
|
123
|
+
secret: string;
|
|
124
|
+
callback: (type: string, value: any) => Promise<void>;
|
|
125
|
+
}) => {
|
|
126
|
+
GET: (req: NextRequest) => next_server.NextResponse<unknown> | undefined;
|
|
127
|
+
POST: (req: NextRequest) => Promise<Response>;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export { createThread, createThreadsPost, getInstagramConversation, getInstagramConversationByUser, getInstagramConversations, getInstagramConversationsByUser, getInstagramMedia, getInstagramMessage, getInstagramUser, getThread, getThreads, getThreadsReplies, sendInstagramMessage, setupInstagramWebhook, setupThreadsWebhook };
|
|
@@ -181,6 +181,21 @@ var createThread = async (token, threads) => {
|
|
|
181
181
|
}
|
|
182
182
|
return publishedIDs[0];
|
|
183
183
|
};
|
|
184
|
+
|
|
185
|
+
// src/socials/threads/webhook.ts
|
|
186
|
+
var setupThreadsWebhook = (options) => {
|
|
187
|
+
return {
|
|
188
|
+
GET: verifyWebhook(options.secret),
|
|
189
|
+
POST: async (req) => {
|
|
190
|
+
const payload = await req.json();
|
|
191
|
+
console.warn(payload.app_id, payload.target_id, payload.subscription_id);
|
|
192
|
+
for (const { value, field } of payload.values) {
|
|
193
|
+
await options.callback(field, value);
|
|
194
|
+
}
|
|
195
|
+
return new Response("OK");
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
};
|
|
184
199
|
export {
|
|
185
200
|
createThread,
|
|
186
201
|
createThreadsPost,
|
|
@@ -195,5 +210,6 @@ export {
|
|
|
195
210
|
getThreads,
|
|
196
211
|
getThreadsReplies,
|
|
197
212
|
sendInstagramMessage,
|
|
198
|
-
setupInstagramWebhook
|
|
213
|
+
setupInstagramWebhook,
|
|
214
|
+
setupThreadsWebhook
|
|
199
215
|
};
|