Some Questions about Netlify Form Serverless functions

When I first started working with Netlify serverless events and forms, I discovered that Netlify “did stuff” with the form (https://www.raymondcamden.com/2019/01/15/customized-form-handling-on-netlify-with-serverless-functions) in terms of modifying fields, adding additional information, and so forth. This is still not documented yet so I thought I’d start a thread to see if I can get firm answers on stuff.

I started with a form that had 3 fields: name, email, and comments. On submit, I see that the data comes out like so:

{
        "number": 6,
        "title": "Raymond Camden",
        "email": "raymondcamden+dloct6A@gmail.com",
        "name": "Raymond Camden",
        "first_name": "Raymond",
        "last_name": "Camden",
        "company": null,
        "summary": "<strong>Raymond Camden</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sapien nunc,...",
        "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sapien nunc, sagittis eget tincidunt in, convallis et erat. Nulla ult",
        "data": {
                "name": "Raymond Camden",
                "email": "raymondcamden+dloct6A@gmail.com",
                "comments": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sapien nunc, sagittis eget tincidunt in, convallis et erat. Nulla ult",
                "ip": "76.72.14.182",
                "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36 Edg/86.0.622.38",
                "referrer": "https://netlifydemos.netlify.app/form7.html"
        },
        "created_at": "2020-10-13T14:02:06.088Z",
        "human_fields": {
                "Name:": "Raymond Camden",
                "Email:": "raymondcamden+dloct6A@gmail.com",
                "Comments:": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sapien nunc, sagittis eget tincidunt in, convallis et erat. Nulla ult"
        },
        "ordered_human_fields": [
                {
                        "title": "Name:",
                        "name": "name",
                        "value": "Raymond Camden"
                },
                {
                        "title": "Email:",
                        "name": "email",
                        "value": "raymondcamden+dloct6A@gmail.com"
                },
                {
                        "title": "Comments:",
                        "name": "comments",
                        "value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sapien nunc, sagittis eget tincidunt in, convallis et erat. Nulla ult"
                }
        ],
        "id": "5f85b35e6db7f01b44b2db7a",
        "form_id": "5f85aede3fd53200087dcf38",
        "site_url": "http://netlifydemos.netlify.app",
        "form_name": "Contact Form 7"
}

I’d like to talk about the above information.

number - This appears to be the form submission number, ie the 6th form posted. Can you confirm?

title - this is the same value as name - what is the purpose of this?
email - this is the email field - why is it at the top of the data?
company - I assume it’s trying to match something in my form and failing. What rules are applied here, and the above? Will it only match a field called company? Will title only match name, or will it attempt to match something else too?

name - ditto for above - so if the logic “I look for common fields and float them to the top for easy access”?

first_name and last_name seem to just do a split on input. When I entered Raymond John Camden, it dropped the John. When I did “Raymond St. Claire”, it reported the last_name as Claire.

summary - the name, in bold, and a portion of the comments field. Again, what is the logic for making this? It looks like a good summary, but I’d like to know.

body - just the comments field. Why?

data - the original form, except that ip, user_agent, and referrer, are added by you. And here’s the thing. If I have a form field named ip (imagine I’m asking lawyers if they work with intellectual property law), that field is not available, anywhere. It just gets overwritten. Not a big deal… if documented.

human_fields and ordered_human_fields what is the point of this? It looks to be just capitalizing my fields, but maybe it does more? I just tested with contact_phone_number and it changed it to Contact Phone Number, so I guess it’s capitalize each word?

I think the rest makes sense - but to be sure, is id the ID of the individual form submission?

We don’t have that documented in depth, as you’ve discovered. While I will explain the other fields in the response to the best of my ability (which is incomplete), we make no warranty or guarantee, express or implied, that those fields won’t change - both in being there and their names and meanings and even how the data works, so you will want to be conservative in how you use them (e.g. don’t go publish an npm module called “handle-netlify-form-secret-metatdata”, please!) I have only outlined the ones I understand; we won’t be getting clarity on the rest of these undocumented fields so please ignore them :slight_smile:

  • number will monotonically increase, but you have 6 submissions right now numbered 1/2/6/7/8/9 so I guess that it either ignores deleted or spam entries, perhaps.
  • title not sure about this one, perhaps it’s the display value in our UI?
  • email is set separately if you either have a field called email or perhaps an <input_type=email> field. Our system will set the Reply-to address on your form notification to the mentioned value, if you have an email notification.
  • company no idea, I guess you can ignore it. It’s not unique to your form submissions, but also doesn’t seem to be used.
  • name no idea, I’d use the data[name] or human_fields[name] for anything you’re doing.
  • first/last name - no idea, I’d ignore it and use your own logic if you need those separated - I have no idea what it does if you get a name like John Smith X D'Angelo, Jr.
  • summary also no idea. Perhaps it is used in some notification methods like zapier?
  • data: yup you have a good summary
  • unknown on the difference of the fields vs human_fields. You’ve discovered what changes we make based on your experimentation, it seems, so you already know more than me :slight_smile:

To answer your last question, the ID of the submission is in fact the id and not the number - it is unique across all forms.

Good callout on the documentation for ip so I’ll work with the documentation team to get it added to our forms docs.

Thank you so much for the response. I’ve also fixed the title (not sure how Identity got in there).