Hubspot Working Example

Is there anyone to help me to create a workflow for an Hubspot Form Submit, I couldn’t make it work.

Welcome to the community @umutgokcen!

Sure here an example. You would obviously have to change the incoming data according to your form:

{
  "nodes": [
    {
      "parameters": {
        "functionCode": "return [{\n    json: {\n      firstname: 'Jim',\n      lastname: 'Smith',\n      website: 'https://example.com',\n      comment: 'My comment',\n      email: '[email protected]'\n    }\n}]"
      },
      "name": "Mock Form Data",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1350,
        550
      ]
    },
    {
      "parameters": {
        "resource": "form",
        "operation": "submit",
        "formId": "",
        "additionalFields": {
          "submittedAt": "2020-03-12T04:00:00.000Z"
        },
        "lengalConsentUi": {
          "lengalConsentValues": {
            "consentToProcess": true,
            "text": "My consent text"
          }
        }
      },
      "name": "Hubspot6",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 1,
      "position": [
        1540,
        550
      ],
      "credentials": {
        "hubspotApi": ""
      }
    }
  ],
  "connections": {
    "Mock Form Data": {
      "main": [
        [
          {
            "node": "Hubspot6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Thank you for your fast response! Now I can reach to hubspot form. But now I see that I can not send Ticket Properties to my form which are “subject” and “contect” named parameters despite the fact that they are in the mock form input. Those are used to create a ticket to a newly created contact.

Am I missing something else?

Sorry but do not understand what you mean.

My mock form at n8n is as below;

return [{
    json: {
      firstname: 'Jim Smith',
      phone: '5003002030',
      email: '[email protected]',
      city: 'city name',
      address: 'address',
      agrio_lead_type: 'FARMER',
      agrio_lead_channel: 'WEB',
      lifecyclestage: 'opportunity',
      hs_lead_status: 'UNQUALIFIED',
      subject: 'Ticket Subject',
      content: 'Ticket Content'
    }
}]

All parameters are accepted by Hubspot but “subject” and “content”. Like they are never added in the first place. Is it possible that those two parameter names are reserved and could be excluded from the payload?

Ah ok now I understand.

Yes that would be possible. Can however right now not find anything about that in their documentation:

Maybe would really be worth a trying to simply rename them and see if that works.

It works when I make them optional.

But the problem is; those parameter names can not be changed because they are “Ticket” object parameters and used to create a Ticket in the CRM. ( Hubspot mentioned this as “This property is provided by HubSpot and cannot be edited.”)

So as a result “Form Submit to Create a Support Ticket on HubSpot” may require a workaround on n8n side.

Not sure what kind of workaround would be possible on the n8n side as it does nothing else than simply sending the data to Hubspot via their own API. So if supplying “context” and “content” does not work in n8n it will not work anywhere.
Meaning if we want to make it work, we have to find out how other people send the data to the API to fill those fields. Maybe some kind of prefix, postfix, …?

I have tested and see that all “Ticket” object parameters given in the AJAX call to Hubspot are simply not working. “Contact” object parameters works fine. I will write this to HubSpot.

Permanent solution for n8n could be developing “Ticket” resource to hubspot node (similar to Deals) and let us handle forms and Ticket object separately if you consider doing this for sure. Ticketing is a useful features to have.

Hey @umutgokcen.

I just sent a pull request adding the ticket resource. Hopefully, this will solve the issue you are having. @jan will let you know when is released.

1 Like

Hi there ! Thank you @RicardoE105

Great to hear this, I will be following this topic.

Ah yes thanks. That was very helpful to know that your actual goal was to create a ticket and doing it via a form was only a work around. Will update here like @RicardoE105 said once it got merged and released.

New version which supports tickets got released as 0.61.0

1 Like

Thank You, will use asap.

Dear All;

Thank you for the swift development. HubSpot Node can send a Ticket Now. However, Get Ticket(s) functions do not get “properties” from HubSpot. ( “Create Ticket” shows those properties immediately after creation. So if you did not do this on purpose, you may missed to map something in the response.)

In addition to this bug, I have some other issues and improvements to share with you about the HubSpot node. Would you like me to open another thread or continue here?

By default does the API not return any properties. You can simply add “Properties” under “Additional Fields”. There you can type in the names (comma separated) of the properties you are interested in.

Yes would be great if you would create a new issue for the other improvements and issues.

1 Like