# HubSpot + Calendly

Turn a Calendly meeting into a consent-aware call and a HubSpot contact update with an Agent Worker.

This is an example to build and test for the user's accounts, not a preconfigured connector.

## Example

When someone books a discovery call, a worker finds the matching HubSpot contact. If an approved phone number is present, it can call to confirm the request and put the call receipt back on that contact.

## How it works

1. **Subscribe to meeting events.** Create a Calendly webhook subscription for invitee.created and, if needed, invitee.canceled. Use a signing key and verify the Calendly-Webhook-Signature and timestamp against the original request. For reliable delivery, use your own receiver to verify and durably store the event, respond within Calendly's 15-second read timeout, then forward a normalized event with a stable event_id to the authenticated Worker webhook. Reuse the same ID and body on retry. An accepted replay returns the existing run even if it failed; inspect its receipt and reconcile any side effects before sending a recovery event with a new event_id. The direct private URL runs synchronously; every delivery that starts a run is billed, including retries.
2. **Identify the HubSpot contact.** Use the invitee's email to find the right contact. Decide how to handle an unmatched or ambiguous contact before allowing writes.
3. **Call only when authorized.** Check the number and permission to call, place the approved call and save the call ID and result to the contact. Calendly sends cancellation and creation events for a reschedule, so reconcile the old and new invitee before another follow-up.

## What you need

- Calendly access to create the appropriate webhook subscription and a signing key; use your own durable receiver for the handoff described above.
- HubSpot contact read and write access through an approved connection or scoped API credential.
- An enabled Agent Worker, a funded wallet for calls, and a phone number plus permission for each call.

Agent Worker runs are billed separately from calls and texts. Check instance availability, [pricing](/docs#pricing), permissions and the user's approved limits. Test with fictional data before activation. Preserve stable event IDs and reconcile an uncertain write before retrying it.

## Prompt

```text
Help me connect Calendly and HubSpot through an Agent Worker. Verify booking events, match invitees by email and reconcile reschedules. If I approve the call and the invitee has given permission, call them and save the outcome to their contact. Test it and show costs before activation.
```

## Provider documentation

- [Calendly webhook subscriptions](https://developer.calendly.com/docs/api-guides/receive-data-from-scheduled-events-in-real-time-with-webhook-subscriptions)
- [Calendly webhook signatures](https://developer.calendly.com/api-docs/overview/webhooks/webhook-signatures)
- [Calendly reschedule events](https://developer.calendly.com/docs/api-guides/see-how-webhook-payloads-change-when-invitees-reschedule-events)
- [Calendly webhook timeouts](https://developer.calendly.com/api-docs/overview/webhooks/webhook-timeouts)
- [HubSpot contacts API](https://developers.hubspot.com/docs/api-reference/crm-contacts-v3/guide)

[Agent Worker webhook playbook](/recipes/crm-trigger-call.md) · [Connection guide](/docs#worker-connections)
