Hi @01950
It looks like you are trying to create a ticket in HubSpot using the HubSpot Forms API, but the ticket number is not being generated automatically.
HubSpot generates ticket numbers automatically only for tickets created through the Tickets API, not through the Forms API. Therefore, if you want the ticket number to be generated automatically, you should create the ticket using the Tickets API.
Here’s an example of how you could use the Tickets API to create a ticket in HubSpot:
1. First, you will need to obtain an OAuth access token from HubSpot.
2. Next, you can use the access token to make a POST request to the Tickets API endpoint, which is located at https://api.hubapi.com/crm-objects/v1/objects/tickets. The request body should include the following properties:
- `properties`: An object containing the properties of the ticket, including the `subject`, `content`, `ticket_type`, `feature_request_category`, and `user_role`.
- `associations`: An object containing the associations between the ticket and other HubSpot objects, such as contacts, companies, or deals. For example, you could associate the ticket with a contact by including the `contactIds` property and setting it to an array of contact IDs.
Here’s an example of what the request body might look like:
```
{
“properties”: {
“subject”: “Feature Request Ticket (in-product)”,
“content”: “This is the content of the ticket.”,
“ticket_type”: “Feature Request”,
“feature_request_category”: “Feature Request”,
“user_role”: “Role”
},
“associations”: {
“contactIds”: [123],
“companyIds”: [456],
“dealIds”: [789]
}
}
```
3. Finally, you can parse the response to retrieve the ticket number, which is located in the `objectId` property of the response.
Note that you will need to have the appropriate permissions and access to use the Tickets API. Also, make sure that you are properly authenticating your requests using the access token.
Please mark it as SOLUTION ACCEPTED if you like the solution.
Thank you!