Skip to content

The moment it happens

Send a certificate to everyone who passes your quiz

Anyone who scores over 80% on your quiz receives a PDF certificate with their name by email, and a copy is filed in Drive.

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

Send this to your assistant

Create a ClickRuntime automation: when my quiz form posts a result above 80%, fill my certificate template with their name, save the PDF to Drive and email it to them.

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 training company runs short online courses that end in a quiz. Learners who pass expect a certificate the same day. Until now someone opened the template, typed in the name, exported a PDF and emailed it, one learner at a time, often days later.

This automation issues the certificate the moment a passing result comes in, so learners get it while the course is still fresh and the team keeps a filed copy of every certificate they have issued.

What you get out of it

  • Learners get their certificate straight away

    A certificate that arrives minutes after passing feels like a reward, and is more likely to be shared on a profile or with an employer.

  • No more copy and paste

    Names are filled in from the quiz result, so there are no typos and no evenings spent exporting PDFs.

  • A complete record of who passed

    Every certificate is saved to Drive, which makes it easy to reissue one or confirm a learner's result later.

  • Your own design

    The certificate uses your Google Docs template, so your branding, wording and signature stay as you made them.

How it works

What happens, step by step

  1. Your quiz form sends each completed result to ClickRuntime.

  2. ClickRuntime checks the score and stops if it is 80% or below.

  3. It makes a copy of your certificate template and fills in the learner's name, the course and the date.

  4. It saves the certificate as a PDF in your Drive folder and emails it to the learner from your Gmail account.

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

What you get

RunsThe moment it happens
Send a certificate to everyone who passes your quizjust nowSucceeded
Email · Your certificateCongratulations on passing Acme Food Safety Level 2. Your certificate is attached.

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 Google Drive 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.
certificates_generated_stored_in_drive_and_emailed.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
import base64
from datetime import date
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from googleapiclient.http import MediaInMemoryUpload
from clickruntime import on_event, credentials

TEMPLATE_ID, FOLDER_ID = "your-template-doc-id", "your-certificates-folder-id"

@on_event
def handle(event):
    r = event.json or {}
    if float(r.get("score", 0)) <= 80:
        return {"passed": False}
    creds = Credentials(credentials.connection("google", "work"))
    drive = build("drive", "v3", credentials=creds, cache_discovery=False)
    copy = drive.files().copy(fileId=TEMPLATE_ID, body={"name": f"tmp {r['name']}"}).execute()
    swaps = {"{{name}}": r["name"], "{{course}}": r.get("course", ""), "{{date}}": date.today().strftime("%d %B %Y")}
    build("docs", "v1", credentials=creds, cache_discovery=False).documents().batchUpdate(documentId=copy["id"], body={"requests": [
        {"replaceAllText": {"containsText": {"text": k}, "replaceText": v}} for k, v in swaps.items()]}).execute()
    pdf = drive.files().export(fileId=copy["id"], mimeType="application/pdf").execute()
    drive.files().delete(fileId=copy["id"]).execute()
    drive.files().create(body={"name": f"Certificate - {r['name']}.pdf", "parents": [FOLDER_ID]},
                         media_body=MediaInMemoryUpload(pdf, "application/pdf")).execute()
    msg = MIMEMultipart()
    msg["to"], msg["subject"] = r["email"], "Your certificate"
    msg.attach(MIMEApplication(pdf, Name="certificate.pdf"))
    build("gmail", "v1", credentials=creds, cache_discovery=False).users().messages().send(
        userId="me", body={"raw": base64.urlsafe_b64encode(msg.as_bytes()).decode()}).execute()
    return {"issued": r["email"]}

FAQ

Common questions

How do I set up the template?
Create a Google Doc with placeholders such as {{name}}, {{course}} and {{date}}. Each one is replaced with the learner's details before the PDF is made.
Can I change the pass mark?
Yes. 80% is the default, and you can set a different mark per course if your quizzes differ.
What happens to learners who do not pass?
Nothing is sent to them by this automation. Some people add a separate email inviting them to try again.
What permissions does it need?
Drive write; Gmail 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 “Send a certificate to everyone who passes your quiz” from your assistant

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