@moltflow/skills 1.3.0 → 2.0.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.
@@ -0,0 +1,437 @@
1
+ ---
2
+ name: moltflow-a2a
3
+ description: "Agent-to-Agent protocol for MoltFlow: agent discovery, encrypted messaging, group management, content policy. Use when: a2a, agent card, agent message, encrypted, content policy, agent discovery."
4
+ source: "MoltFlow Team"
5
+ version: "2.0.0"
6
+ risk: safe
7
+ requiredEnv:
8
+ - MOLTFLOW_API_KEY
9
+ primaryEnv: MOLTFLOW_API_KEY
10
+ disableModelInvocation: true
11
+ ---
12
+
13
+ > **MoltFlow** -- WhatsApp Business automation for teams. Connect, monitor, and automate WhatsApp at scale.
14
+ > [Save up to 17% with yearly billing](https://molt.waiflow.app/checkout?plan=free) -- Free tier available, no credit card required.
15
+
16
+ # MoltFlow A2A (Agent-to-Agent) Protocol
17
+
18
+ Enables AI agents to communicate securely through MoltFlow using the A2A protocol. Supports agent discovery, encrypted messaging, group management, and configurable content policies.
19
+
20
+ ## When to Use
21
+
22
+ - "Discover an agent" or "get agent card"
23
+ - "Send A2A message" or "agent-to-agent communication"
24
+ - "Get encryption public key" or "rotate keys"
25
+ - "Set content policy" or "configure content filter"
26
+ - "Create agent group" or "invite agent to group"
27
+ - "Test content against policy" or "check policy stats"
28
+ - "Set up webhook via A2A" or "manage agent webhooks"
29
+
30
+ ## Prerequisites
31
+
32
+ 1. **MOLTFLOW_API_KEY** -- Generate from the [MoltFlow Dashboard](https://molt.waiflow.app) under Settings > API Keys
33
+ 2. Base URL: `https://apiv2.waiflow.app/api/v2`
34
+ 3. Agent discovery endpoint: `https://apiv2.waiflow.app/.well-known/agent.json`
35
+ 4. Encryption keys are managed server-side -- external agents only need the API key
36
+
37
+ ## Authentication
38
+
39
+ Every request must include one of:
40
+
41
+ ```
42
+ Authorization: Bearer <jwt_token>
43
+ ```
44
+
45
+ or
46
+
47
+ ```
48
+ X-API-Key: <your_api_key>
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Agent Discovery
54
+
55
+ Discover MoltFlow agent capabilities using the standard `.well-known` endpoint.
56
+
57
+ | Method | Endpoint | Description |
58
+ |--------|----------|-------------|
59
+ | GET | `/.well-known/agent.json` | Agent card (capabilities, skills, public key) |
60
+
61
+ ### Agent Card
62
+
63
+ **GET** `https://apiv2.waiflow.app/.well-known/agent.json`
64
+
65
+ ```json
66
+ {
67
+ "name": "MoltFlow",
68
+ "description": "WhatsApp Business automation agent",
69
+ "url": "https://apiv2.waiflow.app",
70
+ "version": "1.2.0",
71
+ "capabilities": {
72
+ "messaging": true,
73
+ "groups": true,
74
+ "encryption": "X25519-ECDH-AES-256-GCM",
75
+ "webhooks": true
76
+ },
77
+ "skills": [
78
+ "agent.message.send",
79
+ "agent.group.create",
80
+ "agent.group.invite",
81
+ "agent.group.list",
82
+ "group.getContext",
83
+ "webhook_manager"
84
+ ],
85
+ "public_key": "base64-encoded-X25519-public-key"
86
+ }
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Encryption
92
+
93
+ MoltFlow uses X25519 ECDH key exchange with AES-256-GCM encryption for A2A message confidentiality. Keys are managed server-side -- you do not need to handle cryptographic operations directly.
94
+
95
+ | Method | Endpoint | Description |
96
+ |--------|----------|-------------|
97
+ | GET | `/agent/public-key` | Get platform X25519 public key |
98
+ | GET | `/agent/peer/{tenant_id}/public-key` | Get a tenant's public key |
99
+ | POST | `/agent/rotate-keys` | Rotate encryption keys |
100
+ | GET | `/agent/capabilities` | Get encryption capabilities |
101
+ | POST | `/agent/initialize` | Initialize encryption for tenant |
102
+ | GET | `/agent/bootstrap` | Skill bootstrap info |
103
+
104
+ ### Get Public Key
105
+
106
+ **GET** `/agent/public-key`
107
+
108
+ ```json
109
+ {"public_key": "base64-encoded-X25519-public-key", "algorithm": "X25519", "created_at": "2026-02-11T10:00:00Z"}
110
+ ```
111
+
112
+ **GET** `/agent/peer/{tenant_id}/public-key` -- Retrieve another tenant's public key for encrypted communication.
113
+
114
+ ### How Encryption Works
115
+
116
+ Each tenant has an X25519 keypair generated on initialization. When sending A2A messages, the server performs ECDH key exchange, encrypts with AES-256-GCM, and decrypts on the receiving end. All key management is server-side -- API clients send plaintext and the platform handles encryption transparently.
117
+
118
+ ---
119
+
120
+ ## A2A JSON-RPC
121
+
122
+ The core A2A endpoint accepts JSON-RPC 2.0 requests. All agent-to-agent operations go through this single endpoint.
123
+
124
+ | Method | Endpoint | Description |
125
+ |--------|----------|-------------|
126
+ | POST | `/a2a` | JSON-RPC 2.0 endpoint |
127
+ | GET | `/a2a/schema` | Get A2A method schema |
128
+
129
+ ### Request Format
130
+
131
+ ```json
132
+ {
133
+ "jsonrpc": "2.0",
134
+ "method": "agent.message.send",
135
+ "params": { ... },
136
+ "id": 1
137
+ }
138
+ ```
139
+
140
+ ### Response Format
141
+
142
+ ```json
143
+ {
144
+ "jsonrpc": "2.0",
145
+ "result": { ... },
146
+ "id": 1
147
+ }
148
+ ```
149
+
150
+ ### Available Methods
151
+
152
+ | Method | Description |
153
+ |--------|-------------|
154
+ | `agent.message.send` | Send a WhatsApp message via A2A |
155
+ | `agent.group.create` | Create a new WhatsApp group |
156
+ | `agent.group.invite` | Invite participants to a group |
157
+ | `agent.group.list` | List available groups |
158
+ | `group.getContext` | Get conversation context for a group |
159
+ | `webhook_manager` | Manage webhooks via A2A |
160
+
161
+ ---
162
+
163
+ ### agent.message.send
164
+
165
+ Send a WhatsApp message through the A2A protocol.
166
+
167
+ **Request:**
168
+
169
+ ```json
170
+ {
171
+ "jsonrpc": "2.0",
172
+ "method": "agent.message.send",
173
+ "params": {
174
+ "session_id": "a1b2c3d4-...",
175
+ "to": "+5511999999999",
176
+ "message": "Hello from Agent!",
177
+ "metadata": {
178
+ "source_agent": "my-crm-agent",
179
+ "correlation_id": "req-123"
180
+ }
181
+ },
182
+ "id": 1
183
+ }
184
+ ```
185
+
186
+ **Parameters:**
187
+
188
+ | Field | Type | Required | Description |
189
+ |-------|------|----------|-------------|
190
+ | `session_id` | string | Yes | UUID of the WhatsApp session |
191
+ | `to` | string | Yes | E.164 phone number (e.g., `+5511999999999`) |
192
+ | `message` | string | Yes | Message text (max 4096 chars) |
193
+ | `metadata` | object | No | Arbitrary metadata for tracking |
194
+
195
+ **Response:**
196
+
197
+ ```json
198
+ {
199
+ "jsonrpc": "2.0",
200
+ "result": {
201
+ "message_id": "wa-msg-id-...",
202
+ "status": "sent",
203
+ "timestamp": "2026-02-11T10:05:00Z"
204
+ },
205
+ "id": 1
206
+ }
207
+ ```
208
+
209
+ ### agent.group.create / agent.group.invite / agent.group.list
210
+
211
+ Group management methods share a common pattern:
212
+
213
+ ```json
214
+ // Create group
215
+ {"jsonrpc":"2.0","method":"agent.group.create","params":{"session_id":"...","name":"Support Team","participants":["+5511999999999"]},"id":2}
216
+
217
+ // Invite to group
218
+ {"jsonrpc":"2.0","method":"agent.group.invite","params":{"session_id":"...","group_id":"120363012345678901@g.us","participants":["+5511777777777"]},"id":3}
219
+
220
+ // List groups (supports limit/offset pagination)
221
+ {"jsonrpc":"2.0","method":"agent.group.list","params":{"session_id":"...","limit":20,"offset":0},"id":4}
222
+ ```
223
+
224
+ ### group.getContext
225
+
226
+ Retrieve conversation context for a monitored group. Useful for context-aware agent responses.
227
+
228
+ ```json
229
+ {"jsonrpc":"2.0","method":"group.getContext","params":{"session_id":"...","group_id":"120363012345678901@g.us","limit":50},"id":5}
230
+ ```
231
+
232
+ ### webhook_manager
233
+
234
+ Manage webhooks via A2A. Actions: `create`, `list`, `update`, `delete`
235
+
236
+ ```json
237
+ {"jsonrpc":"2.0","method":"webhook_manager","params":{"action":"create","webhook":{"name":"Agent Events","url":"https://my-agent.com/events","events":["message.received"]}},"id":6}
238
+ ```
239
+
240
+ ---
241
+
242
+ ### JSON-RPC Error Codes
243
+
244
+ | Code | Meaning |
245
+ |------|---------|
246
+ | -32600 | Invalid request |
247
+ | -32601 | Method not found |
248
+ | -32602 | Invalid params |
249
+ | -32603 | Internal error |
250
+ | -32000 | Rate limited |
251
+ | -32001 | Content policy violation |
252
+ | -32002 | Safeguard blocked |
253
+
254
+ **Error response:**
255
+
256
+ ```json
257
+ {
258
+ "jsonrpc": "2.0",
259
+ "error": {
260
+ "code": -32602,
261
+ "message": "Invalid phone number format. Expected E.164 (e.g., +5511999999999)"
262
+ },
263
+ "id": 1
264
+ }
265
+ ```
266
+
267
+ ---
268
+
269
+ ## Content Policy
270
+
271
+ Configure content filtering rules for A2A communications. Policies control what content agents can send and receive.
272
+
273
+ | Method | Endpoint | Description |
274
+ |--------|----------|-------------|
275
+ | GET | `/a2a-policy/settings` | Get policy settings |
276
+ | PUT | `/a2a-policy/settings` | Update policy settings |
277
+ | POST | `/a2a-policy/rules` | Create a custom rule |
278
+ | PUT | `/a2a-policy/rules/{rule_id}` | Update a rule |
279
+ | DELETE | `/a2a-policy/rules/{rule_id}` | Delete a rule |
280
+ | POST | `/a2a-policy/rules/{rule_id}/toggle` | Enable/disable a rule |
281
+ | POST | `/a2a-policy/test` | Test content against policy |
282
+ | POST | `/a2a-policy/reset` | Reset policy to defaults |
283
+ | GET | `/a2a-policy/stats` | Get policy enforcement stats |
284
+ | GET | `/a2a-policy/safeguards` | Get safeguard configuration |
285
+
286
+ ### Get / Update Settings
287
+
288
+ **GET** `/a2a-policy/settings` returns current policy. **PUT** `/a2a-policy/settings` updates it.
289
+
290
+ ```json
291
+ {
292
+ "enabled": true,
293
+ "input_sanitization_enabled": true,
294
+ "output_filtering_enabled": true,
295
+ "block_urls": false,
296
+ "block_phone_numbers": false,
297
+ "max_message_length": 4096,
298
+ "allowed_languages": ["en", "pt", "es"]
299
+ }
300
+ ```
301
+
302
+ ### Create Custom Rule
303
+
304
+ **POST** `/a2a-policy/rules`
305
+
306
+ ```json
307
+ {
308
+ "name": "Block competitor mentions",
309
+ "pattern": "\\b(competitor1|competitor2)\\b",
310
+ "action": "block",
311
+ "description": "Prevent mentions of competitor brands"
312
+ }
313
+ ```
314
+
315
+ **Response** `200 OK`:
316
+
317
+ ```json
318
+ {
319
+ "id": "rule-uuid-...",
320
+ "name": "Block competitor mentions",
321
+ "pattern": "\\b(competitor1|competitor2)\\b",
322
+ "action": "block",
323
+ "is_active": true,
324
+ "created_at": "2026-02-11T10:00:00Z"
325
+ }
326
+ ```
327
+
328
+ ### Test Content
329
+
330
+ **POST** `/a2a-policy/test` -- Test a message against your policy without sending it.
331
+
332
+ ```json
333
+ // Request
334
+ {"content": "Check out https://example.com for more info"}
335
+
336
+ // Response
337
+ {"allowed": false, "blocked_reason": "URL detected and block_urls is enabled", "matched_rules": ["built-in:block_urls"], "filtered_content": "Check out [URL REMOVED] for more info"}
338
+ ```
339
+
340
+ ### Policy Stats
341
+
342
+ **GET** `/a2a-policy/stats` -- Returns `total_checked`, `total_blocked`, `total_filtered`, and `top_rules` with hit counts.
343
+
344
+ ---
345
+
346
+ ## Rate Limits (A2A)
347
+
348
+ A2A methods have per-method rate limits:
349
+
350
+ | Method | Limit |
351
+ |--------|-------|
352
+ | `agent.message.send` | 30/min |
353
+ | `agent.group.create` | 5/min |
354
+ | `agent.group.invite` | 10/min |
355
+ | `agent.group.list` | 60/min |
356
+ | `group.getContext` | 30/min |
357
+ | `webhook_manager` | 20/min |
358
+
359
+ Rate limit errors return JSON-RPC error code `-32000`.
360
+
361
+ ---
362
+
363
+ ## Examples
364
+
365
+ ### Discover the MoltFlow agent
366
+
367
+ ```bash
368
+ curl https://apiv2.waiflow.app/.well-known/agent.json
369
+ ```
370
+
371
+ ### Send a message via A2A
372
+
373
+ ```bash
374
+ curl -X POST https://apiv2.waiflow.app/api/v2/a2a \
375
+ -H "X-API-Key: $MOLTFLOW_API_KEY" \
376
+ -H "Content-Type: application/json" \
377
+ -d '{
378
+ "jsonrpc": "2.0",
379
+ "method": "agent.message.send",
380
+ "params": {
381
+ "session_id": "a1b2c3d4-...",
382
+ "to": "+5511999999999",
383
+ "message": "Hello from my AI agent!"
384
+ },
385
+ "id": 1
386
+ }'
387
+ ```
388
+
389
+ ### Set up a content policy rule
390
+
391
+ ```bash
392
+ curl -X POST https://apiv2.waiflow.app/api/v2/a2a-policy/rules \
393
+ -H "X-API-Key: $MOLTFLOW_API_KEY" \
394
+ -H "Content-Type: application/json" \
395
+ -d '{
396
+ "name": "No external links",
397
+ "pattern": "https?://",
398
+ "action": "block",
399
+ "description": "Block all URLs in A2A messages"
400
+ }'
401
+ ```
402
+
403
+ ### Test content against policy
404
+
405
+ ```bash
406
+ curl -X POST https://apiv2.waiflow.app/api/v2/a2a-policy/test \
407
+ -H "X-API-Key: $MOLTFLOW_API_KEY" \
408
+ -H "Content-Type: application/json" \
409
+ -d '{
410
+ "content": "Visit https://example.com for details"
411
+ }'
412
+ ```
413
+
414
+ ---
415
+
416
+ ## Security Model
417
+
418
+ Security layers: TLS 1.3 (transport) -> X25519 ECDH (key exchange) -> AES-256-GCM (message encryption) -> API Key/JWT (auth) -> AgentSafeguard (input validation) -> A2AContentFilter (content policy) -> TieredRateLimiter (rate limits) -> AuditLog (full audit trail).
419
+
420
+ All encryption key management is handled server-side. External agents authenticate with `MOLTFLOW_API_KEY` and the platform handles everything else transparently.
421
+
422
+ ---
423
+
424
+ ## Error Responses
425
+
426
+ Standard HTTP errors: `400` (bad request), `401` (unauthorized), `403` (policy violation), `404` (not found), `429` (rate limited). JSON-RPC errors use codes listed above.
427
+
428
+ ---
429
+
430
+ ## Related Skills
431
+
432
+ - **moltflow** -- Core API: sessions, messaging, groups, labels, webhooks
433
+ - **moltflow-outreach** -- Bulk Send, Scheduled Messages, Custom Groups
434
+ - **moltflow-leads** -- Lead detection, pipeline tracking, bulk operations, CSV/JSON export
435
+ - **moltflow-ai** -- AI-powered auto-replies, voice transcription, RAG knowledge base, style profiles
436
+ - **moltflow-reviews** -- Review collection and testimonial management
437
+ - **moltflow-admin** -- Platform administration, user management, plan configuration