APIs & Integrations

Not applicable

IP Address Pulling from Server Instead of Contact

I am using the Forms API to get Contacts from an externally hosted form. The IP address that is being pulled for contacts is the IP address of the website server and I get this notification on each Contact: “Some of this contact’s activity has been excluded based on their IP address. Learn more.” I had our developer add: “ipAddress”:x to the parameters but it has not changed anything. Any help or advice would be amazing.

0 Upvotes
12 Replies 12
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

IP Address Pulling from Server Instead of Contact

Hi @batjaa,

Apologies, I'm not particularly familiar with PHP. How does the final hs_context field look? It's supposed to be a JSON object, but it appears above like it might be an array? Here's an example hs_context:

{
    "hutk": "60c2ccdfe4892f0fa0593940b12c11aa", 
    "ipAddress": "192.168.1.12", 
    "pageUrl": "http://demo.hubapi.com/contact/", 
    "pageName": "Contact Us", 
    "redirectUrl": "http://demo.hubapi.com/thank-you/"     
}
0 Upvotes
Not applicable

IP Address Pulling from Server Instead of Contact

You can find another submission I'm testing here.

Made that request using postman, though I've included hs_context it's still not showing up. Does the hs_context have to include all the the properties?

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

IP Address Pulling from Server Instead of Contact

Hi @batjaa,

The contact's IP address properties are matching up with the values I'm seeing in the hs_context fields for those submissions. I'm also not seeing any other data appearing in the hs_context data for this form. Are you sure that the hs_context fields are being properly formatted? Do you have an example of a raw request you're making to the forms API, so that I can take a closer look?

0 Upvotes
Not applicable

IP Address Pulling from Server Instead of Contact

I'm using ryanwinchester/hubspot-php and overriding the Froms class. Looks like it's still not sending the hs_context params.

This is what I have now:

public function submit($portal_id, $form_guid, $form = [])
    {
        $form['hs_context'] = [
            'hutk'      => $this->request->cookie('hubspotutk'),
            'ipAddress' => $this->request->getClientIp(),
        ];

        $endpoint = "https://forms.hubspot.com/uploads/form/v2/{$portal_id}/{$form_guid}";

        $options = [
            'form_params' => $form,
        ];

        return $this->client->request('post', $endpoint, $options, null, false);
    }

this is one of the latest submissions.

0 Upvotes
Not applicable

IP Address Pulling from Server Instead of Contact

Hi @Derek_Gervais!

Would it be possible to look into these 2 examples and tell me if I messed up something?

https://app.hubspot.com/forms-two/2900997/ef2c982c-8e3c-4213-b38c-4e55c6af8e91/submissions/bf080069-...

https://app.hubspot.com/forms-two/2900997/ef2c982c-8e3c-4213-b38c-4e55c6af8e91/submissions/fcb9a5b3-...

I'm facing the same problem with IP address not populating correctly but I'm sure I've included the ipAddress in the hs_context parameter.

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

IP Address Pulling from Server Instead of Contact

Hi @Peter_Keogh,

I believe the IP address wasn't properly included in the hs_context parameter.

0 Upvotes
Peter_Keogh
Member

IP Address Pulling from Server Instead of Contact

Was there any resolution on this?

0 Upvotes
Not applicable

IP Address Pulling from Server Instead of Contact

Hi @Derek_Gervais,

I messaged you the link. I am not sure exactly how it is populated, I am not the one who implemented the code, I work on the marketing end. I will have to get back to you on that.

Not applicable

IP Address Pulling from Server Instead of Contact

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

IP Address Pulling from Server Instead of Contact

Hi @JamesArbogast,

Can you direct message me with a link to the corresponding form in HubSpot? Additionally, how are you populating the ipAddress field?

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

IP Address Pulling from Server Instead of Contact

Hi @JamesArbogast,

Just to make sure I’m understanding, are you including the ipAddress: xxxxxx in the hs_context parameter? If that’s not included properly, the IP address will be set to the IP of the system making the request to the Forms API, which is likely your server.

0 Upvotes
Not applicable

IP Address Pulling from Server Instead of Contact

Yes, that is where it was included. It doesn’t seem to have changed anything.

0 Upvotes