# Obtain Response Data via Webhooks

Webhooks are used to obtain response data from Mailgun, such as whether your customer has subscribed or unsubscribed from your mailing. These data will be processed by CrossEngage and displayed in each campaign’s statistics. The generated data can be used to build [user segments](/data-and-engagement-platform/user-segmentation.md).

Your CrossEngage "Web tracking and response data API key" is needed for this Webhook configuration.

### Preparing a Webhook URL

To fetch the "Web tracking and response data API key":

* Log in to your CrossEngage account.
* Navigate to `Settings` > `System setup`.
* In the `API keys` section, copy the “Web tracking and response data API key”.

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

* Paste your copied API key into the following URL instead of the placeholder "{webapikey}."&#x20;
  * ​[https://api.crossengage.io/mailgun/inbound/message/{webapikey](https://api.crossengage.io/mailjet/inbound/message/%7Bwebapikey)}
* When finished, copy the adjusted URL.&#x20;

### Adding a Webhook to Mailgun

Webhook URLs must be added to Mailgun to allow response data to be sent to the CrossEngage System. This is done via the following steps:

* [*Log in* ](https://app.mailgun.com/sessions/new)to your Mailgun account.
* Navigate to the `Webhooks` section on the top right side of the menu.

<figure><img src="/files/4XEf04guVtefjpvA2QVe" alt=""><figcaption></figcaption></figure>

* We will now specify where the event data will be sent. Click on the `+` icon in the "URLs" column.

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

* Paste the copied URL from the previous steps into the "URL" cell and click on `Set Webhook URL`.

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

* Repeat the same procedure for each event type that you find relevant.

You will now be able to view response data in your CrossEngage dashboard and use the information to build segments.


---

# 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://documentation.crossengage.io/data-and-engagement-platform/messages/integrations/channels/email/mailgun/obtain-response-data-via-webhooks.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.
