---
url: "/emailify/export/webhook.md"
description: "Emailify includes a built-in Webhook export option, which allows you to send a `POST` request contain a JSON payload (below) that includes  your email's name, HTML code, subject line and preheader text."
---

# Uploading your emails to a custom Webhook URL

> Emailify includes a built-in Webhook export option, which allows you to send a `POST` request contain a JSON payload (below) that includes  your email's name, HTML code, subject line and preheader text.

[Video](/assets/videos/emailify/export/webook-export.mp4)

In the Emailify export panel, select the **Custom Webhook URL** option from the dropdown list, then paste in your own custom URL endpoint that has been created to handle [the JSON payload](#the-json-payload-object-sent-via-post-to-your-url) sent from Emailify.

When you're ready, click the **POST** button to start exporting the emails you've selected from Figma to HTML, and have them automatically sent as a `POST` request to your custom webhook endpoint.

> **Tip:** Your images will automatically be uploaded to our CDN and included as the `src` attribute for any `` tags in the `html` string property sent via the payload.

> **Note:** Your code will be exported as the default HTML option, so if you need the code to be exported for a certain email marketing platform destination (which you'll handle in your own function), you can optionally **select a platform specific option in the Webhook export options** panel.

## The JSON payload object sent via POST to your URL

The JSON payload sent from Emailify contains the object keys/values below; you'll need to ensure that your custom webhook URL has been created to handle this payload, which you can then use however you like.

```
{
  "name": "Name of the Figma frame",
  "subject": "Subject line set in Emailify settings",
  "preheader": "Preheader text set in Emailify settings",
  "html": "Exported email HTML"
}
```

### Adding custom JSON body and headers to your payload

You can optionally add your own [valid JSON string](https://www.w3schools.com/js/js_json_datatypes.asp) to the input fields below, and those will automatically be included in your payload's `header` object and/or `data` body object that's sent to your endpoint URL from the plugin as a `POST` request:

- You can set custom `header` object properties via the **Custom Request Headers (Optional)** field (eg. `{ "Authorization": "Bearer xyz" }`)
- You can set custom body `data` object properties **Custom Extra JSON Data (Optional)** (eg. `{ "category": "emailify" }`)
- Or, you can also set custom body `data` object properties on a "per-email" basis in the **Extra Email-Specific JSON Payload Data (Optional)** (eg. `{ "id": 26, "tag": "email", "edit": true }`) field under any email(s) in your export panel list, which will be merged with any global JSON data you may have already set globally (above).

## POST your JSON payload via a proxy server

As Figma plugins are run inside of a sandboxed `iFrame` element in the Figma app, it doesn't have any `origin`, so your Webhook URL that you `POST` the JSON payload to _may_ reject the request due to cross-origin CORS issues.

To work around this, you can either update your own Webhook function with [Access-Control-Allow-Origin](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin) set to `*` (all), or you can enable the **Use Proxy** toggle (which is turned on by default) in the Emailify plugin settings when you're exporting your email to a custom Webhook.

Enabling the **Use Proxy** toggle with autoamtically route your request through a proxy server before hitting your Webhook URL, to ensure that the incoming POST request has an `origin` and should resolve any CORS issues. This is purely a forwarding request, so the JSON data will flow directly through the proxy, and forwarded on straight to your own Webhook URL.

> **Note:** Enabling the **Use Proxy** setting means that the requests routed through the proxy server will come from a **dynamic IP address** each time a request is sent, so **if you need a static IP address** (eg. you're only allowing incoming requests from certain IPs, like a range of IP addresses in your office network), you should turn this setting off and update your Webhook function to set [Access-Control-Allow-Origin](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin) to `*` to accept POST requests directly from the Figma plugin instead (without being routed via the proxy server).
