ACTIONS
  • Home
  • My Actions
  • My Projects
  • My Packages
Hubspot -> Update Contact
Function Documentation: HubSpot → Update Contact

Action summary

Hubspot -> Update Contact

Xano

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

  1. hubspot_api_key (registry|text) Required Sensitive data

    • Description: The API key for your HubSpot account.
  2. first_name (text)

    • Description: The updated first name of the contact.
  3. last_name (text)

    • Description: The updated last name of the contact.
  4. email (email)

    • Description: The updated email address of the contact.
  5. company (text)

    • Description: The updated company associated with the contact.
  6. 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
  7. contact_owner (integer)

    • Description: The updated owner of the contact.
  8. phone_number (text)

    • Description: The updated phone number of the contact.
  9. contact_id (integer)

    • Description: The unique identifier of the contact to be edited.
  10. 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

  1. Create Variable: properties_object
    • Purpose: Sets properties object from input: additional_properties and other input fields.

2. HubSpot API Request

  1. 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

  1. Create Variable: inputss
    • Purpose: Checks if the company input is null.

4. Preconditions

  1. 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
2024-10-04T19:10:22.000+00:00