Invoke

Invoke an event and receive the response as a NDJSON stream.

See Parsing NDJSON stream for an example on how to parse the response stream.

post
Authorizations
Body
businessIdstringOptional
clientKeystringOptional
sessionIdstringOptional
Responses
200
A successful response.(streaming responses)
application/json
post
POST /external/v1/ai/agent_graph/invoke HTTP/1.1
Host: api.connectly.ai
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 212

{
  "businessId": "text",
  "clientKey": "text",
  "sessionId": "text",
  "inputEvents": [
    {
      "message_event": {
        "role": "USER",
        "content": {
          "text_content": {
            "text": "I want to buy my wife something festive for our christmas party?"
          }
        }
      }
    }
  ]
}
{
  "result": {
    "response": {
      "sessionId": "text",
      "responseEvents": [
        {
          "messageEvent": {
            "role": "MESSAGE_EVENT_ROLE_UNSPECIFIED",
            "content": {
              "textContent": {
                "text": "text"
              },
              "audioContent": {
                "url": "text"
              },
              "imageContent": {
                "url": "text",
                "caption": "text"
              },
              "locationContent": {
                "latitude": 1,
                "longitude": 1,
                "name": "text",
                "address": "text"
              }
            },
            "createdAt": "2025-07-05T16:19:26.105Z",
            "metadata": {}
          },
          "recommendationEvent": {
            "products": [
              {
                "productId": "text",
                "title": "text",
                "description": "text",
                "url": "text",
                "imageUrl": "text",
                "price": 1,
                "currency": "text",
                "facets": {},
                "metadata": {}
              }
            ]
          },
          "chatSuggestionEvent": {
            "suggestedQuestions": [
              "text"
            ]
          },
          "agentHandoverEvent": {
            "triggerHandover": true,
            "reason": "text",
            "reasonNative": "text"
          },
          "storefrontHandoverEvent": {
            "triggerHandover": true,
            "initialSearchPhrase": "text"
          },
          "orderStatusHandoverEvent": {
            "triggerHandover": true
          },
          "locationQueryHandoverEvent": {
            "triggerHandover": true
          },
          "onelivDoctorHandoverEvent": {
            "triggerHandover": true,
            "doctorSpecialty": "text",
            "doctorName": "text",
            "requirements": "text"
          },
          "leadgenHandoverEvent": {
            "triggerHandover": true
          },
          "connectlyInteractiveEvent": {
            "interactive": {
              "listMessage": {
                "header": {
                  "text": "text",
                  "attachment": {
                    "type": "ATTACHMENT_TYPE_UNSPECIFIED",
                    "asset": {
                      "id": "text",
                      "url": "text",
                      "caption": "text",
                      "filename": "text"
                    }
                  }
                },
                "footer": {
                  "text": "text"
                },
                "button": {
                  "id": "text",
                  "text": "text"
                },
                "sections": [
                  {
                    "title": "text",
                    "rows": [
                      {
                        "id": "text",
                        "text": "text",
                        "description": "text"
                      }
                    ]
                  }
                ],
                "buttonText": "text"
              },
              "replyButtonMessage": {
                "header": {
                  "text": "text",
                  "attachment": {
                    "type": "ATTACHMENT_TYPE_UNSPECIFIED",
                    "asset": {
                      "id": "text",
                      "url": "text",
                      "caption": "text",
                      "filename": "text"
                    }
                  }
                },
                "footer": {
                  "text": "text"
                },
                "buttons": [
                  {
                    "id": "text",
                    "text": "text"
                  }
                ]
              },
              "singleProductMessage": {
                "footer": {
                  "text": "text"
                },
                "actionButton": {
                  "id": "text",
                  "text": "text"
                },
                "buttons": [
                  {
                    "id": "text",
                    "text": "text"
                  }
                ],
                "catalogId": "text",
                "productItem": {
                  "productRetailerId": "text"
                }
              },
              "multiProductMessage": {
                "header": {
                  "text": "text",
                  "attachment": {
                    "type": "ATTACHMENT_TYPE_UNSPECIFIED",
                    "asset": {
                      "id": "text",
                      "url": "text",
                      "caption": "text",
                      "filename": "text"
                    }
                  }
                },
                "footer": {
                  "text": "text"
                },
                "actionButton": {
                  "id": "text",
                  "text": "text"
                },
                "buttons": [
                  {
                    "id": "text",
                    "text": "text"
                  }
                ],
                "catalogId": "text",
                "sections": [
                  {
                    "title": "text",
                    "productItems": [
                      {
                        "productRetailerId": "text"
                      }
                    ]
                  }
                ]
              },
              "customWaFlowMessage": {
                "header": {
                  "text": "text",
                  "attachment": {
                    "type": "ATTACHMENT_TYPE_UNSPECIFIED",
                    "asset": {
                      "id": "text",
                      "url": "text",
                      "caption": "text",
                      "filename": "text"
                    }
                  }
                },
                "footer": {
                  "text": "text"
                },
                "parameters": {
                  "flowMessageVersion": "text",
                  "flowToken": "text",
                  "flowName": "text",
                  "flowId": "text",
                  "flowCta": "text",
                  "flowAction": "FLOW_ACTION_UNSPECIFIED",
                  "flowActionPayload": {
                    "screen": "text",
                    "data": {}
                  }
                }
              },
              "callToActionMessage": {
                "header": {
                  "text": "text",
                  "attachment": {
                    "type": "ATTACHMENT_TYPE_UNSPECIFIED",
                    "asset": {
                      "id": "text",
                      "url": "text",
                      "caption": "text",
                      "filename": "text"
                    }
                  }
                },
                "footer": {
                  "text": "text"
                },
                "actionButton": {
                  "text": "text",
                  "url": "text"
                }
              },
              "blipBotSwitchMessage": {
                "botId": "text",
                "switchContext": "text"
              },
              "blipTicketActionMessage": {
                "ticketId": "text",
                "status": "text",
                "agentId": "text"
              },
              "locationRequestMessage": {},
              "blipCommandMessage": {
                "type": "text",
                "method": "text",
                "to": "text",
                "uri": "text",
                "resource": null
              }
            },
            "bodyText": "text"
          },
          "resolutionSurveyEvent": {
            "v1": {
              "intent": "text"
            }
          },
          "storeHandoverEvent": {
            "storeId": "text"
          },
          "blipHandoverEvent": {
            "botId": "text",
            "switchContext": "text"
          },
          "blipCommandEvent": {
            "type": "text",
            "method": "text",
            "to": "text",
            "uri": "text",
            "resource": null
          },
          "sessionCloseEvent": {},
          "eventId": "text"
        }
      ]
    }
  },
  "error": {
    "code": 1,
    "message": "text",
    "details": [
      {
        "@type": "text",
        "ANY_ADDITIONAL_PROPERTY": "anything"
      }
    ]
  }
}

Last updated