naystack 1.1.4 → 1.1.6

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.
@@ -31,6 +31,7 @@ __export(socials_exports, {
31
31
  getThread: () => getThread,
32
32
  getThreads: () => getThreads,
33
33
  getThreadsReplies: () => getThreadsReplies,
34
+ sendInstagramMessage: () => sendInstagramMessage,
34
35
  setupInstagramWebhook: () => setupInstagramWebhook
35
36
  });
36
37
  module.exports = __toCommonJS(socials_exports);
@@ -109,6 +110,16 @@ var getInstagramMessage = (token, id, fields) => {
109
110
  });
110
111
  };
111
112
 
113
+ // src/socials/instagram/setters.ts
114
+ var sendInstagramMessage = (token, to, text) => {
115
+ return getInstagramData(token, "me/messages", void 0, {
116
+ recipient: { id: to },
117
+ message: {
118
+ text
119
+ }
120
+ });
121
+ };
122
+
112
123
  // src/socials/meta-webhook.ts
113
124
  var import_server = require("next/server");
114
125
  var verifyWebhook = (secret) => (req) => {
@@ -214,5 +225,6 @@ var createThread = async (token, threads) => {
214
225
  getThread,
215
226
  getThreads,
216
227
  getThreadsReplies,
228
+ sendInstagramMessage,
217
229
  setupInstagramWebhook
218
230
  });
@@ -92,9 +92,14 @@ declare const getInstagramConversation: (token: string, id: string, cursor?: str
92
92
  }>;
93
93
  declare const getInstagramMessage: <T = InstagramMessage>(token: string, id: string, fields?: string[]) => Promise<(T & InstagramError) | null>;
94
94
 
95
+ declare const sendInstagramMessage: (token: string, to: string, text: string) => Promise<({
96
+ recipient_id?: string;
97
+ message_id?: string;
98
+ } & InstagramError) | null>;
99
+
95
100
  declare const setupInstagramWebhook: (options: {
96
101
  secret: string;
97
- callback: (type: string, value: unknown) => Promise<void>;
102
+ callback: (type: string, value: Record<string, any>) => Promise<void>;
98
103
  }) => {
99
104
  GET: (req: NextRequest) => next_server.NextResponse<unknown> | undefined;
100
105
  POST: (req: NextRequest) => Promise<Response>;
@@ -113,4 +118,4 @@ declare const getThreadsReplies: <T = ThreadsPost>(token: string, id: string, fi
113
118
  declare const createThreadsPost: (token: string, text: string, reply_to_id?: string) => Promise<string | void | null>;
114
119
  declare const createThread: (token: string, threads: string[]) => Promise<string | undefined>;
115
120
 
116
- export { createThread, createThreadsPost, getInstagramConversation, getInstagramConversationByUser, getInstagramConversations, getInstagramMedia, getInstagramMessage, getInstagramUser, getThread, getThreads, getThreadsReplies, setupInstagramWebhook };
121
+ export { createThread, createThreadsPost, getInstagramConversation, getInstagramConversationByUser, getInstagramConversations, getInstagramMedia, getInstagramMessage, getInstagramUser, getThread, getThreads, getThreadsReplies, sendInstagramMessage, setupInstagramWebhook };
@@ -92,9 +92,14 @@ declare const getInstagramConversation: (token: string, id: string, cursor?: str
92
92
  }>;
93
93
  declare const getInstagramMessage: <T = InstagramMessage>(token: string, id: string, fields?: string[]) => Promise<(T & InstagramError) | null>;
94
94
 
95
+ declare const sendInstagramMessage: (token: string, to: string, text: string) => Promise<({
96
+ recipient_id?: string;
97
+ message_id?: string;
98
+ } & InstagramError) | null>;
99
+
95
100
  declare const setupInstagramWebhook: (options: {
96
101
  secret: string;
97
- callback: (type: string, value: unknown) => Promise<void>;
102
+ callback: (type: string, value: Record<string, any>) => Promise<void>;
98
103
  }) => {
99
104
  GET: (req: NextRequest) => next_server.NextResponse<unknown> | undefined;
100
105
  POST: (req: NextRequest) => Promise<Response>;
@@ -113,4 +118,4 @@ declare const getThreadsReplies: <T = ThreadsPost>(token: string, id: string, fi
113
118
  declare const createThreadsPost: (token: string, text: string, reply_to_id?: string) => Promise<string | void | null>;
114
119
  declare const createThread: (token: string, threads: string[]) => Promise<string | undefined>;
115
120
 
116
- export { createThread, createThreadsPost, getInstagramConversation, getInstagramConversationByUser, getInstagramConversations, getInstagramMedia, getInstagramMessage, getInstagramUser, getThread, getThreads, getThreadsReplies, setupInstagramWebhook };
121
+ export { createThread, createThreadsPost, getInstagramConversation, getInstagramConversationByUser, getInstagramConversations, getInstagramMedia, getInstagramMessage, getInstagramUser, getThread, getThreads, getThreadsReplies, sendInstagramMessage, setupInstagramWebhook };
@@ -72,6 +72,16 @@ var getInstagramMessage = (token, id, fields) => {
72
72
  });
73
73
  };
74
74
 
75
+ // src/socials/instagram/setters.ts
76
+ var sendInstagramMessage = (token, to, text) => {
77
+ return getInstagramData(token, "me/messages", void 0, {
78
+ recipient: { id: to },
79
+ message: {
80
+ text
81
+ }
82
+ });
83
+ };
84
+
75
85
  // src/socials/meta-webhook.ts
76
86
  import { NextResponse } from "next/server";
77
87
  var verifyWebhook = (secret) => (req) => {
@@ -176,5 +186,6 @@ export {
176
186
  getThread,
177
187
  getThreads,
178
188
  getThreadsReplies,
189
+ sendInstagramMessage,
179
190
  setupInstagramWebhook
180
191
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "A stack built with tight Next + Drizzle + GraphQL",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",