Skip to main content

Realtime Webhook

Patrick avatar
Written by Patrick
Updated over 3 weeks ago

If your webhook isn't able to respond immediately, you may need to trigger a custom request to Frontly's Realtime Webhook endpoint to return data back to the app in real-time.

Here are the steps:

1. Make your Webhook request

Note: Frontly will automatically include instance_id and app_id fields to the body of your outgoing webhook request. These act as unique identifiers for this specific instance of a request. You will need to collect the instance_id and app_id from the initial request and send them in the return it back when you make your request to Frontly's Realtime Webhook endpoint.

In your Webhook action step, turn on the 'Wait For Realtime Webhook' toggle, which tells Frontly to wait for you to make a request to the Realtime Webhook endpoint before continuing to the next steps.


2. Send your response to the Realtime Webhook endpoint

To return data back to Frontly in real-time, you will make a POST request to the https://api.frontly.ai/realtime_webhook/ endpoint.

Request Headers

The following 2 fields will have been automatically sent to your third-party system in the original webhook request:

app_id - Your app's unique ID

instance_id - A unique ID for the specific instance of the webhook request

These values will need to be sent back to Frontly in your 'response' POST request, in the request headers like this:

{
"x-app-id": "APP ID VARIABLE GOES HERE",
"x-instance-id": "INSTANCE ID VARIABLE GOES HERE",
"x-api-key": "YOUR API KEY GOES HERE",
}

Note: The x-app-id and x-instance-id values should be the app_id and instance_id values received in the body of the original request. Automation platforms will have a variable system for you locate and inject these variables as needed instead of static values shown in the examples.

Request Body

The body of the request should contain any values you want to send back to your Frontly UI in real-time:

{
"your_custom_field": "Some Value",
"another_field": 1234
}


3. Using the response

Any step that follows your Webhook request will can access the response, which includes your custom data.

For example, if your response data object is {"CustomField": "some_value"} then you could access the value with the {{step.1.CustomField}} variable.

Did this answer your question?