Form webhook payload contains unknown keys

Hi there

I got a simple form working on my site deployed on Netlify (https://sortdesk.com/).
The form contains 4 fields: names, email, message and privacyConsent. However, when enabling a webhook notification I receive following payload:

{
    "number": 4,
    "title": "ddd",
    "email": "peterpan@yopmail.com",
    "name": null,
    "first_name": null,
    "last_name": null,
    "company": null,
    "summary": "<strong>ddd</strong> ddd",
    "body": "ddd",
    "data": {
        "names": "ddd",
        "email": "peterpan@yopmail.com",
        "message": "ddd",
        "privacyConsent": "true",
        "ip": "84.xxx.81.xxx",
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
        "referrer": "https://sortdesk.com/de/"
    },
    "created_at": "2020-12-13T19:10:05.563Z",
    "human_fields": {
        "Names": "ddd",
        "Email": "peterpan@yopmail.com",
        "Message": "ddd",
        "I have read and agree to the <a>Privacy Policy</a>": "true"
    },
    "ordered_human_fields": [
        {
            "title": "Names",
            "name": "names",
            "value": "ddd"
        },
        {
            "title": "Email",
            "name": "email",
            "value": "peterpan@yopmail.com"
        },
        {
            "title": "Message",
            "name": "message",
            "value": "ddd"
        },
        {
            "title": "I have read and agree to the <a>Privacy Policy</a>",
            "name": "privacyConsent",
            "value": "true"
        }
    ],
    "id": "xxx",
    "form_id": "xxx",
    "site_url": "https://sortdesk.com",
    "form_name": "contactForm"
}

What are the first_name, last_name, company etc. fields all about? I searched my source code for potential legacy code but couldn’t match any of these terms.

Thanks.

hi @pierre-sortdesk, how odd! Is it possible that you have a second form with the same name somewhere in your site?

Hi @perry
Nope, I don’t… it’s a small project so I just ran a search on all files in VS Code for the terms contactForm and e.g. first_name but nothing suspicious.

Just to be precise: the ddd you see in title and body is the actual content of data.message I typed in when submitting the form. Btw, why are there even root level keys and then keys nested under data?

Is there any doc on how the payload is structured?

Thanks,
Pierre

Hey @pierre-sortdesk,
I am in the process of compiling this kind of payload data for our docs team and I had some of the same questions :slight_smile: I believe the first_name, last_name, etc. fields are defaults from an earlier time at Netlify when we were anticipating what fields customers would definitely want to have in their forms? As far as I can tell, they are not used anymore and should probably be removed. As for root-level keys and then nested keys… also a mystery why we have both. I will file an internal issue and can let you know if/when we get that cleaned up.

In case it’s helpful, here’s a webhook payload I get for a form submission (looks like yours):

  payload: {
    number: 1,
    title: 'yes',
    email: null,
    name: null,
    first_name: null,
    last_name: null,
    company: null,
    summary: '<strong>yes</strong> only on tuesdays',
    body: 'only on tuesdays',
    data: {
      bread: 'yes',
      cheese: 'not anymore',
      sauce: 'only on tuesdays',
      ip: '...',
      user_agent: '...',
      referrer: 'https://....netlify.app/'
    },
    created_at: '2020-12-16T22:49:10.648Z',
    human_fields: { Bread: 'yes', Cheese: 'not anymore', Sauce: 'only on tuesdays' },
    ordered_human_fields: [ [Object], [Object], [Object] ],
    id: '...',
    form_id: '...',
    site_url: 'http://....netlify.app',
    form_name: 'pizzaForm'
  },

Hi @jen, thanks for letting me know :slight_smile:
At least it doesn’t feel like black magic anymore haha. If I can make a suggestion: I would keep all the info as is (except the weird first_name etc. ofc) and also have data nested as is. Makes it clear and easy to implement IMO.

And yes, would be glad to know when you guys got time to clean that up!

Cheers

1 Like