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

<figure><img src="/files/52951a3cb3d0ef7595cc37afd234abed98ec4858" alt=""><figcaption></figcaption></figure>

On the SprintHub platform, configuring a webhook efficiently can be simple, as long as you understand how to map and transform the request body appropriately.

### 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 usually 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 on Sprinthub

**1. Creating a New Integration**

1. **Name and Alias**: Choose a descriptive name and an alias for your integration that make it easy to identify.
2. **Method**: Set 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 (normally, JSON).

<figure><img src="/files/9de08ee08d25cb75d57d5a8e6d9aa90f68efd600" alt=""><figcaption></figcaption></figure>

**2. Input Mapping**

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

**Automatic Mapping**: Send a test request so the platform can capture the JSON sent.

{% hint style="info" %}
If it is automatic mapping, the external platform will USUALLY already have the body assembled correctly. But it is necessary to check data validation when requesting.
{% endhint %}

**Request Body Parameters**: Here, you should 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 `product_id`, since it is inside an array, you would need to specify the position, like `data.items[0].product_id`, if you want the first item.

<figure><img src="/files/0c7c4cb9ba9007d1508c1e2c6f66a5054f2553f3" alt=""><figcaption></figcaption></figure>

### Conclusion

Transforming the body into the request body on SprintHub is a fundamental process to ensure that your webhooks work correctly and that the information is captured and used effectively. With 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 everything is working as expected. And remember to document your configurations for future maintenance.
{% endhint %}


---

# Agent Instructions: 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.sprinthub.com/en/topics/analyze/integrated-webhooks/integrated-webhooks-common-questions/integrated-webhook-how-to-transform-the-body-into-the-request-body.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.
