1. Help Center
  2. 0CodeTools for HubSpot

API Webhook Connector Workflow Action

The API Webhook Connector allows you to seamlessly send custom data to external services from your HubSpot workflows. 

API Webhook Connector

Initiates a webhook call to an external service, allowing for a customizable payload and the inclusion of specific headers, with the capability to handle particular data points from the response.

HTTP Method Select the type of HTTP request you wish to send. Options include GET, POST, PUT, PATCH, and DELETE. The method you choose should correspond to the type of operation you intend to perform with the external service.

Webhook URL Enter the endpoint URL to which the webhook should send the JSON payload. This URL is provided by the service you are integrating with. If the service's API requires an API key within the URL, append it directly to the Webhook URL.

Headers Configure header lines for your HTTP request as needed by the external service. This is typically used for setting content types or providing authentication such as API keys or Bearer tokens.

Examples of Headers:

  • Authorization: Bearer [Your_Bearer_Token]

  • x-api-key: [Your_API_Key]

  • Header line 1

  • Header line 2

JSON Body Enter the JSON formatted payload that will be sent to your endpoint. Personalization tokens can be included to dynamically insert data from HubSpot Contacts, Companies, Deals, Tickets, Custom Objects, etc.

Result Variables Specify variable names to capture specific values from the JSON response returned by the external service using dot notation.

  • Result variable name 1
  • Result variable name 2
  • Result variable name 3

Example: To capture a user's email from the response, specify the result variable as response.result.user.email. For more detailed examples and instructions on using dot notation, please refer to our documentation.

 

Action Outputs

After the API Webhook Connector action is executed, the following outputs are available for use in subsequent actions within the workflow:

  • Full JSON Response: This output provides the complete JSON response received from the webhook's external service. It can be used for detailed examination or for passing the entire response payload to another step in the workflow.

  • Result 1, Result 2, Result 3: These are individual outputs that store specific data extracted from the JSON response using the dot notation paths provided in the Result Variables settings. They allow for granular control and usage of data points within the workflow.

  • Status: Indicates the final success or failure state of the webhook call. This can be utilized to create conditional paths in your workflow, allowing for different actions based on whether the webhook was successfully executed or not.

Ensure that your workflow is configured to handle these outputs appropriately, especially in cases where conditional logic is based on the success or failure of the API call.

 

Utilizing Action Outputs in Your Workflow

The outputs from the API Webhook Connector provide valuable data that can be used to make dynamic decisions and take actions within your workflow. Here's how you can utilize them effectively:

  1. Full JSON Response:

    • Use this output when you need to process the entire response from the external service.
    • For example, you could log the full response to a custom object for audit purposes or for debugging.
  2. Result Variables (Result 1, Result 2, Result 3):

    • These outputs should be used when you need specific information from the JSON response.
    • For instance, if you are expecting a user ID and an user status in the response, you could use Result 1 to store response.result.user.id and Result 2 for response.result.user.status.
    • You can then use these variables to update contact records using HubSpot's native workflow action Copy Property Value
  3. Using the Status Code in Your Workflow

    The "Status" output from the API Webhook Connector provides the HTTP status code returned by the external service. This code can be used to determine the next steps in your workflow based on the success or failure of the API request.

    Understanding Status Codes:

      • 2xx series status codes indicate success (e.g., 200 OK, 201 Created).
      • 4xx series indicate client errors (e.g., 400 Bad Request, 401 Unauthorized).
      • 5xx series indicate server errors (e.g., 500 Internal Server Error).