⚙ Operations Hub

ARich
Contributor

Automatic Team updates based on OOO Status

SOLVE

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? 

1 Accepted solution
KimM
Solution
Contributor

Automatic Team updates based on OOO Status

SOLVE

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:

Screenshot 2023-05-18 at 09.55.05.png

Screenshot 2023-05-18 at 09.59.46.png

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.

 

Let me know if you need any further help.

View solution in original post

10 Replies 10
KimM
Contributor

Automatic Team updates based on OOO Status

SOLVE

Hi @ARich , Would be helpful to know exactly how you track OOO Status for your team? 

ARich
Contributor

Automatic Team updates based on OOO Status

SOLVE

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. 

0 Upvotes
KimM
Contributor

Automatic Team updates based on OOO Status

SOLVE

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:

  1. First, you'll need to match the google calendar user with the hubspot user. To do so you'll probably need to retrieve all the users from the account using the User Provisioning API (https://developers.hubspot.com/docs/api/settings/user-provisioning). 
  2. 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).
  3. 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.

 

Hope this helps!

ARich
Contributor

Automatic Team updates based on OOO Status

SOLVE

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

0 Upvotes
KimM
Solution
Contributor

Automatic Team updates based on OOO Status

SOLVE

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:

Screenshot 2023-05-18 at 09.55.05.png

Screenshot 2023-05-18 at 09.59.46.png

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.

 

Let me know if you need any further help.

ARich
Contributor

Automatic Team updates based on OOO Status

SOLVE

@KimM WOW!!!! This was the easiest solution ever! I cannot thank you enough!! THANK YOU!!

KimM
Contributor

Automatic Team updates based on OOO Status

SOLVE

Not a problem @ARich. Glad we found a solution!

ARich
Contributor

Automatic Team updates based on OOO Status

SOLVE

@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. 

0 Upvotes
KimM
Contributor

Automatic Team updates based on OOO Status

SOLVE

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.

kvlschaefer
Community Manager
Community Manager

Automatic Team updates based on OOO Status

SOLVE

Hi @ARich,

 

Thank you for reaching out to the Community!

This is a great question 🙂 

 

I wanted to invite our subject matter experts to this conversation.

Hi @HubDoPete@LMeert@Chriso-mwx - Do you have any tips for @ARich?

Thank you!

 

Best,

Kristen


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes