Refer to Integrate Mavenoid with HubSpot if you haven't added the HubSpot API token as a secret in Mavenoid.
Search for Contacts
Use the POST /crm/v3/objects/contacts/search
endpoint to check if the customer already has a contact in HubSpot. If a contact exists, save the contact ID, as it will be needed to associate the ticket with that contact.
Create a Contact
If the customer doesn't have an existing contact, use the POST /crm/v3/objects/contacts
endpoint to create one.
Create Ticket
Use the POST /crm/v3/objects/tickets
endpoint to create a ticket for the contact. To link the ticket with the contact, add the following associations data to the request:
"associations": [
{
"to": {
"id": {{CONTACT_ID}}
},
"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 16
}
]
}
]
The associationTypeId
of "16" represents the "Ticket to Contact" link. For more details, see HubSpot's article CRM Associations API Overview.