Skip to content

The moment it happens

Send thank-you emails from the right mailbox for each brand

New buyers get a thank-you from your Gmail or your Outlook, depending on which brand they bought from.

Runs
The moment it happens
Apps
Gmail, Outlook
AI
Not needed
Access
gmail.send; Mail.Send

Send this to your assistant

Create a ClickRuntime automation: when a sale comes in, send the buyer a thank-you email. Use my Gmail for Northwind Candles orders and my Outlook for Acme Workshop orders.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A maker runs two small brands: one on Google Workspace, the other on Microsoft 365. Customers should hear from the brand they bought from, but sending thank-yous by hand from two different mailboxes means some are forgotten and a few go from the wrong address.

Picking the right mailbox for each sale keeps every brand's emails consistent, and makes sure every customer gets their thank-you.

What you get out of it

  • Every customer hears from the right brand

    The thank-you comes from the address the customer knows, so replies reach the right inbox.

  • No forgotten emails

    Every sale gets a thank-you, from either brand, without a reminder.

  • One automation for both

    One setup covers both mailboxes, rather than two separate tools.

  • Each sale handled once

    Repeated sale notices are recognised and ignored.

How it works

What happens, step by step

  1. Your store tells ClickRuntime the moment a sale is made.

  2. It checks the sale has not been handled already.

  3. It works out which brand the sale belongs to.

  4. A thank-you email goes to the buyer from that brand's mailbox, Gmail or Outlook.

Before it runs live

  • Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
  • Connect Outlook
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Send thank-you emails from the right mailbox for each brandjust nowSucceeded
Gmail · SentThank you from Northwind Candles: "Hi Morgan, thank you for your order. We hope you love the cedar candle!"

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Gmail and Outlook steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
send_customer_thank_yous_from_whichever_mailbox.pyexample
import base64
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_event, http, credentials, state

api = lambda name, version: build(name, version, credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)

def send_gmail(to, subject, text):
    raw = base64.urlsafe_b64encode(f"To: {to}\r\nSubject: {subject}\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n{text}".encode()).decode()
    api("gmail", "v1").users().messages().send(userId="me", body={"raw": raw}).execute()

def graph(method, path, **kw):
    r = http.request(method, "https://graph.microsoft.com/v1.0" + path, headers={"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}, **kw)
    return r.raise_for_status() or (r.json() if r.content else None)

def send_mail(to, subject, text):
    graph("POST", "/me/sendMail", json={"message": {"subject": subject, "body": {"contentType": "Text", "content": text},
          "toRecipients": [{"emailAddress": {"address": a}} for a in to.split(",")]}})

@on_event
def handle(event):
    sale = event.json or {}
    if state.get(f"sale:{event.event_id}"):
        return {"duplicate": True}
    first = (sale.get("name") or "there").split()[0]
    if sale.get("store") == "northwind-candles":
        send_gmail(sale["email"], "Thank you from Northwind Candles", f"Hi {first},\n\nThank you for your order. We hope you love it!\n\nNorthwind Candles")
        mailbox = "gmail"
    else:
        send_mail(sale["email"], "Thank you from Acme Workshop", f"Hi {first},\n\nThanks for your order. Reply here with any questions.\n\nAcme Workshop")
        mailbox = "outlook"
    state.set(f"sale:{event.event_id}", mailbox)
    return {"sent_from": mailbox}

FAQ

Common questions

How does it know which brand a sale is for?
From the store or product name in the sale details. You tell it which names belong to which mailbox.
Can each brand have its own wording?
Yes. Each mailbox has its own template, with its own sign-off.
Which stores does it work with?
Any store or payment tool that can send a web request when a sale is made.
What permissions does it need?
gmail.send; Mail.Send. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run for each event the app sends.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Send thank-you emails from the right mailbox for each brand” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.