Page Name Is not there in Email Notification

forms

#1

Hi,

We are using Hubspot contact form to capture user data and submitting it using Rest API and we used to get email notification for each submission. It was working fine until now.

Earlier we used to get Page name on Page submitted on: But now are only getting Not included in API data I have attached screenshot of emails

Although we haven’t changed anything in the code.

Here following is NodeJS code which I am currently using

exports.download = function (req, res) {
    var body = req.body;
    var hubspotPage = req.query.hubspotPage || 'Hubspot form submission';
     body = _.extend(req.body, {
        'hs_context': JSON.stringify({
            "hutk": req.cookies.hubspotutk || '',
            "ipAddress": req.headers['x-forwarded-for'] || req.connection.remoteAddress,
            // "pageUrl": "http://www.example.com/form-page",
            "pageName": hubspotPage + " " + req.query.hubspotContent
        })
    });
    console.log(body);
    var postData = querystring.stringify(body);
    
    var path = "7d89dbbf-6303-423d-9865-f66e7dec102f";
    var options = {
        hostname: 'forms.hubspot.com',
        path: '/uploads/form/v2/MY_HUBSPOT_ID/' + path,
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
            'Content-Length': postData.length
        }
    }

    var request = https.request(options, function (response) {
        response.setEncoding('utf8');
        console.log("Status: " + response.statusCode);
        console.log("Headers: " + JSON.stringify(response.headers));
        response.on('data', function (chunk) {
            console.log('Body: ' + chunk)
        });
    });

    request.on('error', function (e) {
        console.log("Problem with request " + e.message)
    });

    request.on('close', function (e) {
        res.json({
            message: 'Success'
        })
    });

    // post the data

    request.write(postData);
    request.end();
};

Regards.
Lakshman


#2

Hi @Lakshman_Gurung,

Can you send me a link to the form in HubSpot so that I can take a look at the raw form submission data?


#3

Hi @Derek_Gervais,

Here is the link http://roboticpci.com/user-resources/training-materials

when you click on download button it will open a form inside the popup.


#4

Hi @Lakshman_Gurung,

I wasn’t entirely clear. I need a link to the form as it appears in your HubSpot portal. You could also just send me your Hub ID and I can find your portal that way.


#5

Hi @Derek_Gervais

Here is my for id https://app.hubspot.com/forms/763528/7d89dbbf-6303-423d-9865-f66e7dec102f/edit

and My Hub ID is 763528


#6

Hi @Lakshman_Gurung,

It looks like the field you’re submitting in the form hs_context is pageName, when I believe you have to include pageTitle. Can you try updating the form to submit pageTitle instead?


#7

Hi @Derek_Gervais ,

I have tried after adding pageTitle but still it’s not working.


#8

Hi @Lakshman_Gurung,

That’s strange. I’m going to conduct some testing today to try and figure out what the issue is. I’ll reach back out here when I have some more information.


#9

Hi @Lakshman_Gurung,

Thank you for your patience here. After doing some testing, including I was able to get the email working correctly by including a pageTitle and a pageUrl parameter to the hs_context field. If that’s not working for you, can you double check that the hs_context parameter is properly encoded (also not double-encoded)? If you find that you’re including everything correctly and you’re still not seeing the page appear correctly, can you send me the raw form submission data you’re pushing to HubSpot so that I can take a look?