Hubspot -> Update Contact
Action summary
Hubspot -> Update Contact
Function Documentation: HubSpot → Update Contact
Overview
This function allows you to edit an existing contact in HubSpot using specified input parameters. It involves setting environment variables, preparing the request with updated information, and handling the response from the HubSpot API.
Inputs
hubspot_api_key (registry|text) Required Sensitive data
- Description: The API key for your HubSpot account.
first_name (text)
- Description: The updated first name of the contact.
last_name (text)
- Description: The updated last name of the contact.
email (email)
- Description: The updated email address of the contact.
company (text)
- Description: The updated company associated with the contact.
lead_status (enum)
- Description: The updated lead status of the contact.
- Options:
NEW
OPEN
IN_PROGRESS
OPEN_DEAL
UNQUALIFIED
ATTEMPTED_TO_CONTACT
CONNECTED
BAD_TIMING
contact_owner (integer)
- Description: The updated owner of the contact.
phone_number (text)
- Description: The updated phone number of the contact.
contact_id (integer)
- Description: The unique identifier of the contact to be edited.
additional_properties (json)
- Description: Additional properties in JSON format to be updated.
- Schema:
{ "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }
[❗] You can clear a property value by passing an empty string. Example:
{"company":""}
. This will clear the value stored in the company field.
Function Stack
1. Set Properties Object
- Create Variable:
properties_object
- Purpose: Sets properties object from
input: additional_properties
and other input fields.
- Purpose: Sets properties object from
2. HubSpot API Request
- API Request to
https://api.hubapi.com/crm/v3/objects/contacts/{contact_id}
- Purpose: Sends a PATCH request to update the specified contact in HubSpot.
3. Create Variable
- Create Variable:
inputss
- Purpose: Checks if the company input is null.
4. Preconditions
- Precondition:
hubspot_api.response.status == 200
- Purpose: Ensures successful update of the contact with HTTP status code 200.
Response
- The function returns the result from the HubSpot API response.
Success response
{
"id": "123456789",
"properties": {
"company": "Xano",
.
.
.
"phone": "42"
},
"createdAt": "2024-09-16T12:11:28.596Z",
"updatedAt": "2024-09-23T13:41:47.246Z",
"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": "Xano",
"last_name": "Actions",
"email": "actions@xano.com",
"company": "Xano",
"lead_status": "OPEN_DEAL",
"contact_owner": 0,
"phone_number": "42",
"contact_id": 123456789,
"additional_properties": {
"mobilephone":"1024"
}
Output
{
"id": "123456789",
"properties": {
"company": "Xano",
.
.
.
"phone": "42"
},
"createdAt": "2024-09-16T12:11:28.596Z",
"updatedAt": "2024-09-23T13:41:47.246Z",
"archived": false
}
Version notes
2024-10-04 14:10:20
Current