fastify-xhubspot
engagement.getEmails
Retrieve email engagements associated with a HubSpot contact.
engagement.getEmails
Returns full property objects for all email engagements associated with a given HubSpot contact.
Signature
fastify.engagement.getEmails(
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 email engagement. Relevant properties keys include hs_email_subject.
Throws
[xHubspot] engagement.getEmails requires a contactId- Re-throws HubSpot API errors on network failure after logging via
fastify.log.error.
Examples
Basic
const emails = await fastify.engagement.getEmails("12345");
Realistic
fastify.get("/contacts/:id/email-history", async (request, reply) => {
const emails = await fastify.engagement.getEmails(request.params.id, 20);
return reply.send({ emails });
});
See also
- engagement.getEngagements — summarise all engagement types for a contact
- engagement.getNotes — list notes for a contact
- engagement.getTasks — list tasks for a contact
- engagement.getCalls — list calls for a contact
- engagement.createEmail — log an email engagement
AI Context
package: "@xenterprises/fastify-xhubspot"
method: fastify.engagement.getEmails(contactId, limit?)
use-when: List email engagements for a given HubSpot contact
returns: Array<{ id, properties }>
