Hubspot -> Create Deal
Action summary
Hubspot -> Create Deal
Function Documentation: HubSpot → Create Deal
Overview
This function creates a new deal in HubSpot using specified input parameters. It involves setting environment variables, preparing the request with deal details, 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.
name (text)
- Description: The name of the deal.
deal_stage (enum)
- Description: The stage of the deal.
- Options
appointmentscheduled
qualifiedtobuy
presentationscheduled
decisionmakerboughtin
contractsent
closedwon
closedlost
close_date (timestamp)
- Description: The expected close date of the deal. A unix timestamp in milliseconds.
owner_id (integer)
- Description: The ID of the owner of the deal.
amount (decimal)
- Description: The amount associated with the deal.
additional_properties (json)
- Description: Additional properties in JSON format for the deal.
Function Stack
1. Create Properties Object
- Create Variable:
properties_obj
- 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/deals
- Purpose: Sends a POST request to create a new deal in HubSpot.
3. Preconditions
- Precondition:
hubspot_api.response.status == 201
- Purpose: Ensures successful creation of the deal with HTTP status code 201.
Response
- The function returns the result from the HubSpot API response.
Success response
{
"id": "22658811284",
"properties": {
"createdate": "2024-09-26T11:47:07.243Z",
.
.
.
},
"createdAt": "2024-09-26T11:47:07.243Z",
"updatedAt": "2024-09-26T11:47:07.243Z",
"archived": false
}
Error response
{
"message": "Uh oh! Hubspot returned with an error: Authentication credentials not found. This API supports OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview"
}
Example
Input
{
"name": "Xano Actions",
"deal_stage": "qualifiedtobuy",
"close_date": 1729771263000,
"owner_id": 0,
"amount": 1456.55,
"additional_properties":
{
"closed_won_reason": "Quick deployment"
}
}
Output
{
"id": "22651426560",
"properties": {
"amount": "1456.55",
.
.
.
},
"createdAt": "2024-09-26T12:02:50.213Z",
"updatedAt": "2024-09-26T12:02:50.213Z",
"archived": false
}
Version notes
2024-10-03 16:57:38
Current