naystack 1.1.9 → 1.1.10-beta.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.
|
@@ -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,22 @@ 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
|
+
console.warn((/* @__PURE__ */ new Date()).getTime());
|
|
231
|
+
const payload = await req.json();
|
|
232
|
+
for (const { value, field } of payload.values) {
|
|
233
|
+
await options.callback(field, value);
|
|
234
|
+
}
|
|
235
|
+
console.warn((/* @__PURE__ */ new Date()).getTime());
|
|
236
|
+
return new Response("OK");
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
};
|
|
223
240
|
// Annotate the CommonJS export names for ESM import in node:
|
|
224
241
|
0 && (module.exports = {
|
|
225
242
|
createThread,
|
|
@@ -235,5 +252,6 @@ var createThread = async (token, threads) => {
|
|
|
235
252
|
getThreads,
|
|
236
253
|
getThreadsReplies,
|
|
237
254
|
sendInstagramMessage,
|
|
238
|
-
setupInstagramWebhook
|
|
255
|
+
setupInstagramWebhook,
|
|
256
|
+
setupThreadsWebhook
|
|
239
257
|
});
|
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,22 @@ 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
|
+
console.warn((/* @__PURE__ */ new Date()).getTime());
|
|
191
|
+
const payload = await req.json();
|
|
192
|
+
for (const { value, field } of payload.values) {
|
|
193
|
+
await options.callback(field, value);
|
|
194
|
+
}
|
|
195
|
+
console.warn((/* @__PURE__ */ new Date()).getTime());
|
|
196
|
+
return new Response("OK");
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
};
|
|
184
200
|
export {
|
|
185
201
|
createThread,
|
|
186
202
|
createThreadsPost,
|
|
@@ -195,5 +211,6 @@ export {
|
|
|
195
211
|
getThreads,
|
|
196
212
|
getThreadsReplies,
|
|
197
213
|
sendInstagramMessage,
|
|
198
|
-
setupInstagramWebhook
|
|
214
|
+
setupInstagramWebhook,
|
|
215
|
+
setupThreadsWebhook
|
|
199
216
|
};
|