fastify-xhubspot
engagement.createCall
Log a call engagement against a HubSpot contact.
engagement.createCall
Create a call engagement and associate it with a HubSpot contact.
Signature
fastify.engagement.createCall(
contactId: string,
callData: {
body?: string;
callResult?: string;
callDuration?: number;
ownerId?: string;
}
): Promise<{ id: string; properties: Record<string, string>; createdAt: string }>
Params
| Name | Type | Required | Description |
|---|---|---|---|
contactId | string | Yes | HubSpot contact ID. |
callData.body | string | No | Call notes or summary. |
callData.callResult | string | No | HubSpot call outcome, e.g., "COMPLETED", "NO_ANSWER", "BUSY". Default: "COMPLETED". |
callData.callDuration | number | No | Call duration in milliseconds. Default: 0. |
callData.ownerId | string | No | HubSpot owner ID to assign the call to. |
Returns
{ id, properties, createdAt }.
Throws
[xHubspot] engagement.createCall requires a contactId[xHubspot] engagement.createCall requires a callData object- Re-throws HubSpot API errors.
Examples
Basic — log a completed call
await fastify.engagement.createCall("12345", {
body: "Discussed pricing and next steps. Sending proposal this week.",
callResult: "COMPLETED",
callDuration: 12 * 60 * 1000, // 12 minutes in ms
});
From a VoIP webhook
fastify.post("/voip/webhook", async (request) => {
const { contactId, durationMs, outcome, transcript, ownerId } = request.body;
await fastify.engagement.createCall(contactId, {
body: transcript,
callResult: outcome,
callDuration: durationMs,
ownerId,
});
return { logged: true };
});
See also
- engagement.getCalls — list all calls for a contact
- engagement.createNote — log a text note instead
AI Context
package: "@xenterprises/fastify-xhubspot"
method: fastify.engagement.createCall(callData)
use-when: Log a call against a HubSpot contact
params: { body, durationMilliseconds, status, contactId, ownerId? }
returns: { id, properties }
