fastify-xhubspot
engagement.getTasks
Retrieve task engagements associated with a HubSpot contact.
engagement.getTasks
Returns full property objects for all task engagements associated with a given HubSpot contact.
Signature
fastify.engagement.getTasks(
contactId: string,
limit?: number
): Promise<Array<{ id: string; properties: Record<string, string> }>>
Params
| Name | Type | Required | Description |
|---|---|---|---|
contactId | string | Yes | HubSpot contact ID. |
limit | number | No | Maximum number of results to return. Defaults to the HubSpot API default (100). |
Returns
Array of { id, properties } for each matching task engagement. Relevant properties keys include hs_task_subject and hs_task_status.
Throws
[xHubspot] engagement.getTasks requires a contactId- Re-throws HubSpot API errors on network failure after logging via
fastify.log.error.
Examples
Basic
const tasks = await fastify.engagement.getTasks("12345");
Realistic
const tasks = await fastify.engagement.getTasks("12345");
const openTasks = tasks.filter(t => t.properties.hs_task_status !== "COMPLETED");
See also
- engagement.getEngagements — summarise all engagement types for a contact
- engagement.getNotes — list notes for a contact
- engagement.getCalls — list calls for a contact
- engagement.getEmails — list emails for a contact
- engagement.createTask — create a task on a contact
AI Context
package: "@xenterprises/fastify-xhubspot"
method: fastify.engagement.getTasks(contactId, limit?)
use-when: List task engagements for a given HubSpot contact
returns: Array<{ id, properties }>
