mirlo-mcp 1.0.2 → 1.0.3
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.d.ts +2 -2
- package/dist/client.js +17 -4
- package/dist/tools.js +12 -10
- package/package.json +1 -1
- package/src/client.ts +18 -5
- package/src/tools.ts +12 -10
package/dist/client.d.ts
CHANGED
|
@@ -29,8 +29,8 @@ export declare class MirloClient {
|
|
|
29
29
|
createTask(data: Record<string, unknown>): Promise<any>;
|
|
30
30
|
completeTask(id: string): Promise<any>;
|
|
31
31
|
listPipelines(): Promise<any>;
|
|
32
|
-
sendMessage(
|
|
33
|
-
sendTemplate(
|
|
32
|
+
sendMessage(organizationAddress: string, contactAddress: string, text: string, service?: string): Promise<any>;
|
|
33
|
+
sendTemplate(organizationAddress: string, to: string, metaTemplateId: string, components?: any[]): Promise<any>;
|
|
34
34
|
listConversations(filters?: Record<string, string>): Promise<any>;
|
|
35
35
|
listMessages(conversationId: string, limit?: number): Promise<any>;
|
|
36
36
|
listCalls(filters?: Record<string, string>): Promise<any>;
|
package/dist/client.js
CHANGED
|
@@ -105,11 +105,24 @@ export class MirloClient {
|
|
|
105
105
|
return this.request('GET', '/crm/pipelines');
|
|
106
106
|
}
|
|
107
107
|
// ── Messaging ──
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
// Messages API is v2 with org in path
|
|
109
|
+
async sendMessage(organizationAddress, contactAddress, text, service = 'whatsapp') {
|
|
110
|
+
// v2 messages endpoint — org resolved from API key
|
|
111
|
+
return this.request('POST', '/messages', {
|
|
112
|
+
organization_address: organizationAddress,
|
|
113
|
+
service,
|
|
114
|
+
contact_address: contactAddress,
|
|
115
|
+
direction: 'outgoing',
|
|
116
|
+
content: { kind: 'text', text },
|
|
117
|
+
});
|
|
110
118
|
}
|
|
111
|
-
async sendTemplate(to,
|
|
112
|
-
return this.request('POST', '/messages/
|
|
119
|
+
async sendTemplate(organizationAddress, to, metaTemplateId, components) {
|
|
120
|
+
return this.request('POST', '/messages/send-template', {
|
|
121
|
+
organization_address: organizationAddress,
|
|
122
|
+
to,
|
|
123
|
+
meta_template_id: metaTemplateId,
|
|
124
|
+
components,
|
|
125
|
+
});
|
|
113
126
|
}
|
|
114
127
|
async listConversations(filters) {
|
|
115
128
|
const params = filters ? '?' + new URLSearchParams(filters).toString() : '';
|
package/dist/tools.js
CHANGED
|
@@ -242,23 +242,25 @@ const listPipelines = {
|
|
|
242
242
|
// ── Messaging ──
|
|
243
243
|
const sendMessage = {
|
|
244
244
|
name: 'mirlo_send_message',
|
|
245
|
-
description: 'Send a WhatsApp
|
|
245
|
+
description: 'Send a WhatsApp message to a phone number. Only works within the 24h window after the contact messaged you. Use send_template for first contact.',
|
|
246
246
|
schema: z.object({
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
organization_address: z.string().describe('Your WhatsApp Phone Number ID (from Mirlo dashboard)'),
|
|
248
|
+
contact_address: z.string().describe('Recipient phone number WITHOUT + prefix (e.g. 5215512345678)'),
|
|
249
|
+
text: z.string().describe('Message text'),
|
|
250
|
+
service: z.enum(['whatsapp', 'instagram', 'messenger']).optional().default('whatsapp'),
|
|
250
251
|
}),
|
|
251
|
-
handler: async (client, args) => client.sendMessage(args.
|
|
252
|
+
handler: async (client, args) => client.sendMessage(args.organization_address, args.contact_address, args.text, args.service),
|
|
252
253
|
};
|
|
253
254
|
const sendTemplate = {
|
|
254
255
|
name: 'mirlo_send_template',
|
|
255
|
-
description: 'Send a pre-approved WhatsApp template message.',
|
|
256
|
+
description: 'Send a pre-approved WhatsApp template message. Works outside the 24h window.',
|
|
256
257
|
schema: z.object({
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
organization_address: z.string().describe('Your WhatsApp Phone Number ID'),
|
|
259
|
+
to: z.string().describe('Recipient phone number with + prefix (e.g. +525512345678)'),
|
|
260
|
+
meta_template_id: z.string().describe('Meta-approved template ID'),
|
|
261
|
+
components: z.any().optional().describe('Template components array with parameters'),
|
|
260
262
|
}),
|
|
261
|
-
handler: async (client, args) => client.sendTemplate(args.to, args.
|
|
263
|
+
handler: async (client, args) => client.sendTemplate(args.organization_address, args.to, args.meta_template_id, args.components),
|
|
262
264
|
};
|
|
263
265
|
const listConversations = {
|
|
264
266
|
name: 'mirlo_list_conversations',
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -140,13 +140,26 @@ export class MirloClient {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
// ── Messaging ──
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
// Messages API is v2 with org in path
|
|
144
|
+
|
|
145
|
+
async sendMessage(organizationAddress: string, contactAddress: string, text: string, service = 'whatsapp') {
|
|
146
|
+
// v2 messages endpoint — org resolved from API key
|
|
147
|
+
return this.request<any>('POST', '/messages', {
|
|
148
|
+
organization_address: organizationAddress,
|
|
149
|
+
service,
|
|
150
|
+
contact_address: contactAddress,
|
|
151
|
+
direction: 'outgoing',
|
|
152
|
+
content: { kind: 'text', text },
|
|
153
|
+
});
|
|
146
154
|
}
|
|
147
155
|
|
|
148
|
-
async sendTemplate(
|
|
149
|
-
return this.request<any>('POST', '/messages/
|
|
156
|
+
async sendTemplate(organizationAddress: string, to: string, metaTemplateId: string, components?: any[]) {
|
|
157
|
+
return this.request<any>('POST', '/messages/send-template', {
|
|
158
|
+
organization_address: organizationAddress,
|
|
159
|
+
to,
|
|
160
|
+
meta_template_id: metaTemplateId,
|
|
161
|
+
components,
|
|
162
|
+
});
|
|
150
163
|
}
|
|
151
164
|
|
|
152
165
|
async listConversations(filters?: Record<string, string>) {
|
package/src/tools.ts
CHANGED
|
@@ -278,24 +278,26 @@ const listPipelines: ToolDef = {
|
|
|
278
278
|
|
|
279
279
|
const sendMessage: ToolDef = {
|
|
280
280
|
name: 'mirlo_send_message',
|
|
281
|
-
description: 'Send a WhatsApp
|
|
281
|
+
description: 'Send a WhatsApp message to a phone number. Only works within the 24h window after the contact messaged you. Use send_template for first contact.',
|
|
282
282
|
schema: z.object({
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
organization_address: z.string().describe('Your WhatsApp Phone Number ID (from Mirlo dashboard)'),
|
|
284
|
+
contact_address: z.string().describe('Recipient phone number WITHOUT + prefix (e.g. 5215512345678)'),
|
|
285
|
+
text: z.string().describe('Message text'),
|
|
286
|
+
service: z.enum(['whatsapp', 'instagram', 'messenger']).optional().default('whatsapp'),
|
|
286
287
|
}),
|
|
287
|
-
handler: async (client, args) => client.sendMessage(args.
|
|
288
|
+
handler: async (client, args) => client.sendMessage(args.organization_address, args.contact_address, args.text, args.service),
|
|
288
289
|
};
|
|
289
290
|
|
|
290
291
|
const sendTemplate: ToolDef = {
|
|
291
292
|
name: 'mirlo_send_template',
|
|
292
|
-
description: 'Send a pre-approved WhatsApp template message.',
|
|
293
|
+
description: 'Send a pre-approved WhatsApp template message. Works outside the 24h window.',
|
|
293
294
|
schema: z.object({
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
organization_address: z.string().describe('Your WhatsApp Phone Number ID'),
|
|
296
|
+
to: z.string().describe('Recipient phone number with + prefix (e.g. +525512345678)'),
|
|
297
|
+
meta_template_id: z.string().describe('Meta-approved template ID'),
|
|
298
|
+
components: z.any().optional().describe('Template components array with parameters'),
|
|
297
299
|
}),
|
|
298
|
-
handler: async (client, args) => client.sendTemplate(args.to, args.
|
|
300
|
+
handler: async (client, args) => client.sendTemplate(args.organization_address, args.to, args.meta_template_id, args.components),
|
|
299
301
|
};
|
|
300
302
|
|
|
301
303
|
const listConversations: ToolDef = {
|