> For the complete documentation index, see [llms.txt](https://docs.sprinthub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sprinthub.com/en/topics/analyze/integrated-webhooks/integrated-webhooks-common-questions/integrated-webhook-how-to-turn-the-body-into-the-request-body.md).

# Integrated Webhook - How to Turn the Body into the Request Body

Webhooks are an essential tool for integration between different systems. They allow events that occur in one system to be automatically sent to another, making automation easier

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2F8NIvmV2aDuHTOen0K1eQ%2Fundraw_data_processing_yrrv.png?alt=media&amp;token=584e017b-67ea-4de7-9d39-4cac672d0c3a" alt=""><figcaption></figcaption></figure>

On the SprintHub platform, setting up a webhook efficiently can be simple, as long as you understand how to map and transform the request body (body) properly.

### What is the request body?

The request body, or "body", is the part of an HTTP request that contains the data sent to the server. In a webhook setup, this data is generally sent in JSON format and contains specific information about the event that triggered the webhook, such as the creation of an order, updating a customer, among others.

### Configuring the Webhook in SprintHub

**1. Creating a New Integration**

1. **Name and Alias**: Choose a descriptive name and an alias for your integration, making it easy to identify.
2. **Method**: Define the appropriate HTTP method (usually `POST`).
3. **Secret Key**: Enter the secret key provided by SprintHub to ensure the security of your requests.
4. **Expected Body**: Select the expected format for the request body (usually JSON).

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FyNDUWJumCJLbkHLEZtiI%2Fimage.png?alt=media&amp;token=f3c0e01e-5d5b-4316-bddb-db77d9360976" alt=""><figcaption></figcaption></figure>

**2. Input Mapping**

In the input mapping section, you must define how the data received in the body will be mapped and used on the SprintHub platform.

**Automatic Mapping**: Send a test request so that the platform captures the JSON sent.

{% hint style="info" %}
If it is automatic mapping, NORMALLY the external platform will already leave the body set up correctly. But it is necessary to verify data validation when making the request.
{% endhint %}

**Request Body Parameters**: Here, you must map the JSON fields to the fields that will be used in SprintHub.

For example, if you are receiving a JSON like the one below:

```json
{
  "event": "order.created",
  "data": {
    "customer": {
      "id": "987654321",
      "name": "John Doe"
    },
    "items": [
      {
        "product_id": "ABC123",
        "quantity": 2,
        "price": 19.99
      }
    ]
  }
}

```

In the mapping, you can define that the field `event` will be mapped to `data.event`, and so on. In the case of the `product_id`, as it is inside an array, you would need to specify the position, such as `data.items[0].product_id`, if you want the first item.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FJmeQKFHJFcMi2TB00EkE%2Fimage.png?alt=media&amp;token=7429e2aa-e818-4d48-a7c5-9c7e197c1f2d" alt=""><figcaption></figcaption></figure>

### Conclusion

Transforming the body in the request body in SprintHub is a fundamental process to ensure that your webhooks work correctly and that the information is captured and used effectively. With the correct mapping and a well-planned configuration, you can automate complex processes and improve integration between systems in your organization.

{% hint style="info" %}
**Tip:** Always test your integrations with real data to ensure that everything is working as expected. And remember to document your configurations for future maintenance.
{% endhint %}
