# Obtain Response Data via Webhook

Webhooks are used to obtain response data from SendGrid, 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](https://documentation.crossengage.io/faq/events/can-i-create-segments-based-on-events/event-segmentation-using-esp-integrations).

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`.

<figure><img src="https://985110910-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Hio8LJewN8lQY2Vlqy0%2Fuploads%2Faxn3Ui8ry2Aipp2XZS4l%2FSystemSetup.png?alt=media&#x26;token=44af739e-48d8-4235-900e-0fba92ef70e1" alt=""><figcaption></figcaption></figure>

* &#x20;In the `API keys` section, copy the “Web tracking and response data API key”.yste

<figure><img src="https://985110910-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Hio8LJewN8lQY2Vlqy0%2Fuploads%2F41V9LvF2G5qWLsdX4PTW%2FSystemSetup_APIkeys.png?alt=media&#x26;token=86f1b6f9-b71f-4a9e-9c46-c33cbd5045ed" alt=""><figcaption></figcaption></figure>

* Paste your copied API key into the following URL instead of the placeholder "{webapikey}."&#x20;
  * ​<https://api.crossengage.io/sendgrid/inbound/message/{webapikey}>
* When finished, copy the adjusted URL.&#x20;

## Adding a Webhook to SendGrid

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

* [*Log in*](https://app.sendgrid.com/login) to your SendGrid Account.
* Unfold `Settings` on the left panel menu and select the `Mail Settings` section.

<figure><img src="https://985110910-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Hio8LJewN8lQY2Vlqy0%2Fuploads%2Fflog4t3weLNytwacqpx3%2FSendgrid_MailSettings.png?alt=media&#x26;token=12398814-485b-4cde-a241-873d09613dc7" alt=""><figcaption></figcaption></figure>

* Go to `Event Webhook` and click on `edit` in the top right corner.
* Paste the copied URL from previous steps in the `HTTP POST URL` line&#x20;
* Scroll down and click on the Save button to save.

<figure><img src="https://985110910-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Hio8LJewN8lQY2Vlqy0%2Fuploads%2FEPJloVQ7GQFkwCeDYEwN%2FSendGrid_EventWebhook.png?alt=media&#x26;token=90d901c5-fd41-41fa-91dc-91331b9cddbf" alt=""><figcaption></figcaption></figure>

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/sendgrid-by-twilio/obtain-response-data-via-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.
