> For the complete documentation index, see [llms.txt](https://docs.rulecube.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rulecube.com/v2.5/how-to-guides/webhooks/workflow-webhook.md).

# Workflow webhook

### **Workflow webhook definition**

A workflow webhook works as follows:

* Create an Upload step of type "webhook"

  * In the upload step, define a state property, e.g., `paymentResult`, to receive the callback information. This property should be of type "WebhookRequest", so the callback information is available in subsequent steps.

  <div align="center" data-full-width="true"><figure><img src="/files/UveQwjkatP6O9y0pCRj3" alt=""><figcaption></figcaption></figure></div>
* Before the Upload step, create an Action. In this Action, a webhook URL needs to be created to send to the third party. This is done with `Workflow.createNextWebhookUrl()` \
  \ <br>

  ```js
  // Assuming the next step is an Upload step of type 'Webhook' 
  let webhookUrl = Workflow.createNextWebhookUrl() 

  // Use an imaginary payment provider to create a payment and set the webhook URL: 
  // This payment provider will call the webhook URL when the payment is completed 
  Http.post('https://payment-provider.com/create-payment', { 
    amount: 100, 
    currency: 'EUR', 
    webhookUrl: webhookUrl 
  })
  ```

The webhook URL is something like&#x20;

```http
https://{API_URL}/workflow/webhook?token={TOKEN}
```

* After the Upload step, create another Action. In this Action, the configured state property (`paymentResult` in our example) will be filled with the HTTP request information received from the third party in the previous step.

As a result, the workflow will look something like this:

<figure><img src="/files/uZaQ0Bi8RIgVgyCCqxGs" alt=""><figcaption></figcaption></figure>

Typically, these steps are part of a larger workflow.

{% hint style="info" %}
The WebhookRequest type has the following structure:

```
{
    "data": /* Request body parsed to JSON or raw body string */,
    "query": {
        "param1": "12345",
        "param2": "abcdef"
    },
    "headers": {
        "Accept": "text/html",
        "Connection": "keep-alive",
        "Host": "yourdomain.com",
        "User-Agent": "Chrome/141.0.0.0 Safari/537.36",
        "Accept-Encoding": "gzip, deflate, br, zstd"
    }
}
```

&#x20;
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rulecube.com/v2.5/how-to-guides/webhooks/workflow-webhook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
