This article is written for G Suite business users, not consumer Gmail users.

You probably know Gmail's out of office setting to set up one-time auto reply when you're away for vacation or sick leave. But do you wonder if this feature can be used to set up recurring out of office reply? It's useful when you want automated replies to your customers informing you are off work every Wednesday, or something. Yes, it sounds like business hours for Gmail.

Unlike the business hour settings in Google Calendar, Gmail does not come with this business hour setting and auto respond incoming messages when you are off hours.

This article shows how Foresight customizes and automates replying after work hour emails for you, so your customers / partners always get your prompt response and instructions.

If you have yet to install Foresight, check out this quick start.

Video Demo

Consider the conventional 9-5 work hours schedule. Any after hour incoming emails (from 5pm to the 2nd day 9am and the weekends) are automatically replied.

In the nutshell, I created an automation rule in Foresight running daily to update your vacation responder settings in Gmail. Once the rule is set, auto responses are automatically on after 5pm and off at 9am (Monday to Friday). Also, note that 2 different auto response templates are supplied.

Create Your Recurring Out of Office Auto Reply Rule

Before getting your hands dirty on Foresight, let me explain how the automation works.

How It Works

A Foresight automation rule is composed of a Trigger, one or more Actions. When something triggers, execute a series of actions. Regarding this recurring out of office reply case, a rule is typically a Recurring times trigger, an If action, and multiple Update vacation responder actions.

Illustration of the demo recurring out of office auto reply automation rule
Illustration of the demo recurring out of office auto reply automation rule

Don't be intimidated by the cyber jargons. It's easy to understand in human language. Take the demo 9-5 business hour schedule as an example.

  • The rule runs 5pm daily.
  • If the day is one of Monday, Tuesday, Wednesday and Thursday, then turn on your Gmail vacation responder with a canned message until 9am the 2nd day.
  • If the day is Friday, then turn on Gmail vacation responder with a different canned response until 9am the next Monday.
  • If the day is Saturday or Sunday, do nothing since out of office (OOO) is active already.

Once the rule is set, Foresight will periodically activate your OOO status when you are off hours in Gmail. Technically, such automation is to simulate your business hours setting in Gmail.

Configure and build your own rule if you have different schedules. For example, if you don't work on Wednesday and Thursday, then create a rule running every Tuesday 5pm and turning on your Gmail vacation responder for 2 days and 16 hours (until Friday 9am). No If action is needed.

Instructions

Prerequisite: Because the Update vacation responder action used in this use case requires restricted Gmail service access, your domain needs to add Foresight as a trusted third-party app. If you are not the domain administrator, ask your admin to Whitelist Foresight in Admin Console.

Once Foresight has been trusted by your domain, follow these steps.

  1. Sign into Foresight app.
  2. Verify your timezone settings with these steps.
    1. Click your profile image on the top right of screen.
    2. Select Settings from the drop down menu.
    3. Under ACCOUNT tab, Time zone field, verify the detected timezone value matches your time zone.
  3. In the Rules page, click new rule button to draft a new rule.
  4. In the Select a trigger page, select Recurring times trigger.
    Recurring times trigger in Foresight
  5. In the Edit trigger page,
    Configurating recurring trigger in Foresight
    1. Select an initial time to start automation. This would be the first time Foresight automatically turned on OOO reply for you.
    2. Set the recurring schedule. This depends on how frequent you turn on OOO in Gmail. If your OOO mode is only once a week, then repeat every 1 week. If your OOO mode toggles several times a week, then repeat every day.
    3. (Optional) Set an end time for this recurring automation.
  6. Click NEXT.
  7. If your recurring OOO schedule is regular and simple, then in the Select an action page, directly select Update vacation responder. The configuration of this action is explained later.
    Update vacation responder action in Foresight
  8. Otherwise, in the Select an action page, select If action. The action allows you to configure the rule to perform different actions based on predefined conditions. With If action, you will be able to send different responses and activate OOO mode in irregular patterns.
    If action in Foresight
  9. In the Edit actions > If tab, configure different routes to initiate your OOO schedule. An If action have at least 2 branches. The screenshot below is the configuration for the 9-5 business hour demo, a branch for Monday to Thursday 5pm, a branch for Friday 5pm and a fallback branch for Saturday and Sunday.
    Edit If action in Foresight
    1. Create the correct number of branches. Think about the times to activate OOO, and the number of templates.
    2. Give each branch a name.
    3. Edit your conditions for each branch. A branch could have more than one condition. In our demo example, Current Day of Week is between 1 and 4 is translated into the day of week when the rule executes is one of Monday, Tuesday, Wednesday and Thursday. Though the rule will execute at 5pm daily, only the executions on these days will pass this Monday to Thursday branch and take the next action defined in this branch.
    4. Add next actions for branches. For this use case, select Update vacation responder.
  10. In the Edit actions > Update vacation responder tab, configure your vacation responder behavior similar to Gmail's built-in settings.
    Edit Update vacation responder action in Foresight
    1. First of all, grant Foresight permission to update your vacation responder settings via Gmail API. Look into the prerequisite section above you cannot grant permission for it.
    2. Check Enable vacation responder.
    3. In Start vacation at field, select the variable icon icon. In the drop down menu, select the Current Datetime variable. This date and time is not the time when you're editing this rule, but the time when the recurring rule executes.
    4. In End vacation field, choose After option. Select the duration when OOO mode would stay active. It requires some math play here. In our demo example, for Monday to Thursday executions, the OOO mode is on at 5pm and expire in 16 hours, i.e. 9am the 2nd day. For Friday 5pm, the OOO mode expire on 2 days and 16 hours, i.e. 9am the following Monday. This is an important option.
    5. Edit Subject.
    6. Fill in the response body. This goes your canned template to the sender. Variables are supported by typing {{ in sophisticated use cases.
    7. The rest 2 checkbox options Only send a response to people in my Contacts or Only send a response to people in my domain are optional.
  11. When you edited fully the trigger and actions above, click REVIEW.
  12. Give the rule a name.
  13. Click SAVE.
  14. Back to the main Rules page, the just created rule is active like this.
    Active gmail business hours card in Foresight
  15. Now test your rule works as expected by visiting Gmail at key times the OOO mode is configured to be active or inactive. Note Gmail's First day and Last day are Date granularity accurate. Ignore them. Foresight will change your OOO status in Minute granularity.
    Gmail vacation responder sync with Foresight

Future work

Regarding Out of office sync between calendar and gmail, no API is available on Google calendar, so it's impossible. Upon Google's update on Calendar API, syncing your Working Hours from your Calendar to your Gmail would become much easier.

Takeaways

Building the correct automation for your OOO schedule seems a steep learning curve. But it isn't. Just get your hands dirty and rectify the rules overtime. If you encountered issues or needed advice for your schedule, please leave comments below.