I'd love to know if anyone has discovered a way to monitor when someone is out of office and then automatically remove them from the lead rotation.
I've considered trying to use a custom code action in a workflow that looks at availability management. If they are away, we update their team to "not taking leads" and if they are available they are "taking leads." Is this possible?
Has anyone else found a good way to do this with other tools? Zapier, Workflows, anything?
Hey @ARich , not a problem. I set this up and tested it and actually you can just update a user's team with their email address. So here's how I would do it:
You will need to have set up a private app to be able to execute these. Documentation here: https://developers.hubspot.com/docs/api/private-apps. and it will need the following scopes: settings.users.write and settings.users.read. Then you can get the access token and insert it into the webhook.
This is also presuming that the individual who is 'out of office' is the one that adds the event in the calendar. If this is not the case you may need to look at the data returned from the event trigger and another way to fetch the email for the person you want to remove from the allocations team.
Also, if you aren't using the allocations team as the 'primary team' but rather secondary teams, then you may need to slightly switch up your approach here. Get the list of all users, add a custom code step use some logic that handles the secondary team id's by removing the allocations one from a list (presuming that there is multiple teams). If this is how you handle it let me know and I'll have a look.
And finally, you would also set up a second zap that does the reverse of this. So is triggered by the event end, and sets the primary team to the allocations team.
We built this solution using HubSpot workflows event handler and have an action you can add directly on the workflow.
You can add schedules for each user, and easily manage user availability without having to take them off teams - this helps especially if you have a lot of reports using the "HubSpot Team" property.
Hope this helps in case the Zapier integration didn't work out - we offer trials and other features that can bring efficiency gains to your sales team.
Hi @KimM! We're a pretty small company right now so currently we have a shared Google calendar where we track when people are OOO. We're currently manually going into the users/teams section to change people to a new team to remove them from the round robins. It works, but it has several manual steps.
Ah great, this should work then using Zapier. You can trigger a zap that looks for upcoming google calendar events for a group calendar. You can also add a search term to this, so as long as you have standardised events in your group calendar (ie, always contain the phrase 'Annual Leave') you can trigger this action.
From there you'll likely have to do 3 additional steps:
You may then want to do a 'code by zapier' step to loop through these results to find the user id that is associated with the email from the google calendar event (assuming your sales team only have one email address they use for both google and hubspot).
Finally, now you can update the team for that user using the User Provisioning API again and the 'Modify a User' endpoint. You could quite easily do this with no code using the webhooks by zapier step.
Then you may need to set up a second zap that handles changing this back once the event ends. It would be almost identical but instead of triggering when an event starts, it would trigger when it ends.
Let me know if you need any help with code samples.
The alternative option would be to check google calendar whenever assigning leads, however, I think this would be more complicated and wouldn't be as effective. The above-suggested approach will only trigger when there is an OOO event, instead of having to check every time a lead is assigned.
When I first implement new automation like this I usually set up some slack notifications to myself to ensure it's behaving in the way I expect for the first few weeks and if not I can action it.
Thanks @KimM! I'm going to see what I can cobble together with what you've suggested. I definitely might need some code examples. But I can also talk with ChatGPT too if that's too much to ask. 😃 I really do appreciate the suggestions
Hey @ARich , not a problem. I set this up and tested it and actually you can just update a user's team with their email address. So here's how I would do it:
You will need to have set up a private app to be able to execute these. Documentation here: https://developers.hubspot.com/docs/api/private-apps. and it will need the following scopes: settings.users.write and settings.users.read. Then you can get the access token and insert it into the webhook.
This is also presuming that the individual who is 'out of office' is the one that adds the event in the calendar. If this is not the case you may need to look at the data returned from the event trigger and another way to fetch the email for the person you want to remove from the allocations team.
Also, if you aren't using the allocations team as the 'primary team' but rather secondary teams, then you may need to slightly switch up your approach here. Get the list of all users, add a custom code step use some logic that handles the secondary team id's by removing the allocations one from a list (presuming that there is multiple teams). If this is how you handle it let me know and I'll have a look.
And finally, you would also set up a second zap that does the reverse of this. So is triggered by the event end, and sets the primary team to the allocations team.
@KimM I'm seeing goofy behavior with this where it wants to update the permission set at the same time as the team. Since I don't give the private app billing access, it errors. This is making no sense to me since we are only sending instructions for the primary team. Any idea why it would be doing that? I don't see any presets of permissions sets that are attached to this team...I'm wondering if I'm missing it though.
hmmm, the api documentation says that it only needs the settings.users.write scope for this, I presume you have assigned this scope?
What makes you think that it has to do with the billing access? Can you send me a copy of the error you receive? And are you receiving it for both the zaps? ie, when you assign it to the allocations team or remove the allocations team
The only thing I can think of here without this is that maybe the primary team you are assigning has billing permissions which is why this is happening. It's not specifically mentioned in any of the documentation though, so I can't see why that would be the case.
Maybe also send some screenshots if you can of how you have set it up.
@KimM here's the error it gave me. The current scope does not have it turned on. However, when I test it by turning it on and then reruning the failed Zap it strips the permission set. The remaining permissions are pretty much nothing, so we found it quickly when it turned off the users lead flow 1 day before they were set to be OOO.
I'm wondering if I add the permission set to this webhook where it just sets the correct one each time if that would be my "fix." I'm only using this for a specific team so I only need it for one permission set technically. However, if we expand the team to include management roles with different permission sets but still taking leads, it wouldn't be ideal.
@KimM I added a get action before this to grab the users information and then using the roleId that I get back during the put. Not ideal, but it does allow for the growth of the team and different permission sets down the road. I'd love if you have more insight on this as we continue to refine this idea. Trying to keep this updated for anyone that comes later to use the same ideas. 🙂