Hubspot -> Create Contact
Action summary
Hubspot -> Create Contact
Function Documentation: HubSpot → Create Contact
Overview
This function creates a new contact in HubSpot using specified input parameters. It involves setting environment variables, preparing the request, and handling the response.
Inputs
hubspot_api_key (registry|text) Required Sensitive data
- Description: The API key for your HubSpot account.
first_name (text)
- Description: The first name of the contact.
last_name (text)
- Description: The last name of the contact.
email (text)
- Description: The email address of the contact.
company (text)
- Description: The company associated with the contact.
lead_status (enum)
- Description: The lead status of the contact.
- Options:
NEW
OPEN
IN_PROGRESS
OPEN_DEAL
UNQUALIFIED
ATTEMPTED_TO_CONTACT
CONNECTED
BAD_TIMING
contact_owner (integer)
- Description: The owner of the contact.
phone_number (text)
- Description: The phone number of the contact.
additional_properties (json)
- Description: Additional properties in JSON format.
- Schema:
{ "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }
Function Stack
1. Set Properties Object
- Create Variable:
properties_object
- Purpose: Sets properties object from
input: additional_properties
.
- Purpose: Sets properties object from
2. HubSpot API Request
- API Request to
https://api.hubapi.com/crm/v3/objects/contacts
- Purpose: Sends a POST request to create a new contact in HubSpot.
3. Preconditions
- Precondition:
hubspot_api.response.status == 201
- Purpose: Ensures successful creation of the contact with HTTP status code 201.
Response
- The function returns the result from the HubSpot API response.
Success response
{
"id": "12345678",
"properties": {
"company": "Xano",
.
.
.
},
"createdAt": "2024-09-23T13:26:23.352Z",
"updatedAt": "2024-09-23T13:26:23.352Z",
"archived": false
}
Error message
{
"message":"Uh oh! Hubspot returned with an error: Property values were not valid: [{\"isValid\":false,\"message\":\"Property \\\"prop2\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"prop2\",\"localizedErrorMessage\":\"Property \\\"prop2\\\" does not exist\",\"portalId\":47373842},{\"isValid\":false,\"message\":\"Property \\\"prop1\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"prop1\",\"localizedErrorMessage\":\"Property \\\"prop1\\\" does not exist\",\"portalId\":47373842}]"
}
Example
Input
{
"first_name": "Unico",
"last_name": "Connect",
"email": "imagine@xano.com",
"company": "UC",
"lead_status": "OPEN",
"contact_owner": 0,
"phone_number": "123456",
"customer_Id": 0,
"additional_properties":
{
"mobilephone":"123456"
}
}
Output
{
"id": "123456789",
"properties": {
"company": "UC",
"createdate": "2024-09-23T13:30:40.386Z",
"email": "imagine@xano.com",
"firstname": "Unico",
"hs_all_contact_vids": "60968500829",
"hs_currently_enrolled_in_prospecting_agent": "false",
"hs_email_domain": "xano.com",
"hs_is_contact": "true",
"hs_is_unworked": "true",
"hs_lead_status": "OPEN",
"hs_lifecyclestage_lead_date": "2024-09-23T13:30:40.386Z",
"hs_marketable_status": "false",
"hs_marketable_until_renewal": "false",
"hs_membership_has_accessed_private_content": "0",
"hs_object_id": "60968500829",
"hs_object_source": "INTEGRATION",
"hs_object_source_id": "3898752",
"hs_object_source_label": "INTEGRATION",
"hs_pipeline": "contacts-lifecycle-pipeline",
"hs_registered_member": "0",
"hs_searchable_calculated_mobile_number": "123456",
"hs_searchable_calculated_phone_number": "123456",
"lastmodifieddate": "2024-09-23T13:30:40.386Z",
"lastname": "Connect",
"lifecyclestage": "lead",
"mobilephone": "123456",
"phone": "123456"
},
"createdAt": "2024-09-23T13:30:40.386Z",
"updatedAt": "2024-09-23T13:30:40.386Z",
"archived": false
}
Version notes
2024-10-04 13:59:08
Current