Create ticket with assignment to a user via API calls

tickets

#1

Hi Team! I am posting this on behalf of a customer, am looking for a possibility to create tickets via API, that will assign the tickets to users in the portal. Wondering if this is possible -- if so, what can be done for this?


#2

Hey! I am the customer -- we would like the ticket to assign a customer / ticket sender :slight_smile:


#4

Hi guys @Cassandra_Law / @Chris_Cardone, happy to help here. At the moment there's not a way to create a ticket and associate it with one API call. However, this is definitely possible using both the Tickets API and the CRM Associations API.

To do this, you should be able to:

  1. use this endpoint to create your ticket
  2. Then, make a PUT request to this endpoint to associate a contact with that particular ticket.

In order to decide how to format your PUT request, you should consult the associations definitions. Be aware that:

"Association definitions are unidirectional , so you'll use a different definition ID depending on which object type you're starting with. For example, if you have a contact (identified by its vid ) and you want the associated tickets, you would use definition ID 15. If you have a ticket (identified by its objectId ) and you want the associated contacts, you would use definition ID 16. See the table below for the full list of definition IDs."


#5

Hi @Connor_Barley, thanks! That worked -- how would we then assign it to a user or set it so the new ticket notifies uses?


#6

Hi @Chris_Cardone, you should be able to include the ticket owner field in your POST body during the initial creation of the ticket from step 1 I wrote above. The field would just be added to the body like this:

{
  "name": "hubspot_owner_id",
  "value" : "27029667"
}

The value field from above would be found in your property settings at this link format:

https://app.hubspot.com/property-settings/HUBID_HERE/ticket/hubspot_owner_id

or by making a GET request to this endpoint:


#7

Thanks @Connor_Barley! That did assign an owner, however, is there anyway to assign it to a team?


#8

Hi @Chris_Cardone, I'd make sure to check that their user preferences are set up so that they receive ticket notifications. To send an email to a team you might want to try setting up a Ticket-based workflow. The enrollment criteria could be that the ticket owner is known, AND the owners of the ticket are any of the people from that team. You'd need to make a separate workflow for each team I believe, but you should try testing out a few things to see if it fits your need. The action would be that you send an internal notification to a team. Definitely don't set it up so contacts who already meet the criteria get enrolled. If you have a lot of tickets your team would get tons and tons of emails based on that enrollment criteria above :laughing:. You can then send all future notifications of assigned tickets to that specified team!