Submission-created Payload Example

Is there somewhere I can find an example payload for submission-created function triggers?

Hi, @asher. My best suggestion would be to use a service like https://requestbin.com/ and point the webhook at a URL there.

This will allow you to get a real form submission payload so you can examine it. If there are other questions, please let us know.

Thanks @luke!

I used webhook.site, and got this structure back:
(removed values for readability)

{
  "number": n,
  "title": "",
  "email": "",
  "name": "",
  "first_name": "",
  "last_name": "",
  "company": null,
  "summary": "",
  "body": "",
  "data": {
    [...]
  },
  "created_at": "",
  "human_fields": {
    [...]
  },
  "ordered_human_fields": [
    [...]
  ],
  "id": "",
  "form_id": "",
  "site_url": "",
  "form_name": ""
}

Can you confirm that if I want to get the form data in a js function, I could do JSON.parse(event.body).dataā€¦?

@asher Iā€™m using this in production to get the data from my payload:

exports.handler = async function (event, context) {
  const formData = JSON.parse(event.body).payload;
  const { data } = formData;
  ...
};
2 Likes