@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.
- package/CHANGELOG.md +168 -0
- package/SKILL.md +771 -102
- package/moltflow/SKILL.md +463 -0
- package/moltflow-a2a/SKILL.md +437 -0
- package/moltflow-admin/SKILL.md +392 -0
- package/moltflow-ai/SKILL.md +473 -0
- package/moltflow-leads/SKILL.md +275 -0
- package/moltflow-outreach/SKILL.md +379 -0
- package/moltflow-reviews/SKILL.md +242 -0
- package/package.json +18 -4
- package/scripts/a2a_client.py +1 -1
- package/scripts/admin.py +2 -4
- package/scripts/ai_config.py +107 -30
- package/scripts/leads.py +111 -0
- package/scripts/outreach.py +228 -0
- package/scripts/quickstart.py +2 -2
- package/scripts/reviews.py +1 -1
- package/scripts/send_message.py +32 -23
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: moltflow-leads
|
|
3
|
+
description: "WhatsApp lead detection and CRM pipeline. Auto-detect purchase intent in groups, track lead status, bulk operations, CSV/JSON export. Use when: leads, lead detection, pipeline, qualify, convert, bulk status, export leads."
|
|
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 Leads -- Detection & CRM Pipeline
|
|
17
|
+
|
|
18
|
+
Auto-detect purchase-intent leads from monitored WhatsApp groups, track them through a sales pipeline, perform bulk operations, and export for your CRM.
|
|
19
|
+
|
|
20
|
+
## When to Use
|
|
21
|
+
|
|
22
|
+
- "List leads" or "show detected leads"
|
|
23
|
+
- "Update lead status" or "mark lead as contacted"
|
|
24
|
+
- "Bulk update leads" or "change status for multiple leads"
|
|
25
|
+
- "Add leads to group" or "bulk add to custom group"
|
|
26
|
+
- "Export leads as CSV" or "download leads JSON"
|
|
27
|
+
- "Check lead reciprocity" or "has this lead messaged me?"
|
|
28
|
+
- "Filter leads by status" or "search leads"
|
|
29
|
+
|
|
30
|
+
## Prerequisites
|
|
31
|
+
|
|
32
|
+
1. **MOLTFLOW_API_KEY** -- Generate from the [MoltFlow Dashboard](https://molt.waiflow.app) under Settings > API Keys
|
|
33
|
+
2. At least one monitored WhatsApp group with keyword detection enabled
|
|
34
|
+
3. Base URL: `https://apiv2.waiflow.app/api/v2`
|
|
35
|
+
|
|
36
|
+
## Authentication
|
|
37
|
+
|
|
38
|
+
Every request must include one of:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Authorization: Bearer <jwt_token>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
or
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
X-API-Key: <your_api_key>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## How Lead Detection Works
|
|
53
|
+
|
|
54
|
+
1. You monitor WhatsApp groups via the Groups API (see `moltflow` skill)
|
|
55
|
+
2. Set `monitor_mode: "keywords"` with keywords like `"looking for"`, `"price"`, `"interested"`
|
|
56
|
+
3. When a group member sends a message matching your keywords, MoltFlow auto-creates a lead
|
|
57
|
+
4. Leads appear in the Leads API with status `new` and the triggering keyword highlighted
|
|
58
|
+
5. You track them through the pipeline: `new` -> `contacted` -> `qualified` -> `converted`
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Leads API
|
|
63
|
+
|
|
64
|
+
| Method | Endpoint | Description |
|
|
65
|
+
|--------|----------|-------------|
|
|
66
|
+
| GET | `/leads` | List leads (filter by status, group, search) |
|
|
67
|
+
| GET | `/leads/{id}` | Get lead details |
|
|
68
|
+
| PATCH | `/leads/{id}/status` | Update lead status (state machine validated) |
|
|
69
|
+
| GET | `/leads/{id}/reciprocity` | Check if lead messaged you first (anti-spam) |
|
|
70
|
+
| POST | `/leads/bulk/status` | Bulk update lead status |
|
|
71
|
+
| POST | `/leads/bulk/add-to-group` | Bulk add leads to custom group |
|
|
72
|
+
| GET | `/leads/export/csv` | Export as CSV (Pro+ plan, max 10,000) |
|
|
73
|
+
| GET | `/leads/export/json` | Export as JSON (Pro+ plan, max 10,000) |
|
|
74
|
+
|
|
75
|
+
### List Leads
|
|
76
|
+
|
|
77
|
+
**GET** `/leads`
|
|
78
|
+
|
|
79
|
+
Query parameters:
|
|
80
|
+
|
|
81
|
+
| Parameter | Type | Description |
|
|
82
|
+
|-----------|------|-------------|
|
|
83
|
+
| `status` | string | Filter by status (`new`, `contacted`, `qualified`, `converted`, `lost`) |
|
|
84
|
+
| `source_group_id` | UUID | Filter by source monitored group |
|
|
85
|
+
| `search` | string | Search in contact name, phone, or keyword |
|
|
86
|
+
| `limit` | int | Page size (default 50) |
|
|
87
|
+
| `offset` | int | Pagination offset |
|
|
88
|
+
|
|
89
|
+
**Response** `200 OK`:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"leads": [
|
|
94
|
+
{
|
|
95
|
+
"id": "lead-uuid-...",
|
|
96
|
+
"contact_phone": "+15550123456",
|
|
97
|
+
"contact_name": "John D.",
|
|
98
|
+
"lead_status": "new",
|
|
99
|
+
"lead_score": 0,
|
|
100
|
+
"lead_detected_at": "2026-02-12T14:30:00Z",
|
|
101
|
+
"source_group": {
|
|
102
|
+
"id": "group-uuid-...",
|
|
103
|
+
"name": "Real Estate IL"
|
|
104
|
+
},
|
|
105
|
+
"trigger": {
|
|
106
|
+
"matched_keyword": "interested in buying",
|
|
107
|
+
"message_preview": "Hi, I'm interested in buying a 3-bedroom...",
|
|
108
|
+
"monitor_mode": "keywords",
|
|
109
|
+
"detected_at": "2026-02-12T14:30:00Z"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"total": 47,
|
|
114
|
+
"limit": 50,
|
|
115
|
+
"offset": 0
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Get Lead Details
|
|
120
|
+
|
|
121
|
+
**GET** `/leads/{id}`
|
|
122
|
+
|
|
123
|
+
Returns full lead info including group context, detection metadata, message count, and status.
|
|
124
|
+
|
|
125
|
+
### Update Lead Status
|
|
126
|
+
|
|
127
|
+
**PATCH** `/leads/{id}/status`
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"status": "contacted"
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**State machine validation** -- only valid transitions are allowed:
|
|
136
|
+
|
|
137
|
+
- `new` -> `contacted`, `qualified`, `converted`, `lost`
|
|
138
|
+
- `contacted` -> `qualified`, `converted`, `lost`
|
|
139
|
+
- `qualified` -> `converted`, `lost`
|
|
140
|
+
- `converted` -> (terminal -- no further transitions)
|
|
141
|
+
- `lost` -> `new` (reopen only)
|
|
142
|
+
|
|
143
|
+
Invalid transitions return `400 Bad Request`.
|
|
144
|
+
|
|
145
|
+
### Reciprocity Check
|
|
146
|
+
|
|
147
|
+
**GET** `/leads/{id}/reciprocity?session_id=session-uuid`
|
|
148
|
+
|
|
149
|
+
The `session_id` query parameter is **required** -- it specifies which WhatsApp session to check inbound messages from.
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"lead_id": "lead-uuid-...",
|
|
154
|
+
"has_messaged_first": true,
|
|
155
|
+
"last_inbound_at": "2026-02-12T15:00:00Z"
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Use this before reaching out -- if the lead hasn't messaged you directly, sending a cold message may trigger WhatsApp spam detection.
|
|
160
|
+
|
|
161
|
+
### Bulk Status Update
|
|
162
|
+
|
|
163
|
+
**POST** `/leads/bulk/status`
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"lead_ids": ["uuid1", "uuid2", "uuid3"],
|
|
168
|
+
"status": "contacted"
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Response** `200 OK`:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"updated": 3,
|
|
177
|
+
"failed": 0,
|
|
178
|
+
"errors": []
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Each lead is individually validated against the state machine. Leads with invalid transitions are reported in `errors` but don't block the rest.
|
|
183
|
+
|
|
184
|
+
### Bulk Add to Custom Group
|
|
185
|
+
|
|
186
|
+
**POST** `/leads/bulk/add-to-group`
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"lead_ids": ["uuid1", "uuid2"],
|
|
191
|
+
"custom_group_id": "custom-group-uuid-..."
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Adds leads' phone numbers to the specified custom group for use with Bulk Send or Scheduled Messages.
|
|
196
|
+
|
|
197
|
+
### Export Leads
|
|
198
|
+
|
|
199
|
+
**GET** `/leads/export/csv` -- Returns CSV file download
|
|
200
|
+
**GET** `/leads/export/json` -- Returns JSON array
|
|
201
|
+
|
|
202
|
+
Both support optional filters: `status`, `source_group_id`, `search`. Max 10,000 rows per export.
|
|
203
|
+
|
|
204
|
+
**Requires Pro plan or above.**
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Examples
|
|
209
|
+
|
|
210
|
+
### Full workflow: Detect -> Qualify -> Outreach
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# 1. List new leads from a specific group
|
|
214
|
+
curl "https://apiv2.waiflow.app/api/v2/leads?status=new&source_group_id=group-uuid" \
|
|
215
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY"
|
|
216
|
+
|
|
217
|
+
# 2. Check reciprocity before reaching out
|
|
218
|
+
curl "https://apiv2.waiflow.app/api/v2/leads/{lead_id}/reciprocity?session_id=session-uuid" \
|
|
219
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY"
|
|
220
|
+
|
|
221
|
+
# 3. Update status to contacted
|
|
222
|
+
curl -X PATCH https://apiv2.waiflow.app/api/v2/leads/{lead_id}/status \
|
|
223
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY" \
|
|
224
|
+
-H "Content-Type: application/json" \
|
|
225
|
+
-d '{"status": "contacted"}'
|
|
226
|
+
|
|
227
|
+
# 4. Bulk add qualified leads to a custom group for follow-up
|
|
228
|
+
curl -X POST https://apiv2.waiflow.app/api/v2/leads/bulk/add-to-group \
|
|
229
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY" \
|
|
230
|
+
-H "Content-Type: application/json" \
|
|
231
|
+
-d '{
|
|
232
|
+
"lead_ids": ["uuid1", "uuid2", "uuid3"],
|
|
233
|
+
"custom_group_id": "follow-up-group-uuid"
|
|
234
|
+
}'
|
|
235
|
+
|
|
236
|
+
# 5. Export all converted leads as CSV
|
|
237
|
+
curl "https://apiv2.waiflow.app/api/v2/leads/export/csv?status=converted" \
|
|
238
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY" \
|
|
239
|
+
-o converted-leads.csv
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Plan Requirements
|
|
245
|
+
|
|
246
|
+
| Feature | Free | Starter | Pro | Business |
|
|
247
|
+
|---------|------|---------|-----|----------|
|
|
248
|
+
| Lead detection | Yes (2 groups) | Yes (5 groups) | Yes (20 groups) | Yes (100 groups) |
|
|
249
|
+
| Lead list & detail | Yes | Yes | Yes | Yes |
|
|
250
|
+
| Status update | Yes | Yes | Yes | Yes |
|
|
251
|
+
| Bulk operations | -- | -- | Yes | Yes |
|
|
252
|
+
| CSV/JSON export | -- | -- | Yes | Yes |
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Error Responses
|
|
257
|
+
|
|
258
|
+
| Status | Meaning |
|
|
259
|
+
|--------|---------|
|
|
260
|
+
| 400 | Invalid status transition or bad request |
|
|
261
|
+
| 401 | Unauthorized (missing or invalid auth) |
|
|
262
|
+
| 403 | Forbidden (plan limit or feature gate) |
|
|
263
|
+
| 404 | Lead not found |
|
|
264
|
+
| 429 | Rate limited |
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Related Skills
|
|
269
|
+
|
|
270
|
+
- **moltflow** -- Core API: sessions, messaging, groups, labels, webhooks
|
|
271
|
+
- **moltflow-outreach** -- Bulk Send, Scheduled Messages, Custom Groups
|
|
272
|
+
- **moltflow-ai** -- AI-powered auto-replies, voice transcription, RAG, style profiles
|
|
273
|
+
- **moltflow-a2a** -- Agent-to-Agent protocol, encrypted messaging, content policy
|
|
274
|
+
- **moltflow-reviews** -- Review collection and testimonial management
|
|
275
|
+
- **moltflow-admin** -- Platform administration, user management, plan configuration
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: moltflow-outreach
|
|
3
|
+
description: "Bulk messaging, scheduled messages, and custom groups for WhatsApp outreach. Use when: bulk send, broadcast, schedule message, cron, custom group, contact list, ban-safe messaging."
|
|
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 Outreach -- Bulk Send, Scheduled Messages & Custom Groups
|
|
17
|
+
|
|
18
|
+
Broadcast to custom contact lists with ban-safe throttling, schedule recurring messages with timezone support, and manage targeted contact groups for WhatsApp outreach.
|
|
19
|
+
|
|
20
|
+
## When to Use
|
|
21
|
+
|
|
22
|
+
- "Send bulk message" or "broadcast to group"
|
|
23
|
+
- "Schedule a WhatsApp message" or "set up recurring message"
|
|
24
|
+
- "Create a contact list" or "build custom group"
|
|
25
|
+
- "Pause bulk send" or "cancel scheduled message"
|
|
26
|
+
- "Export group members as CSV" or "import contacts"
|
|
27
|
+
- "Send weekly update" or "set up cron schedule"
|
|
28
|
+
|
|
29
|
+
## Prerequisites
|
|
30
|
+
|
|
31
|
+
1. **MOLTFLOW_API_KEY** -- Generate from the [MoltFlow Dashboard](https://molt.waiflow.app) under Settings > API Keys
|
|
32
|
+
2. At least one connected WhatsApp session (status: `working`)
|
|
33
|
+
3. Base URL: `https://apiv2.waiflow.app/api/v2`
|
|
34
|
+
|
|
35
|
+
## Authentication
|
|
36
|
+
|
|
37
|
+
Every request must include one of:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Authorization: Bearer <jwt_token>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
or
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
X-API-Key: <your_api_key>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Custom Groups
|
|
52
|
+
|
|
53
|
+
Build targeted contact lists for Bulk Send and Scheduled Messages. Custom Groups are MoltFlow contact lists -- not WhatsApp groups.
|
|
54
|
+
|
|
55
|
+
| Method | Endpoint | Description |
|
|
56
|
+
|--------|----------|-------------|
|
|
57
|
+
| GET | `/custom-groups` | List all custom groups |
|
|
58
|
+
| POST | `/custom-groups` | Create group (with optional initial members) |
|
|
59
|
+
| GET | `/custom-groups/contacts` | List all unique contacts across sessions |
|
|
60
|
+
| GET | `/custom-groups/{id}` | Group details with members |
|
|
61
|
+
| PATCH | `/custom-groups/{id}` | Update group name |
|
|
62
|
+
| DELETE | `/custom-groups/{id}` | Delete group and members |
|
|
63
|
+
| POST | `/custom-groups/{id}/members/add` | Add members (skips duplicates) |
|
|
64
|
+
| POST | `/custom-groups/{id}/members/remove` | Remove members by phone |
|
|
65
|
+
| GET | `/custom-groups/{id}/export/csv` | Export members as CSV |
|
|
66
|
+
| GET | `/custom-groups/{id}/export/json` | Export members as JSON |
|
|
67
|
+
|
|
68
|
+
### Create Custom Group
|
|
69
|
+
|
|
70
|
+
**POST** `/custom-groups`
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"name": "VIP Clients",
|
|
75
|
+
"members": [
|
|
76
|
+
{"phone": "+15550123456"},
|
|
77
|
+
{"phone": "+15550987654", "name": "Jane Doe"}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Members is an array of objects with `phone` (required) and `name` (optional). Omit `members` to create an empty group.
|
|
83
|
+
|
|
84
|
+
**Response** `201 Created`:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"id": "group-uuid-...",
|
|
89
|
+
"name": "VIP Clients",
|
|
90
|
+
"member_count": 2,
|
|
91
|
+
"created_at": "2026-02-12T10:00:00Z"
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Add Members
|
|
96
|
+
|
|
97
|
+
**POST** `/custom-groups/{id}/members/add`
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"contacts": [
|
|
102
|
+
{"phone": "+15551112222"},
|
|
103
|
+
{"phone": "+15553334444", "name": "Bob Smith"}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Each contact is an object with `phone` (required) and `name` (optional). Max 1,000 per request. Duplicates are silently skipped.
|
|
109
|
+
|
|
110
|
+
### Export Members
|
|
111
|
+
|
|
112
|
+
**GET** `/custom-groups/{id}/export/csv` -- Returns CSV download
|
|
113
|
+
**GET** `/custom-groups/{id}/export/json` -- Returns JSON array
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Bulk Send
|
|
118
|
+
|
|
119
|
+
Broadcast messages to a custom group with ban-safe throttling. Random 30s-2min delays between messages simulate human behavior.
|
|
120
|
+
|
|
121
|
+
| Method | Endpoint | Description |
|
|
122
|
+
|--------|----------|-------------|
|
|
123
|
+
| POST | `/bulk-send` | Create bulk send job (quota reserved) |
|
|
124
|
+
| GET | `/bulk-send` | List all bulk send jobs |
|
|
125
|
+
| GET | `/bulk-send/{id}` | Job details with recipients |
|
|
126
|
+
| POST | `/bulk-send/{id}/pause` | Pause running job |
|
|
127
|
+
| POST | `/bulk-send/{id}/resume` | Resume paused job |
|
|
128
|
+
| POST | `/bulk-send/{id}/cancel` | Cancel job (releases unused quota) |
|
|
129
|
+
| GET | `/bulk-send/{id}/progress` | Real-time progress via SSE |
|
|
130
|
+
|
|
131
|
+
### Create Bulk Send Job
|
|
132
|
+
|
|
133
|
+
**POST** `/bulk-send`
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"session_id": "session-uuid-...",
|
|
138
|
+
"custom_group_id": "custom-group-uuid-...",
|
|
139
|
+
"message_content": "Special offer for our VIP clients!"
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
| Field | Type | Required | Description |
|
|
144
|
+
|-------|------|----------|-------------|
|
|
145
|
+
| `session_id` | UUID | Yes | WhatsApp session to send from |
|
|
146
|
+
| `custom_group_id` | UUID | Yes | Target custom group |
|
|
147
|
+
| `message_type` | string | No | `text` (default) or `media` |
|
|
148
|
+
| `message_content` | string | Conditional | Message text (max 4096 chars). Required if no `media_url` |
|
|
149
|
+
| `media_url` | string | Conditional | HTTP(S) URL for media. Required if no `message_content` |
|
|
150
|
+
|
|
151
|
+
**Response** `201 Created`:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"id": "job-uuid-...",
|
|
156
|
+
"session_id": "session-uuid-...",
|
|
157
|
+
"custom_group_id": "custom-group-uuid-...",
|
|
158
|
+
"status": "running",
|
|
159
|
+
"total_recipients": 127,
|
|
160
|
+
"sent_count": 0,
|
|
161
|
+
"failed_count": 0,
|
|
162
|
+
"created_at": "2026-02-12T10:00:00Z"
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Stream Progress (SSE)
|
|
167
|
+
|
|
168
|
+
**GET** `/bulk-send/{id}/progress`
|
|
169
|
+
|
|
170
|
+
Returns Server-Sent Events with real-time updates:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
data: {"sent": 45, "total": 127, "failed": 0, "status": "running"}
|
|
174
|
+
data: {"sent": 46, "total": 127, "failed": 0, "status": "running"}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Job Status Values
|
|
178
|
+
|
|
179
|
+
`pending` -> `running` -> `completed` / `paused` / `cancelled` / `failed`
|
|
180
|
+
|
|
181
|
+
### Anti-Ban Safety
|
|
182
|
+
|
|
183
|
+
- Random 30s-2min delays between messages
|
|
184
|
+
- Typing simulation before each message
|
|
185
|
+
- Seen/read indicators marked automatically
|
|
186
|
+
- Burst rate limiting (4 msgs/2 min)
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Scheduled Messages
|
|
191
|
+
|
|
192
|
+
Schedule one-time or recurring WhatsApp messages to custom groups with timezone support and full lifecycle control.
|
|
193
|
+
|
|
194
|
+
| Method | Endpoint | Description |
|
|
195
|
+
|--------|----------|-------------|
|
|
196
|
+
| GET | `/scheduled-messages` | List all scheduled messages |
|
|
197
|
+
| POST | `/scheduled-messages` | Create schedule (one-time or recurring) |
|
|
198
|
+
| GET | `/scheduled-messages/{id}` | Schedule details with execution history |
|
|
199
|
+
| PATCH | `/scheduled-messages/{id}` | Update schedule and recalculate next run |
|
|
200
|
+
| POST | `/scheduled-messages/{id}/cancel` | Cancel schedule |
|
|
201
|
+
| POST | `/scheduled-messages/{id}/pause` | Pause active schedule |
|
|
202
|
+
| POST | `/scheduled-messages/{id}/resume` | Resume paused schedule |
|
|
203
|
+
| DELETE | `/scheduled-messages/{id}` | Delete cancelled/completed schedule |
|
|
204
|
+
| GET | `/scheduled-messages/{id}/history` | Execution history (paginated) |
|
|
205
|
+
|
|
206
|
+
### Create One-Time Schedule
|
|
207
|
+
|
|
208
|
+
**POST** `/scheduled-messages`
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"name": "Follow-up",
|
|
213
|
+
"session_id": "session-uuid-...",
|
|
214
|
+
"custom_group_id": "custom-group-uuid-...",
|
|
215
|
+
"schedule_type": "one_time",
|
|
216
|
+
"message_content": "Just checking in on your order!",
|
|
217
|
+
"scheduled_time": "2026-02-15T09:00:00",
|
|
218
|
+
"timezone": "Asia/Jerusalem"
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Create Recurring Schedule (Cron)
|
|
223
|
+
|
|
224
|
+
**POST** `/scheduled-messages`
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"name": "Weekly Update",
|
|
229
|
+
"session_id": "session-uuid-...",
|
|
230
|
+
"custom_group_id": "custom-group-uuid-...",
|
|
231
|
+
"schedule_type": "cron",
|
|
232
|
+
"message_content": "Weekly team report is ready!",
|
|
233
|
+
"cron_expression": "0 9 * * MON",
|
|
234
|
+
"timezone": "America/New_York"
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Response** `201 Created`:
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"id": "schedule-uuid-...",
|
|
243
|
+
"name": "Weekly Update",
|
|
244
|
+
"status": "active",
|
|
245
|
+
"schedule_type": "cron",
|
|
246
|
+
"cron_expression": "0 9 * * MON",
|
|
247
|
+
"timezone": "America/New_York",
|
|
248
|
+
"next_run_at": "2026-02-17T09:00:00-05:00",
|
|
249
|
+
"created_at": "2026-02-12T10:00:00Z"
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Schedule Types
|
|
254
|
+
|
|
255
|
+
- `one_time` -- Single send at `scheduled_time`
|
|
256
|
+
- `daily` -- Every day (requires `cron_expression`)
|
|
257
|
+
- `weekly` -- Every week (requires `cron_expression`)
|
|
258
|
+
- `monthly` -- Every month (requires `cron_expression`)
|
|
259
|
+
- `cron` -- Custom cron expression (e.g., `0 9 * * MON-FRI`)
|
|
260
|
+
|
|
261
|
+
**Note:** All recurring types (`daily`, `weekly`, `monthly`, `cron`) require a `cron_expression`. Minimum interval: 5 minutes.
|
|
262
|
+
|
|
263
|
+
### Required Fields
|
|
264
|
+
|
|
265
|
+
| Field | Type | Required | Description |
|
|
266
|
+
|-------|------|----------|-------------|
|
|
267
|
+
| `name` | string | Yes | Schedule name (1-255 chars) |
|
|
268
|
+
| `session_id` | UUID | Yes | WhatsApp session to send from |
|
|
269
|
+
| `custom_group_id` | UUID | Yes | Target custom group |
|
|
270
|
+
| `schedule_type` | string | Yes | One of: `one_time`, `daily`, `weekly`, `monthly`, `cron` |
|
|
271
|
+
| `message_type` | string | No | `text` (default) or `media` |
|
|
272
|
+
| `message_content` | string | Conditional | Message text (max 4096). Required if no `media_url` |
|
|
273
|
+
| `media_url` | string | Conditional | HTTP(S) URL. Required if no `message_content` |
|
|
274
|
+
| `scheduled_time` | datetime | Conditional | ISO 8601. Required for `one_time` |
|
|
275
|
+
| `cron_expression` | string | Conditional | Cron string. Required for recurring types |
|
|
276
|
+
| `timezone` | string | No | IANA timezone (default: `UTC`) |
|
|
277
|
+
|
|
278
|
+
### Schedule Status Values
|
|
279
|
+
|
|
280
|
+
`active` -> `paused` / `cancelled` / `completed`
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Examples
|
|
285
|
+
|
|
286
|
+
### Full workflow: Group -> Bulk Send -> Schedule
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# 1. Create a custom group
|
|
290
|
+
curl -X POST https://apiv2.waiflow.app/api/v2/custom-groups \
|
|
291
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY" \
|
|
292
|
+
-H "Content-Type: application/json" \
|
|
293
|
+
-d '{"name": "VIP Clients"}'
|
|
294
|
+
|
|
295
|
+
# 2. Add members to the group
|
|
296
|
+
curl -X POST https://apiv2.waiflow.app/api/v2/custom-groups/{group_id}/members/add \
|
|
297
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY" \
|
|
298
|
+
-H "Content-Type: application/json" \
|
|
299
|
+
-d '{"contacts": [{"phone": "+15550123456"}, {"phone": "+15550987654"}, {"phone": "+15551112222"}]}'
|
|
300
|
+
|
|
301
|
+
# 3. Bulk send to the group
|
|
302
|
+
curl -X POST https://apiv2.waiflow.app/api/v2/bulk-send \
|
|
303
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY" \
|
|
304
|
+
-H "Content-Type: application/json" \
|
|
305
|
+
-d '{
|
|
306
|
+
"session_id": "session-uuid-...",
|
|
307
|
+
"custom_group_id": "group-uuid-...",
|
|
308
|
+
"message_content": "Exclusive offer for our VIP clients!"
|
|
309
|
+
}'
|
|
310
|
+
|
|
311
|
+
# 4. Schedule a weekly follow-up to the group
|
|
312
|
+
curl -X POST https://apiv2.waiflow.app/api/v2/scheduled-messages \
|
|
313
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY" \
|
|
314
|
+
-H "Content-Type: application/json" \
|
|
315
|
+
-d '{
|
|
316
|
+
"name": "Weekly VIP Update",
|
|
317
|
+
"session_id": "session-uuid-...",
|
|
318
|
+
"custom_group_id": "group-uuid-...",
|
|
319
|
+
"schedule_type": "cron",
|
|
320
|
+
"message_content": "Weekly report is ready!",
|
|
321
|
+
"cron_expression": "0 9 * * MON",
|
|
322
|
+
"timezone": "Asia/Jerusalem"
|
|
323
|
+
}'
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Pause and resume a bulk send
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
# Pause
|
|
330
|
+
curl -X POST https://apiv2.waiflow.app/api/v2/bulk-send/{job_id}/pause \
|
|
331
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY"
|
|
332
|
+
|
|
333
|
+
# Resume
|
|
334
|
+
curl -X POST https://apiv2.waiflow.app/api/v2/bulk-send/{job_id}/resume \
|
|
335
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY"
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Export group members
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
curl https://apiv2.waiflow.app/api/v2/custom-groups/{group_id}/export/csv \
|
|
342
|
+
-H "X-API-Key: $MOLTFLOW_API_KEY" \
|
|
343
|
+
-o vip-clients.csv
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Plan Limits
|
|
349
|
+
|
|
350
|
+
| Feature | Free | Starter | Pro | Business |
|
|
351
|
+
|---------|------|---------|-----|----------|
|
|
352
|
+
| Custom Groups | 2 | 5 | 20 | 100 |
|
|
353
|
+
| Bulk Send | -- | Yes | Yes | Yes |
|
|
354
|
+
| Scheduled Messages | -- | Yes | Yes | Yes |
|
|
355
|
+
| Messages/month | 50 | 500 | 1,500 | 3,000 |
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Error Responses
|
|
360
|
+
|
|
361
|
+
| Status | Meaning |
|
|
362
|
+
|--------|---------|
|
|
363
|
+
| 400 | Bad request (invalid input) |
|
|
364
|
+
| 401 | Unauthorized (missing or invalid auth) |
|
|
365
|
+
| 403 | Forbidden (plan limit or feature gate) |
|
|
366
|
+
| 404 | Resource not found |
|
|
367
|
+
| 422 | Validation error (missing required fields) |
|
|
368
|
+
| 429 | Rate limited |
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Related Skills
|
|
373
|
+
|
|
374
|
+
- **moltflow** -- Core API: sessions, messaging, groups, labels, webhooks
|
|
375
|
+
- **moltflow-leads** -- Lead detection, pipeline tracking, bulk operations, CSV/JSON export
|
|
376
|
+
- **moltflow-ai** -- AI-powered auto-replies, voice transcription, RAG, style profiles
|
|
377
|
+
- **moltflow-a2a** -- Agent-to-Agent protocol, encrypted messaging, content policy
|
|
378
|
+
- **moltflow-reviews** -- Review collection and testimonial management
|
|
379
|
+
- **moltflow-admin** -- Platform administration, user management, plan configuration
|