Webhook
A guide to using Webhooks to trigger your AgenticFlow workflows from external systems.
The Webhook Trigger allows you to start a workflow from virtually any external service or application. It provides a unique URL that can listen for incoming HTTP requests. When an external system sends a request (a "payload") to this URL, your workflow is automatically triggered.
This is the key to integrating AgenticFlow with services like Stripe (for new payments), GitHub (for new commits), CRMs (for new leads), or any custom application that can send an HTTP POST request.
How to Set Up a Webhook
Create the Trigger: Drag a Webhook Trigger onto your canvas. This will automatically generate a unique URL for this specific workflow.
Copy the URL: Copy the unique webhook URL provided in the trigger's configuration panel.
Configure the External Service: Go to the settings page of the external application you want to receive events from (e.g., GitHub, Stripe, Typeform). Find the "Webhooks" or "API" section and paste the URL you copied.
Send a Test Request: Most services provide a "Send Test" button. Click it to send a sample payload to your workflow. This is crucial for helping AgenticFlow understand the data structure.
Access the Data: Once AgenticFlow receives the test request, the payload data will be available as variables. You can access the entire payload with
{{trigger.body}}
or access specific fields like{{trigger.body.customer_email}}
.
Security
Your webhook URL is a public endpoint. To ensure that only authorized services can trigger your workflow, you should use a security measure.
Authentication Token: You can configure the webhook to require an authentication token. The external service must include this token in the request's header for it to be accepted.
Example: Trigger a Workflow from a GitHub Push
Let's create a workflow that sends a Discord notification every time a new commit is pushed to your GitHub repository's main
branch.
In AgenticFlow:
Create a new workflow with a Webhook Trigger.
Copy the generated URL.
In GitHub:
Navigate to your repository's Settings > Webhooks.
Click Add webhook.
Payload URL: Paste the URL from AgenticFlow.
Content type: Set to
application/json
.Which events would you like to trigger this webhook? Select "Just the
push
event."Click Add webhook. GitHub will automatically send a test "ping" event.
Back in AgenticFlow:
The webhook trigger now shows the data it received from GitHub's test ping. You can see the structure of the payload.
Add a Conditional Action to check if the push was to the
main
branch:Condition: Check if
{{trigger.body.ref}}
equalsrefs/heads/main
.
Add a Discord Action after the "true" path of the condition.
Message:
New commit pushed to main by {{trigger.body.pusher.name}}: "{{trigger.body.head_commit.message}}"
Now, every push to your main branch will trigger the workflow, check the branch name, and send a detailed notification to your Discord channel.
Last updated
Was this helpful?