X Enterprises
fastify-xhubspot

deals.update

Update properties on an existing HubSpot deal.

deals.update

Update one or more properties on a HubSpot deal.

Signature

fastify.deals.update(
  dealId: string,
  properties: Record<string, string>
): Promise<{ id: string; properties: Record<string, string> }>

Params

NameTypeRequiredDescription
dealIdstringYesHubSpot internal deal ID.
propertiesobjectYesMap of property names to new values.

Returns

{ id, properties } after update.

Throws

  • [xHubspot] deals.update requires a dealId
  • [xHubspot] deals.update requires a properties object
  • Re-throws HubSpot API errors.

Examples

Move a deal to closed-won

await fastify.deals.update("67890", {
  dealstage: "closedwon",
  closedate: new Date().toISOString().split("T")[0],
});

Realistic — advance stage on webhook

fastify.post("/payments/webhook", async (request) => {
  const { dealId, status } = request.body;

  if (status === "paid") {
    await fastify.deals.update(dealId, { dealstage: "closedwon" });
    await fastify.companies.update(companyId, { lifecyclestage: "customer" });
  }

  return { ok: true };
});

See also

AI Context

package: "@xenterprises/fastify-xhubspot"
method: fastify.deals.update(dealId, updateData)
use-when: Update properties on an existing HubSpot deal (e.g. move through pipeline stages)
returns: { id, properties }
Copyright © 2026