> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.personizely.net/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Webhooks


# Creating the webhook
In Personizely you can set up a webhook to be sent when a certain action is done on a widget. To create a webhook for a widget, follow the guide below:

1. Edit the element on which you want to attach a webhook, select "Interaction" in the right sidebar menu, and in the Automation section click "Add action":

![](https://storage.crisp.chat/users/helpdesk/website/30a06a2316be0a00/screenshot-at-jan-27-17-12-29_16sto8d.png)

3. Select " Send webhook" and then set the URL where you want to direct the hook:

![Setting up the webhook](https://storage.crisp.chat/users/helpdesk/website/30a06a2316be0a00/screenshot-at-jan-27-17-13-01_ezx97z.png)

You're all set, now Personizely will send a HTTP request to the URL provided once someone submits/click on the edited form/element:

# Receiving the webhook
The webhooks are send using a POST request with a JSON payload which your script should parse and then return a 200 HTTP status.
Webhook's JSON format is the following:

```
{
  "widgetId": Number,
  "event": String - click/submit,
  "visitorData": Object {
    "firstName": String,
    "lastName": String,
    "email": String,
    "companyName": String,
    "companyTItle": String,
    "phone": String,
    "address": String,
    "marketingConsent": Boolean,
    "privacyContent": Boolean,
    "bio": String,
    "initialReferrer": String,
    "utmSource": String,
    "utmCampaign": String,
    "utmContent": String,
    "utmTerm": String,
    "utmMedium": String,
    "entryPage": String,
    "firstVisitDate": String,
    "country": String,
    "city": String,
    "region": String,  
    "postalCode": String,
    Number: String - Custom fields are serialized with the custom field id as the key
  }
}
```
