mirlo-mcp 1.1.0 → 1.1.2
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/client.js +6 -3
- package/package.json +1 -1
- package/src/client.ts +6 -3
package/dist/client.js
CHANGED
|
@@ -149,9 +149,8 @@ export class MirloClient {
|
|
|
149
149
|
throw new Error('Could not resolve organization_id. Provide --org-id=UUID or ensure your API key has CRM data.');
|
|
150
150
|
}
|
|
151
151
|
async messagesRequest(method, path, body) {
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
const url = `${msgBase}/organizations/${orgId}${path}`;
|
|
152
|
+
// Messages API v1 — org resolved from API key by APISIX (no org in path)
|
|
153
|
+
const url = `${this.baseUrl}${path}`;
|
|
155
154
|
const res = await fetch(url, {
|
|
156
155
|
method,
|
|
157
156
|
headers: { 'X-API-Key': this.apiKey, 'Content-Type': 'application/json' },
|
|
@@ -164,7 +163,9 @@ export class MirloClient {
|
|
|
164
163
|
return res.json();
|
|
165
164
|
}
|
|
166
165
|
async sendMessage(organizationAddress, contactAddress, text, service = 'whatsapp') {
|
|
166
|
+
const orgId = await this.resolveOrgId();
|
|
167
167
|
return this.messagesRequest('POST', '/messages', {
|
|
168
|
+
organization_id: orgId,
|
|
168
169
|
organization_address: organizationAddress,
|
|
169
170
|
service,
|
|
170
171
|
contact_address: contactAddress,
|
|
@@ -173,7 +174,9 @@ export class MirloClient {
|
|
|
173
174
|
});
|
|
174
175
|
}
|
|
175
176
|
async sendTemplate(organizationAddress, to, metaTemplateId, components) {
|
|
177
|
+
const orgId = await this.resolveOrgId();
|
|
176
178
|
return this.messagesRequest('POST', '/messages/send-template', {
|
|
179
|
+
organization_id: orgId,
|
|
177
180
|
organization_address: organizationAddress,
|
|
178
181
|
to,
|
|
179
182
|
meta_template_id: metaTemplateId,
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -184,9 +184,8 @@ export class MirloClient {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
private async messagesRequest<T>(method: string, path: string, body?: unknown): Promise<T> {
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
const url = `${msgBase}/organizations/${orgId}${path}`;
|
|
187
|
+
// Messages API v1 — org resolved from API key by APISIX (no org in path)
|
|
188
|
+
const url = `${this.baseUrl}${path}`;
|
|
190
189
|
const res = await fetch(url, {
|
|
191
190
|
method,
|
|
192
191
|
headers: { 'X-API-Key': this.apiKey, 'Content-Type': 'application/json' },
|
|
@@ -200,7 +199,9 @@ export class MirloClient {
|
|
|
200
199
|
}
|
|
201
200
|
|
|
202
201
|
async sendMessage(organizationAddress: string, contactAddress: string, text: string, service = 'whatsapp') {
|
|
202
|
+
const orgId = await this.resolveOrgId();
|
|
203
203
|
return this.messagesRequest<any>('POST', '/messages', {
|
|
204
|
+
organization_id: orgId,
|
|
204
205
|
organization_address: organizationAddress,
|
|
205
206
|
service,
|
|
206
207
|
contact_address: contactAddress,
|
|
@@ -210,7 +211,9 @@ export class MirloClient {
|
|
|
210
211
|
}
|
|
211
212
|
|
|
212
213
|
async sendTemplate(organizationAddress: string, to: string, metaTemplateId: string, components?: any[]) {
|
|
214
|
+
const orgId = await this.resolveOrgId();
|
|
213
215
|
return this.messagesRequest<any>('POST', '/messages/send-template', {
|
|
216
|
+
organization_id: orgId,
|
|
214
217
|
organization_address: organizationAddress,
|
|
215
218
|
to,
|
|
216
219
|
meta_template_id: metaTemplateId,
|