Assign a HubSpot deal to the rep Calendly booked
Round-robin booking picks the person who will meet the customer. The related HubSpot deal can still belong to someone else, leaving the new host without a clear handoff.
Integrations used in this example
Keep the meeting host and deal owner aligned
For one selected Calendly round-robin event type, this automation looks up the booked host by email, finds the invitee's existing HubSpot contact, and checks that contact's associated deals. If exactly one deal is in your chosen stage, it assigns that deal to the host.
The change overwrites the deal's current owner. When the host, contact, or eligible deal cannot be identified uniquely, the automation posts the booking to Slack for review and leaves the deal alone.
A team wanted the host chosen by Calendly round robin to own the associated HubSpot deal. The reply explains that Calendly's native contact-owner sync does not update deal ownership and preserves the owner of an existing contact.Source: Calendly Community: round-robin host as HubSpot deal owner
What you'll tell the agent
- The Calendly organization and round-robin event type to watch.
- The HubSpot deal stage eligible for reassignment.
- A Slack channel for bookings that need a human review.
- Account authorization for Calendly, HubSpot, and Slack.
The agent will create the project and ask you for these details. When Automate.ax asks you to connect an account, authorize the integrations you want this workflow to use.
The agent builds the automation, helps you find the event type and deal stage, and opens account authorization during deployment. You do not need to set up a webhook yourself.
The automation
The booking provides a host and invitee. The automation matches that host to one HubSpot owner by email, the invitee to one existing contact, and the contact to exactly one deal in the selected stage before changing its owner.
import { automation, t, withPrerequisites } from "automate.ax"
import { calendly } from "automate.ax/calendly"
import { hubspot } from "automate.ax/hubspot"
import { slack } from "automate.ax/slack"
export default automation(
"Assign an onboarding deal to the Calendly round-robin host",
{
parameters: [
{ label: "Calendly organization URL", name: "calendlyOrganizationUri", type: "url" },
{ label: "Round-robin event type URL", name: "roundRobinEventTypeUri", type: "url" },
{ label: "Eligible HubSpot deal stage ID", name: "eligibleDealStageId", type: "text" },
{ label: "Slack review conversation ID", name: "reviewConversationId", type: "text" },
],
},
({ parameters }) => {
const booking = calendly
.onInviteeCreated({
organizationUri: parameters.calendlyOrganizationUri,
scope: "organization",
})
.filter(
({ payload }) =>
payload.scheduledEvent.eventType === parameters.roundRobinEventTypeUri,What a run looks like
Example input
Dana is chosen to host a round-robin onboarding call. The invitee's HubSpot contact has one deal in the onboarding stage, currently owned by Alex.
Expected result
That deal's owner changes from Alex to Dana. If the contact has two deals in the onboarding stage, neither deal changes and a Slack review message names the booking.
Set it up
- Copy the setup prompt at the top into your coding agent.
- Tell the agent which Calendly round-robin event type to watch, which HubSpot deal stage is eligible, and where Slack reviews should go. It will help find the required IDs and URLs.
- Authorize Calendly, HubSpot, and Slack when prompted. Confirm that matching a booked host is allowed to replace the current owner of an eligible deal.
- Test with a disposable Calendly event and HubSpot deal that are not connected to ad tracking. Do not make a test booking tracked by Meta.
Check the result
With a disposable booking and deal, confirm the matched host becomes the deal owner. Then test a missing or ambiguous match and confirm Slack receives a review message while the deal owner stays unchanged.
Where this workflow stops
- The invitee must already exist as one HubSpot contact. This automation does not create contacts; a contact sync that runs after the booking may send the booking to Slack for review.
- The host email must match exactly one HubSpot owner, and the contact must have exactly one associated deal in the selected stage. It never chooses arbitrarily between multiple matches.
- The code checks at most 500 HubSpot owners and fewer than 100 associated deals. Larger sets go to review instead of risking a partial match.
- A successful match overwrites the deal's current owner. Review your assignment policy before deployment.
Common questions
Does this change the contact owner too?
No. It updates the eligible deal owner only. The contact's owner stays as it was.
What if the invitee has several deals?
Only deals in the configured stage count. If exactly one qualifies, that deal is updated. If none or several qualify, Slack gets a review message and no deal changes.
What if the invitee is not in HubSpot yet?
The booking goes to Slack for review. The automation does not create a contact or guess which deal belongs to the invitee.