> For the complete documentation index, see [llms.txt](https://help.clickatell.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.clickatell.com/developers-api-reference/wait-for-callback.md).

# Wait For Callback

## Wait for an external system to initiate a callback (GET)

> GET variant of the Wait for Callback API, for external systems that can only issue GET requests. Behaves identically to the POST operation, except no additional data can be supplied (there is no request body).\<br />\<br />\<b>Result and reference are mandatory.\</b> Both \<code>result\</code> and \<code>reference\</code> must be supplied, either as query parameters or as header parameters. If a value is supplied in both places, the query parameter takes precedence. If either value is missing from both the query parameters and the headers, the request is rejected with a 400 Bad Request.\<br />\<br />\<b>Content-Type header required.\</b> The request must include the header \<code>Content-Type: application/json\</code> even though a GET request has no body, otherwise it is rejected with a 415 Unsupported Media Type.

```json
{"openapi":"3.0.2","info":{"title":"Flow","version":"1.1.0"},"servers":[{"url":"https://flow-callback.clickatell.com","description":"Production server"},{"url":"https://flow-callback-handler-sandbox.clickatell.com","description":"Sandbox/UAT server"}],"paths":{"/chat/callback":{"get":{"tags":["Wait for Callback"],"summary":"Wait for an external system to initiate a callback (GET)","description":"GET variant of the Wait for Callback API, for external systems that can only issue GET requests. Behaves identically to the POST operation, except no additional data can be supplied (there is no request body).<br /><br /><b>Result and reference are mandatory.</b> Both <code>result</code> and <code>reference</code> must be supplied, either as query parameters or as header parameters. If a value is supplied in both places, the query parameter takes precedence. If either value is missing from both the query parameters and the headers, the request is rejected with a 400 Bad Request.<br /><br /><b>Content-Type header required.</b> The request must include the header <code>Content-Type: application/json</code> even though a GET request has no body, otherwise it is rejected with a 415 Unsupported Media Type.","parameters":[{"name":"reference","in":"query","description":"The reference used to identify the session (the UUID set on the Wait for Callback node). Required — must be passed either as this query parameter or as the `reference` header. Takes precedence over the header if both are supplied.","required":false,"schema":{"type":"string"}},{"name":"result","in":"query","description":"The callback result used to evaluate the outcome in Flow. Required — must be passed either as this query parameter or as the `result` header. Takes precedence over the header if both are supplied.","required":false,"schema":{"type":"string"}},{"name":"reference","in":"header","description":"The reference used to identify the session (the UUID set on the Wait for Callback node). Required — must be passed either as this header or as the `reference` query parameter. Ignored if the query parameter is supplied.","required":false,"schema":{"type":"string"}},{"name":"result","in":"header","description":"The callback result used to evaluate the outcome in Flow. Required — must be passed either as this header or as the `result` query parameter. Ignored if the query parameter is supplied.","required":false,"schema":{"type":"string"}}],"responses":{"202":{"description":"Successfully validated the response and returned data appended to matched session."},"204":{"description":"Callback has previously been processed in is being ignored."},"400":{"description":"`result` or `reference` is missing (not supplied as either a query parameter or a header), or a bad/invalid reference was returned and the session could not be matched, or the session has expired."},"410":{"description":"The session or callback state for the supplied reference could not be found (e.g. it has expired or was never registered)."},"415":{"description":"The `Content-Type: application/json` header was not supplied."}}}}}}
```

## Wait for an external system to initiate a callback

> The Wait for Callback node was created to facilitate an asynchronous process external to Chat Flow. For example waiting for an external client system to generate an invoice.\<br />\<br />This node will block the flow until a callback was received or the timed out was reached. The timeout is 1 minute less that the session length.\<br/> \<br />This node should be used in conjunction with the Set Variable Node to first set a UUID as a variable and then use that UUID in the Reference Field on the node and in the Callback API so that the Callback Handler can identify that the callback belong to a specific session.\<br />\<br/>Once the callback is received the end-user can then continue with the conversational workflow according to the steps defined in Flow.\<br />\<br />\<b>Result and reference are mandatory.\</b> Both \<code>result\</code> and \<code>reference\</code> must be supplied, either as query parameters or as header parameters. If a value is supplied in both places, the query parameter takes precedence. If either value is missing from both the query parameters and the headers, the request is rejected with a 400 Bad Request.\<br />\<br />\<b>Content-Type header required.\</b> When a request body is sent, the request must include the header \<code>Content-Type: application/json\</code>, otherwise it is rejected with a 415 Unsupported Media Type.

```json
{"openapi":"3.0.2","info":{"title":"Flow","version":"1.1.0"},"servers":[{"url":"https://flow-callback.clickatell.com","description":"Production server"},{"url":"https://flow-callback-handler-sandbox.clickatell.com","description":"Sandbox/UAT server"}],"paths":{"/chat/callback":{"post":{"tags":["Wait for Callback"],"summary":"Wait for an external system to initiate a callback","description":"The Wait for Callback node was created to facilitate an asynchronous process external to Chat Flow. For example waiting for an external client system to generate an invoice.<br /><br />This node will block the flow until a callback was received or the timed out was reached. The timeout is 1 minute less that the session length.<br/> <br />This node should be used in conjunction with the Set Variable Node to first set a UUID as a variable and then use that UUID in the Reference Field on the node and in the Callback API so that the Callback Handler can identify that the callback belong to a specific session.<br /><br/>Once the callback is received the end-user can then continue with the conversational workflow according to the steps defined in Flow.<br /><br /><b>Result and reference are mandatory.</b> Both <code>result</code> and <code>reference</code> must be supplied, either as query parameters or as header parameters. If a value is supplied in both places, the query parameter takes precedence. If either value is missing from both the query parameters and the headers, the request is rejected with a 400 Bad Request.<br /><br /><b>Content-Type header required.</b> When a request body is sent, the request must include the header <code>Content-Type: application/json</code>, otherwise it is rejected with a 415 Unsupported Media Type.","parameters":[{"name":"reference","in":"query","description":"The reference used to identify the session (the UUID set on the Wait for Callback node). Required — must be passed either as this query parameter or as the `reference` header. Takes precedence over the header if both are supplied.","required":false,"schema":{"type":"string"}},{"name":"result","in":"query","description":"The callback result used to evaluate the outcome in Flow. Required — must be passed either as this query parameter or as the `result` header. Takes precedence over the header if both are supplied.","required":false,"schema":{"type":"string"}},{"name":"reference","in":"header","description":"The reference used to identify the session (the UUID set on the Wait for Callback node). Required — must be passed either as this header or as the `reference` query parameter. Ignored if the query parameter is supplied.","required":false,"schema":{"type":"string"}},{"name":"result","in":"header","description":"The callback result used to evaluate the outcome in Flow. Required — must be passed either as this header or as the `result` query parameter. Ignored if the query parameter is supplied.","required":false,"schema":{"type":"string"}}],"requestBody":{"description":"Optional JSON payload containing additional data to append to the matched session. `result` and `reference` are not read from the body — they must be sent as query or header parameters.","required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Waitforcallback"}}}},"responses":{"202":{"description":"Successfully validated the response and returned data appended to matched session."},"204":{"description":"Callback has previously been processed in is being ignored."},"400":{"description":"`result` or `reference` is missing (not supplied as either a query parameter or a header), or a bad/invalid reference was returned and the session could not be matched, or the session has expired."},"410":{"description":"The session or callback state for the supplied reference could not be found (e.g. it has expired or was never registered)."},"415":{"description":"A request body was sent without the `Content-Type: application/json` header."}}}}},"components":{"schemas":{"Waitforcallback":{"type":"object","description":"Optional free-form key/value data to append to the matched session. Do not use this to send `result` or `reference`; pass those as query or header parameters.","additionalProperties":true}}}}
```
