How to receive VideoAsk webhooks in Tenklo
Learn how to receive real-time VideoAsk events in your app using Tenklo webhooks
This guide shows you how to receive real-time VideoAsk events in Tenklo. VideoAsk delivers webhook events via HTTP POST when a respondent completes or abandons a videoask, or when messages and tags are created.
How it works
- A post-connection script registers a webhook with VideoAsk via the API, embedding the Tenklo connection ID (
nango-connection-id) and webhook secret (nango-webhook-secret) as custom headers. - When an event occurs, VideoAsk sends a POST to Tenklo with those headers.
- Tenklo validates the secret against the one configured on the integration, then uses the connection ID to route the event to your app.
For the full list of supported event types, see the VideoAsk webhook documentation.
Setup
1. Set a webhook secret
In your VideoAsk integration page in the Tenklo dashboard, enter a secret in the Webhook Secret field. Generate one with:
openssl rand -hex 322. Get your Tenklo webhook URL
Copy the webhook URL from the same integration page, under the Webhook URL section.
3. Register the webhook via a post-connection script
Use a post-connection-creation script to automatically register a webhook with VideoAsk whenever a new connection is created. Pass both the Tenklo connection ID (for routing) and the webhook secret (for validation) as custom headers.
import { createOnEvent } from 'nango';
export default createOnEvent({
event: 'post-connection-creation',
description: 'Register a VideoAsk webhook with connection ID and secret for routing and validation',
exec: async (nango) => {
const webhookUrl = await nango.getWebhookURL(); // or use the one from above
const connectionId = nango.connectionId;
const integration = await nango.getIntegration({ include: ['credentials'] });
const secret = integration.credentials && 'webhook_secret' in integration.credentials
? integration.credentials.webhook_secret
: null;
// form_id is the ID of the videoask to subscribe to.
// tag is a unique identifier for this webhook (e.g. "nango-<connectionId>").
// https://developers.videoask.com/reference/put_forms-form-id-webhooks-tag
await nango.put({
endpoint: `/forms/<FORM-ID>/webhooks/nango-${connectionId}`,
data: {
url: webhookUrl,
event_types: ['form_response', 'form_response_transcribed'],
headers: {
'nango-connection-id': connectionId,
'nango-webhook-secret': secret,
},
},
});
},
});Replace <FORM-ID> with the VideoAsk form ID you want to subscribe to. See the VideoAsk API reference for the full list of available event types.
4. Handle forwarded webhooks
When a VideoAsk event arrives, Tenklo matches it to the correct connection and forwards the payload to your app. Example payload structure:
{
"from": "videoask",
"providerConfigKey": "<INTEGRATION-ID>",
"type": "forward",
"connectionId": "<YOUR-NANGO-CONNECTION-ID>",
"payload": {
"type": "form_response",
...
}
}5. Delete the webhook on connection removal
Use a pre-connection-deletion script to clean up the VideoAsk webhook when a connection is deleted:
import { createOnEvent } from 'nango';
export default createOnEvent({
event: 'pre-connection-deletion',
description: 'Delete the VideoAsk webhook before connection deletion',
exec: async (nango) => {
const connectionId = nango.connectionId;
try {
await nango.delete({
endpoint: `/forms/<FORM-ID>/webhooks/nango-${connectionId}`,
});
} catch (err) {
await nango.log(`Failed to delete VideoAsk webhook: ${String(err)}`, { level: 'error' });
}
},
});