Skip to main content

Determining Webhook URLs Programmatically

When an instance is deployed to a customer, the instance's flows receive their own webhook URLs.

Get webhook URLs of an instance

Given an instance of an integration, you can programmatically fetch its flow's webhook URLs (and API keys, if set).

Query Instance Webhook Info
query getInstanceWebhookInfo($instanceId: ID!) {
instance(id: $instanceId) {
flowConfigs {
nodes {
flow {
name
}
webhookUrl
apiKeys
}
}
}
}
Query Variables
{
"instanceId": "SW5zdGFuY2U6ODU0NmNjNGYtODZjYS00ODAyLWI5OTEtNmJlZmM0NzFjM2Ew"
}
Try It Out ❯

Fetch an instance given an webhook URL

If you have a webhook URL, and you would like to know what instance it is associated with, look at the portion of the URL after /trigger/ - the portion that starts with SW5....

This identifier represents an InstanceFlowConfig, Instance or Integration, depending on your endpoint configuration. To determine which type of endpoint configuration this identifier represents, base64 decode it either on the command line or by pasting it into base64decode.org.

$ echo "SW5zdGFuY2VGbG93Q29uZmlnOjkyZTQyMmI1LTVhNzEtNDczNy1hNWUzLWIyZTBjYTJmMDBiZQ==" | base64 --decode
InstanceFlowConfig:92e422b5-5a71-4737-a5e3-b2e0ca2f00be

If the identifier in your webhook URL represents an Instance, then that's the the ID of the instance your webhook invokes. If the identifier in your webhook URL represents an Integration, then all instances of the integration with that ID share that webhook URL, and you must pass that webhook URL additional information to determine which instance and flow to invoke.

Most commonly you'll have a webhook URL that represents an InstanceFlowConfig. In that case, run this query to fetch information about the flow, instance, customer, and integration related to this webhook URL.

Get Instance from Instance Flow Config
query getInstanceFromFlowConfig($flowConfigId: ID!) {
instanceFlowConfig(id: $flowConfigId) {
instance {
id
name
customer {
id
externalId
name
}
integration {
id
name
}
}
flow {
name
}
}
}
Query Variables
{
"flowConfigId": "SW5zdGFuY2VGbG93Q29uZmlnOjkyZTQyMmI1LTVhNzEtNDczNy1hNWUzLWIyZTBjYTJmMDBiZQ=="
}
Try It Out ❯