Limitations
Only the following endpoints support the inject and notify API requests:- Facebook (Meta) Messenger
- LINE Messenger
- Azure Bot Service
- RingCentral Engage
- Slack
- Socket
- Sunshine Conversations
- Cognigy Voice
- Webchat
- Webhook
Inject
An inject API request sends text and data from an external service to a flow. This approach allows you to convert them into complex information, for example, into lists and galleries, and then send it to the user through the endpoint. You can send a simple message to your flow, for example,makeList, along with the data from an external API request, and use the nodes in the flow to recognize the message and send a list to the user with information from an external API.
Notify
A notify API request sends text or data to the user through the endpoint. With this approach, the user receives the text or data from the external API without any additional flow logic.How to use inject and notify
You can use the HTTP Request node or Code node to trigger external processes through the Cognigy API and pass the necessary data to the inject and notify API requests in addition to the specific external payload.Inject and notify API URLs
For the inject and notify API methods, use the endpoint service for the API URL. You can find your endpoint URL and URL token in the endpoint settings under the Endpoint URL field or Config URL field, for Webchat endpoints. The API routes are:- Notify:
{EndpointURL}/notify/{URLToken} - Inject:
{EndpointURL}/inject/{URLToken}
https://endpoint-trial.cognigy.ai/4e5e2f01110c935fff81ec54bbce12c175b831d8105dc69face36a8983feec17, the base URL is https://endpoint-trial.cognigy.ai and URL token is 4e5e2f01110c935fff81ec54bbce12c175b831d8105dc69face36a8983feec17. In this case, the API routes are:
- Notify:
https://endpoint-trial.cognigy.ai/notify/4e5e2f01110c935fff81ec54bbce12c175b831d8105dc69face36a8983feec17 - Inject:
https://endpoint-trial.cognigy.ai/inject/4e5e2f01110c935fff81ec54bbce12c175b831d8105dc69face36a8983feec17
Payload
You can retrieve the necessary data for the inject and notify payload from the input object with CognigyScript, as follows:Response format
Requests to the endpoint service URLs,{EndpointURL}/inject/{URLToken} and {EndpointURL}/notify/{URLToken}, always return a plain-text reply, for example, Message was sent to AI for Flow processing. These URLs ignore the Accept header.
The REST API routes for inject and notify, POST /new/v2.0/endpoint/inject and POST /new/v2.0/endpoint/notify, also return a plain-text reply by default. Some integrations require JSON. To receive the reply in another format, set the Accept header in the request to the REST API route. For all supported Accept values, see Response format.
The shape of the reply depends on the Accept value:
For the REST API routes, authenticate with an API key in the
X-API-Key header and send the URLToken in the request body. For example:
HTTP error codes
When inject or notify API requests fail, the API returns one of the following HTTP error codes:
For the REST API routes, only
400 errors follow the Accept header: the endpoint returns the error message in the requested format. 404 and 500 errors always have an empty body.