X Enterprises
fastify-xhubspot

engagement.getEngagements

Retrieve a summary of all engagement IDs and types associated with a HubSpot contact.

engagement.getEngagements

Returns a summary of all engagement IDs and their association type labels for a given HubSpot contact via the associations API.

Signature

fastify.engagement.getEngagements(
  contactId: string
): Promise<{ engagements: Array<{ id: string; type: string }>; total: number }>

Params

NameTypeRequiredDescription
contactIdstringYesHubSpot contact ID. Queries the associations API for all engagement types.

Returns

FieldTypeDescription
engagementsArray<{ id, type }>All engagement IDs and their association type labels.
totalnumberTotal count of associated engagements.

Throws

  • [xHubspot] engagement.getEngagements requires a contactId
  • Re-throws HubSpot API errors on network failure after logging via fastify.log.error.

Examples

Basic

const { engagements, total } = await fastify.engagement.getEngagements("12345");
console.log(`${total} total engagements`);
// [{ id: "9001", type: "CONTACT_TO_NOTE" }, { id: "9002", type: "CONTACT_TO_TASK" }]

Realistic

fastify.get("/contacts/:id/engagements", async (request, reply) => {
  const { engagements, total } = await fastify.engagement.getEngagements(request.params.id);
  return reply.send({ engagements, total });
});

See also


AI Context

package: "@xenterprises/fastify-xhubspot"
method: fastify.engagement.getEngagements(contactId)
use-when: List all engagement IDs and types associated with a HubSpot contact via the associations API
returns: { engagements: Array<{ id, type }>, total }
Copyright © 2026