@@ -255,52 +255,126 @@ POST /api/chatbot/flows
255255{
256256 "name" : " Feedback Collection" ,
257257 "trigger_keywords" : [" feedback" , " review" ],
258+ "initial_message" : " Hi! I'd like to collect your feedback." ,
259+ "completion_message" : " Thank you for your feedback!" ,
260+ "enabled" : true ,
258261 "steps" : [
259262 {
260- "id" : " welcome" ,
261- "type" : " message" ,
262- "content" : " We'd love to hear your feedback!" ,
263- "next" : " rating"
263+ "step_name" : " rating" ,
264+ "step_order" : 1 ,
265+ "message" : " How would you rate your experience?" ,
266+ "message_type" : " buttons" ,
267+ "input_type" : " select" ,
268+ "buttons" : [
269+ {"id" : " excellent" , "title" : " Excellent" },
270+ {"id" : " good" , "title" : " Good" },
271+ {"id" : " poor" , "title" : " Poor" }
272+ ],
273+ "store_as" : " rating"
264274 },
265275 {
266- "id" : " rating" ,
267- "type" : " input" ,
268- "input_type" : " buttons" ,
269- "content" : " How would you rate your experience?" ,
270- "options" : [" Excellent" , " Good" , " Average" , " Poor" ],
271- "variable" : " rating" ,
272- "next" : " comment"
273- },
274- {
275- "id" : " comment" ,
276- "type" : " input" ,
276+ "step_name" : " comment" ,
277+ "step_order" : 2 ,
278+ "message" : " Any additional comments?" ,
279+ "message_type" : " text" ,
277280 "input_type" : " text" ,
278- "content" : " Any additional comments?" ,
279- "variable" : " comment" ,
280- "next" : " complete"
281+ "store_as" : " comment"
281282 },
282283 {
283- "id" : " complete" ,
284- "type" : " message" ,
285- "content" : " Thank you for your feedback!"
284+ "step_name" : " transfer" ,
285+ "step_order" : 3 ,
286+ "message" : " Connecting you with our team..." ,
287+ "message_type" : " transfer" ,
288+ "transfer_config" : {
289+ "team_id" : " uuid" ,
290+ "notes" : " Rating: {{rating}}"
291+ }
286292 }
287293 ]
288294}
289295```
290296
297+ ### Step Message Types
298+
299+ | Type | Description |
300+ | ------| -------------|
301+ | ` text ` | Send a static text message |
302+ | ` buttons ` | Send message with interactive buttons |
303+ | ` api_fetch ` | Fetch message content from external API |
304+ | ` whatsapp_flow ` | Trigger a native WhatsApp Flow |
305+ | ` transfer ` | Transfer conversation to agent/team and end flow |
306+
307+ ### Transfer Step Configuration
308+
309+ The ` transfer ` message type ends the flow and creates an agent transfer:
310+
311+ ``` json
312+ {
313+ "message_type" : " transfer" ,
314+ "message" : " Connecting you with our support team..." ,
315+ "transfer_config" : {
316+ "team_id" : " uuid" ,
317+ "notes" : " From flow: {{variable_name}}"
318+ }
319+ }
320+ ```
321+
322+ | Field | Description |
323+ | -------| -------------|
324+ | ` team_id ` | Target team UUID (omit for general queue) |
325+ | ` notes ` | Internal notes for agents (supports ` {{variable}} ` placeholders) |
326+
291327## Agent Transfers
292328
293329### List Transfers
294330
295- Get pending agent transfer requests.
331+ Get agent transfer requests.
296332
297333``` bash
298334GET /api/chatbot/transfers
299335```
300336
337+ ### Query Parameters
338+
339+ | Parameter | Type | Description |
340+ | -----------| ------| -------------|
341+ | ` status ` | string | Filter by status: ` active ` or ` resumed ` |
342+ | ` team_id ` | string | Filter by team ID, or ` general ` for general queue |
343+
344+ ### Response
345+
346+ ``` json
347+ {
348+ "status" : " success" ,
349+ "data" : {
350+ "transfers" : [
351+ {
352+ "id" : " uuid" ,
353+ "contact_id" : " uuid" ,
354+ "contact_name" : " John Doe" ,
355+ "phone_number" : " 1234567890" ,
356+ "status" : " active" ,
357+ "source" : " flow" ,
358+ "agent_id" : null ,
359+ "agent_name" : null ,
360+ "team_id" : " uuid" ,
361+ "team_name" : " Sales Team" ,
362+ "notes" : " Interested in enterprise plan" ,
363+ "transferred_at" : " 2024-01-01T12:00:00Z"
364+ }
365+ ],
366+ "general_queue_count" : 3 ,
367+ "team_queue_counts" : {
368+ "team-uuid-1" : 5 ,
369+ "team-uuid-2" : 2
370+ }
371+ }
372+ }
373+ ```
374+
301375### Create Transfer
302376
303- Manually transfer a conversation to a human agent.
377+ Manually transfer a conversation to a human agent or team .
304378
305379``` bash
306380POST /api/chatbot/transfers
@@ -311,7 +385,44 @@ POST /api/chatbot/transfers
311385``` json
312386{
313387 "contact_id" : " uuid" ,
314- "reason" : " Customer requested human support"
388+ "team_id" : " uuid" ,
389+ "notes" : " Customer requested human support"
390+ }
391+ ```
392+
393+ | Field | Type | Required | Description |
394+ | -------| ------| ----------| -------------|
395+ | ` contact_id ` | uuid | Yes | The contact to transfer |
396+ | ` team_id ` | uuid | No | Target team (omit for general queue) |
397+ | ` notes ` | string | No | Internal notes for agents |
398+
399+ ### Pick Next Transfer
400+
401+ Pick the next unassigned transfer from the queue.
402+
403+ ``` bash
404+ POST /api/chatbot/transfers/pickup
405+ ```
406+
407+ ### Query Parameters
408+
409+ | Parameter | Type | Description |
410+ | -----------| ------| -------------|
411+ | ` team_id ` | string | Pick from specific team, or ` general ` for general queue only |
412+
413+ ### Assign Transfer
414+
415+ Assign a transfer to a specific agent.
416+
417+ ``` bash
418+ PUT /api/chatbot/transfers/{id}/assign
419+ ```
420+
421+ ### Request Body
422+
423+ ``` json
424+ {
425+ "agent_id" : " uuid"
315426}
316427```
317428
0 commit comments