|
| 1 | +--- |
| 2 | +title: Using Power Automate HTTP Webhook Trigger |
| 3 | +slug: /knowledge-base/http-webhook-trigger |
| 4 | +sidebar_position: 2 |
| 5 | +tags: |
| 6 | + - Power Automate |
| 7 | + - Webhooks |
| 8 | + - Integration |
| 9 | +--- |
| 10 | + |
| 11 | +# Using Power Automate HTTP Webhook Trigger |
| 12 | + |
| 13 | +Power Automate supports **HTTP Webhook triggers** through custom connectors, allowing flows to be triggered by external systems in real time. This article outlines two common scenarios: |
| 14 | + |
| 15 | +- Creating a **dynamic webhook** on the fly |
| 16 | +- Registering a **fixed webhook** for known endpoints |
| 17 | + |
| 18 | +## Scenario 1: Creating a Webhook on the Fly |
| 19 | + |
| 20 | +In this approach, a webhook is **created dynamically** each time a request comes in. This is useful when the target site is not known in advance or changes frequently. |
| 21 | + |
| 22 | +### How It Works |
| 23 | + |
| 24 | +1. Power Automate receives a request (e.g., from a form or API). |
| 25 | +2. It extracts the **site URL** from the request body or headers. |
| 26 | +3. It sends a **POST** request to that site to register a webhook. |
| 27 | +4. Once the event is received and processed, the webhook is **deleted** (either automatically or manually). |
| 28 | + |
| 29 | +## Scenario 2: Creating a Fixed Webhook |
| 30 | +If the target site is known in advance, you can configure a static webhook during connector setup. This is ideal for stable integrations with a single WordPress instance or API. |
| 31 | +This setup registers the webhook once and listens for events continuously until the flow is disabled or removed. |
| 32 | + |
| 33 | +## Example Flow |
| 34 | + |
| 35 | +- **Subscribe Method:** `POST` |
| 36 | +- **Subscribe URI:** `https://{dynamic-site}/wp-json/integration-cds/v1/webhooks` |
| 37 | +- **Subscribe Body:** |
| 38 | + |
| 39 | +```json |
| 40 | +{ |
| 41 | + "name": "Power Automate Create", |
| 42 | + "description": "Description", |
| 43 | + "topic": "form/create", |
| 44 | + "target": "@{listCallbackUrl()}", |
| 45 | + "form_type": "gravity", |
| 46 | + "form_id": "all" |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | +- **Unsubscribe Method**: DELETE (optional, depending on the external system) |
| 51 | + |
| 52 | + Power Automate will automatically attempt to unregister the webhook when the flow is disabled or deleted. However, we recommend verifying that the webhook has been removed manually. |
| 53 | + |
| 54 | +## Best Practices |
| 55 | + |
| 56 | +Always validate the callback URL `(@{listCallbackUrl()})` is correctly passed to the external system. |
| 57 | + |
| 58 | +Use authentication (e.g., basic auth or API keys) when registering webhooks to prevent unauthorized access. |
| 59 | + |
| 60 | +Monitor webhook lifecycle events and clean up unused registrations to avoid clutter or duplicate triggers. |
0 commit comments