Skip to content

The moment it happens

Get a text for each sale and thank the buyer by email

Each new sale sends you a text with the amount and the buyer a thank-you email from your Gmail.

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

Send this to your assistant

Create a ClickRuntime automation: when a new sale comes in, text me the amount and product, and email the buyer a thank-you from my Gmail.

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

Independent sellers want to know about each sale quickly, to ship it or simply to see things working, and they know a personal thank-you brings customers back. Doing both by hand for every order doesn't last.

A text to your phone and a thank-you from your own email address happen together the moment the sale comes in, whatever time of day it is.

What you get out of it

  • Know about every sale

    A text arrives on your phone the moment you sell.

  • A personal thank-you

    Buyers hear from your real address, which invites replies.

  • More repeat buyers

    A prompt, friendly note makes people more likely to return.

  • Works with your shop

    Any shop or payment tool that can send a webhook can trigger it.

How it works

What happens, step by step

  1. Your shop sends each new sale to ClickRuntime.

  2. Sales already handled are ignored.

  3. You get a text with the amount and product.

  4. The buyer gets a thank-you email from your Gmail address.

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 Twilio
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Get a text for each sale and thank the buyer by emailjust nowSucceeded
SMS · Me💰 £120.00 for Ceramic dinner set from orders@acme.example

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 Twilio 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.
sale_alert_by_sms_and_thank_you_email.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from twilio.rest import Client
import base64
from clickruntime import on_event, credentials, http, state

MY_PHONE = "+447700900123"
FROM = "+15005550006"

def sms(to, body):
    return Client(credentials.secret("TWILIO_ACCOUNT_SID"), credentials.secret("TWILIO_AUTH_TOKEN")).messages.create(to=to, from_=FROM, body=body)
gmail = lambda: build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).users()

def send_email(to, subject, text):
    raw = base64.urlsafe_b64encode(f"To: {to}\r\nSubject: {subject}\r\n\r\n{text}".encode()).decode()
    gmail().messages().send(userId="me", body={"raw": raw}).execute()

@on_event
def handle(event):
    s = event.json or {}
    sid = str(s.get("id") or event.event_id)
    if state.get(f"sale:{sid}"):
        return {"skipped": "duplicate"}
    sms(MY_PHONE, f"💰 {s.get('amount')} for {s.get('product', 'an order')} from {s.get('email', 'a customer')}")
    if s.get("email"):
        send_email(s["email"], "Thank you for your order",
                   f"Hi {s.get('name', 'there')},\n\nThanks for buying {s.get('product', 'from us')}. Reply any time if you have questions.\n\nSam")
    state.set(f"sale:{sid}", True)
    return {"sale": sid}

FAQ

Common questions

Can I write the thank-you myself?
Yes. It's your text, with the buyer's name and product filled in.
Will test orders trigger it?
Only if your shop sends them. You can ignore orders marked as tests.
Is the same sale ever sent twice?
No. Each sale is remembered.
What permissions does it need?
Twilio; gmail.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 “Get a text for each sale and thank the buyer by email” from your assistant

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