How to use association api to attach contact to a ticket

I had created a contact in hubspot and then i tried to create ticket in which i got success. But when i am trying to attach contact to that ticket via association api i am stuck and getting error in api about java.lang.string error. here is the code that i tried.

const createTicketResponse = await hubspotClient.crm.tickets.basicApi.create(ticketObj)

await hubspotClient.crm.tickets.associationsApi.create(createTicketResponse.id, “tickets”, “151”, ‘’)

Here 151 is contact id.

@SSaini6

Looking at it, it appears you are missing the association type ticket_to_contact

Check out the example here.

And poll the associations API for a comprehensive list of association types and IDs

Thanks @dennisedson . It works for me now.