AgentsStudioTemplatesPricingDocs
Sign inGet Started

Give your AI agent an automation engine.

Build

  • MCP server
  • kovca CLI
  • Kovca's agent
  • Studio
  • Templates

Run

  • Apps and events
  • Decision and Generative AI
  • Workflows API
  • Run history
  • Pricing

People in the loop

  • Approvals and waits
  • Tasks
  • Coding agents
  • Docs

Company

  • About
  • Security
  • Contact
  • Privacy Policy
  • Terms of Service
© Kovca. kovca.io
GuidesOperations

Label a shared Gmail inbox by topic and urgency

Build a Kovca workflow that starts from a new Gmail message, labels it with the Support Triage category, and adds an Urgent label plus a Slack message when the priority is high.

Support Triage24 min readcURL
InputSupport TriageTopic labelAdd topicPing textUrgent?Add urgentPing channelOutput
TemplateGmail support labelsStart from a new Gmail message, label it by the Support Triage category, and add an Urgent label and a Slack message when the priority is high.
9 nodesUp to 1 evaluation per run
Use this template

A shared support@ Gmail inbox mixes billing questions, how-to questions, bug reports, account and access issues, sales enquiries, and mail that is not a support request. Someone reads each message to decide what it is and who takes it. Urgent mail waits behind the routine pile.

This guide builds a workflow that starts when a new message arrives, classifies the subject and the body, applies one topic label, and when the priority is high applies a second label and posts a line to Slack. You'll start from a template, test it, and activate it on the Gmail and Slack accounts.

The template already uses the Gmail New email trigger, Gmail Add label twice, and Slack Send message. It does not store a Gmail or Slack account. You choose the accounts when you activate. Until then the draft saves, and Studio tests simulate the Gmail and Slack steps.

Support Triage does not have a sales category or a spam category. It returns one of billing, technical, account, product, or other, plus priority (low, medium, or high) and requires_human_review. other is the bucket for something else, and the node's own wording includes shipping, partnerships, job inquiries, and spam in that list. This template labels other. It does not archive it, and it does not treat it as spam.

Two other guides start from a different problem. Turn customer bug reports from Gmail into issues files a technical message into a tracker and only labels the other categories. Escalate urgent support tickets into incidents automatically starts from a help desk webhook and opens an incident. Sort subscription cancellation requests checks a cancellation against a policy you write. This one stays in the shared inbox: a topic label on every new message the trigger accepts, and an Urgent label when the priority is high.

If the inbox only gets a few messages a day, a Gmail filter on the sender or on words in the subject, and a person who reads what is left, is less machinery than this. A filter does not read the body the way Support Triage does. The workflow is for the inbox where someone is already reading every message to decide the topic and the urgency.

What you'll build

Send real requests is off. The run returned 200 and used 5 credits. gmail_add_label, gmail_add_label_2, and slack_send_message are marked sample. category is technical, priority is high, topic_labels is Label_technical, labeled, urgent, urgent_labeled, and notified are true, and slack_ts is the sample timestamp.

StepNodeWhat it does
InputGmail: New email (gmail/new_email)Starts the workflow. The event fields are from, body_text, received_at, labels, message_id, thread_id, to, and subject.
Support TriageDecision AI (builtin:support/triage@1)Classifies the subject and the body. Returns category, priority, and requires_human_review.
Topic labelLookupMaps category to a list of one label id.
Add topicGmail Add label (action:gmail/add_label@1)Applies that list to the message. Safe to retry.
Ping textTextBuilds the Slack line on every run.
Urgent?ConditionTrue when priority is high.
Add urgentGmail Add label (action:gmail/add_label@1)On the true branch. Applies the Urgent label id. Safe to retry.
Ping channelSlack Send message (action:slack/send_message@1)On the true branch. Posts the line. Sent once.
OutputOutputThe card on the canvas says Result. Returns the classification, the topic label list, and whether the labels and the Slack message ran.

The false branch goes straight to Result. A message whose priority is not high still gets the topic label. It does not get the Urgent label, and it does not post to Slack.

Watch the test

Watch the Studio test (MP4). It is a recording of the production Studio at kovca.io, in light mode, 12 seconds. The frame is the Test panel. A caption under the picture reads: Studio test. Send real requests is off. Gmail and Slack actions are samples. Nothing in the recording is sped up. No Gmail or Slack account is connected, and Send real requests stays off. Add topic, Add urgent, and Ping channel return their samples and are marked sample. That is not a label applied in Gmail, and it is not a message posted in Slack. The result stays on screen through the end of the recording.

Studio test. Send real requests is off. Status 200. 5 credits. category technical, priority high. The three action steps are marked sample.

The recording follows these steps:

  1. The Test tab is open. The input is the checkout email: subject "Checkout is down", body "Every checkout attempt fails with a 502 since 9am. We cannot take orders.", from alex@example.com, to support@example.com. Send real requests is off. The switch's own text says action steps return their sample result and nothing is sent.
  2. Run test. The status is 200. The panel shows 5 credits used for that one Decision AI step. The run on this recording took 580 ms.
  3. The category is technical, the priority is high, and requires_human_review is false. topic_labels is Label_technical. labeled, urgent, urgent_labeled, and notified are true. slack_ts is 1762004012.004900.
  4. Add topic, Add urgent, and Ping channel succeeded and are marked sample. That output stays on screen for the last 8 seconds.

That is one live Studio test of that email. The JSON later in this guide is the template's unit test for the same input when the test sets the category to technical and the urgency to the blocked level directly. It does not read the message. On this recording the live result had the same category, the same priority, the same route, and the same sample timestamp. What Support Triage returns on another message depends on that message. The template's other example, a refund question, comes back billing and low in the unit test, and the urgent steps are skipped.

Build it in the Studio

1Start from the template

Click Use this template above, or open Gmail support labels in Workflows.

The draft opens on the canvas. The components library is on the left. Triggers, AI, Action in an app, Data transformation, Flow, Core, and Human review are the groups. This workflow uses Gmail and Slack, so both are under Triggers and under Action in an app once the draft uses them. Apps you have not connected, and that this workflow does not use, stay behind Connect another app. The pictures below are the production Studio, in light mode, with no Gmail or Slack account connected. The template's step titles are the ones in the table above. The last card on the canvas is Result.

Triggers. General, Gmail, and Slack. Gmail's line says it starts workflows from new email, and can label, archive, reply to, or send email. The line under the list points at Connect another app.

Gmail's card names Add label, Remove label, Mark as read, Archive, Reply, and Send email. Slack's card names Send message. Connect another app is under the list.

Add label, Remove label, Mark as read, Archive, Reply, and Send email are the first cards. The same description, adds and/or removes specified Gmail labels, is on the first four.

Send message is the first card. Add reaction is next to it. The list continues with search, reminders, canvases, and lists.

2The workflow starts from a new email

Select the input step. It is Gmail: New email, not an API request. The account line asks you to connect Gmail. Leave it empty while you test.

Connect Gmail is still to do. Only emails matching is to:support@example.com. In label asks you to connect Gmail to choose a label.

SettingTemplate value
Only emails matching (query)to:support@example.com
In label (label_ids)unset

to:support@example.com is a stand-in. Replace it with the search you actually want. The field's description is "Advanced Gmail search using the same syntax as Gmail's search box." A live message that does not match that search does not start a run. The Test tab and an API call send the event you provide, so they still run when the search would not have matched.

In label filters by a single label id. Until an account is connected, the field says to connect Gmail to choose a label. The template leaves it unset.

The trigger description says it fires when a new message is received in Gmail. The same message does not start two runs: the event id is message_id. A later message is a new event and runs again.

Event fields later steps read:

FieldUsed for
input.subjectSupport Triage's subject, and the Slack line
input.body_textSupport Triage's message
input.message_idBoth Add label steps
input.fromThe Slack line

The event also includes received_at, labels, thread_id, and to. labels is a list of label ids already on the message. The trigger's sample uses INBOX and UNREAD. This workflow does not read that list. from is a string, the sender as Gmail reports it. A manual run or an API call can omit fields the steps don't read.

subject on Support Triage accepts at most 200 characters. The event's subject can be up to 8,000. A longer subject fails this step. message is required, must not be empty, and accepts at most 8,000 characters, which is also the limit on body_text. An empty body fails Support Triage.

The body is what the node reads, along with the subject when you map it. Support Triage's question is about message. This template maps body_text to message and subject to subject. It does not read attachments.

3Classify the email

Select Support Triage. subject is input.subject. message is input.body_text. There is no terms field and no criteria list. The node has those two inputs.

The node returns:

  • category: billing, technical, account, product, or other.
  • priority: low, medium, or high.
  • requires_human_review: true or false.

What each category means, in the node's own wording:

CategoryThe request is mainly about
billingCharges, invoices, payments, refunds, subscriptions, or pricing.
technicalErrors, bugs, outages, crashes, slow performance, or integration problems.
accountSigning in, passwords, account access, profile details, or account settings.
productHow a feature works, how to use the product, or a feature request.
otherSomething else, such as shipping, partnerships, job inquiries, or spam.

A how-to question and a feature request both sit in product. A bug report and an outage both sit in technical. A sales enquiry is not its own category. Partnerships and job inquiries are examples of other.

priority follows how urgent the message is. low is a general question or feedback, and nothing is blocked. medium is a problem that needs to be fixed, and the customer can still use the product. high is blocked right now: the product is down, a core feature is broken, or they cannot complete their work. A message the node treats as a security problem (unauthorized access, a hijacked account, leaked data, or suspicious activity) also comes back high, even when the urgency on its own would have been lower.

requires_human_review is true when a legal threat is not clearly absent, when a security concern is not clearly absent, or when the category or the urgency is ambiguous. The category and the priority are still the most likely ones. A legal threat sets requires_human_review and does not, by itself, set priority to high. This template does not add a label for requires_human_review. Only priority high takes the urgent branch.

4Pick the topic label

Select Topic label. A lookup maps one value through a table you write. The value is nodes.support_triage.output.category.

Look up is nodes.support_triage.output.category. billing, technical, account, product, and other each map to a one-item list. The fallback is Label_other. The last test result is Label_technical.

CategoryResult
billing["Label_billing"]
technical["Label_technical"]
account["Label_account"]
product["Label_product"]
other["Label_other"]
fallback["Label_other"]

Those strings are stand-ins. They are not label ids from a mailbox. Add label's own description of the field is "Label IDs to add (IDs, not display names)." INBOX and UNREAD are ids. A label you create in Gmail has its own id. Once an account is connected, In label on the trigger lists the mailbox's labels. Replace each stand-in with an id from that list before you activate. The result is a list of one id because Add label's Label IDs field is a list.

The five categories are the only values the node returns, so the fallback is the row you get if the category is missing. A missing category does not invent a label name.

5Apply the topic label

Select Add topic. It is Gmail's Add label action. The action's description says it adds and/or removes specified Gmail labels for a message. This node's inputs are Message ID and Label IDs. It does not have a field for labels to remove.

Add label fieldValue
Message ID (message_id)input.message_id
Label IDs (add_label_ids)nodes.lookup.output.result

If it fails is Stop the run. The step is safe to retry: repeating it has no further effect, and a transient failure can be tried again within the run. If the topic label does not succeed, the run stops, and Add urgent and Ping channel do not run. Choose the Gmail account on this step before you activate. In a Studio test, with Send real requests off, the step returns its sample and is marked sample. The sample is ok: true and an empty result. That is not a label applied in your mailbox.

6Decide what is urgent

Select Urgent?. A condition continues on true when every rule matches. This one has one rule.

RuleValue
Continue on true when all rules matchnodes.support_triage.output.priority equals high
CaseWhenGoes to
truepriority is highAdd urgent
falselow, medium, or a missing priorityResult

requires_human_review is not in this rule. A message that needs a person and is not high still gets only the topic label. Add a second rule, or a second condition, if those should take the urgent branch too.

The step's id is condition. The output field urgent is that step's result: true or false.

7Add the Urgent label

Add urgent is a second Gmail Add label, on the true branch.

Connect Gmail is still to do. If it fails is Continue (output.ok is false). Message ID is input.message_id. Label IDs is the fixed list Label_urgent. The last test is marked simulated.

JSON
["Label_urgent"]
Add label fieldValue
Message ID (message_id)input.message_id
Label IDs (add_label_ids)["Label_urgent"]

Label_urgent is a stand-in, the same kind of placeholder as the topic ids. Replace it with the id of the Urgent label in the mailbox.

If it fails is Continue (output.ok is false). A failed Urgent label does not undo the topic label, and it does not stop Ping channel. The step is safe to retry, for the same reason as Add topic. In a Studio test it returns its sample, ok: true, and is marked sample.

8Post the urgent line

Ping text runs on every message, before the condition. Slack sends it only on the true branch.

The template is the priority, the category, the subject, and a From line. The placeholders are nodes.support_triage.output.priority, nodes.support_triage.output.category, input.subject, and input.from.

{{nodes.support_triage.output.priority}} {{nodes.support_triage.output.category}}: {{input.subject}}
From {{input.from}}

On the checkout email, with a high technical result, that text is high technical: Checkout is down and then From alex@example.com.

Ping channel is Slack's Send message action. It runs after Add urgent.

Connect Slack is still to do. If it fails is Continue (output.ok is false). Channel is the fixed value C08SUPPORT1. Message is nodes.text.output.text. Reply in thread and Also post to the channel are not set.

Send message fieldValue
Channel (channel)C08SUPPORT1
Message (markdown_text)nodes.text.output.text
Reply in thread (thread_ts)unset
Also post to the channel (reply_broadcast)unset

C08SUPPORT1 is a stand-in, the same channel id as Send message's sample. Replace it with the channel you want. The field accepts an id or a name.

The step's own line says it is sent once: Kovca does not retry it on its own. If it fails is Continue (output.ok is false). A failed post does not undo the labels, and it does not fail the run. notified is false when it does not succeed. In a Studio test the step returns its sample and is marked sample. The sample timestamp is 1762004012.004900. That is not a message in Slack.

markdown_text accepts at most 8,000 characters. A very long subject can push the line past that, and the step then fails. With If it fails set to continue, the run still succeeds and notified is false.

9Test it

Open the Test tab. Checkout down and Refund question are the template's examples. Sample new email is the trigger's own sample, which is an invitation, not one of these messages. Leave Send real requests off. Add topic, and on a high result Add urgent and Ping channel, return their samples and are marked sample. Nothing is written to Gmail or Slack.

What Support Triage returns depends on the message. A high result takes Add urgent and Ping channel. low and medium go to Result after the topic label, and those two steps are skipped. urgent_labeled, notified, and slack_ts come back null on the false branch.

Before you activate, run messages you have actually seen, including ones that should be high and ones that should not. When the routes look right, turn on Send real requests once, with both accounts chosen and the stand-in label ids replaced, on a message where an extra label and an extra Slack line are harmless.

Publish, call it, and activate it

The same workflow can be called over the API. The body uses the trigger's field names. Create an API key under API keys and keep it on your backend.

cURL
curl https://kovca.io/api/v1/workflows/wf_.../execute \
  -H "Authorization: Bearer $KOVCA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 18f0a1b2c3d4e5aa" \
  -d '{
    "input": {
      "from": "alex@example.com",
      "to": "support@example.com",
      "subject": "Checkout is down",
      "body_text": "Every checkout attempt fails with a 502 since 9am. We cannot take orders.",
      "message_id": "18f0a1b2c3d4e5aa",
      "thread_id": "18f0a1b2c3d4e5aa",
      "received_at": "2026-11-02T14:03:00Z",
      "labels": ["INBOX", "UNREAD"]
    }
  }'

That curl calls a published workflow. It runs Add topic for real, and on a high result it runs Add urgent and Send message for real. The steps need the Gmail account on both Add label steps and the Slack account on Ping channel. If an account is missing, the action fails. With If it fails set to stop on Add topic, the run stops and the urgent steps do not run. A published call does not return the sample you see with Send real requests off.

The JSON below is the output this template's unit test expects for the checkout email when the test sets the category to technical and the urgency to the blocked level, and it does not read the message. Add topic, Add urgent, and Send message are simulated. This is not a response from a published API call. It is the same shape as the Studio recording above. The refund example, run without that override, comes back billing and low, topic_labels is Label_billing, urgent is false, and urgent_labeled, notified, and slack_ts are null.

JSON
{
  "request_id": "req_...",
  "run_id": "run_...",
  "workflow": { "id": "wf_...", "version": 1 },
  "status": "succeeded",
  "output": {
    "category": "technical",
    "priority": "high",
    "requires_human_review": false,
    "topic_labels": ["Label_technical"],
    "labeled": true,
    "urgent": true,
    "urgent_labeled": true,
    "notified": true,
    "slack_ts": "1762004012.004900"
  },
  "steps": [
    { "id": "input", "status": "succeeded" },
    { "id": "support_triage", "status": "succeeded" },
    { "id": "lookup", "status": "succeeded" },
    { "id": "gmail_add_label", "status": "succeeded" },
    { "id": "text", "status": "succeeded" },
    { "id": "condition", "status": "succeeded" },
    { "id": "gmail_add_label_2", "status": "succeeded" },
    { "id": "slack_send_message", "status": "succeeded" },
    { "id": "output", "status": "succeeded" }
  ],
  "evaluations": 1
}

The JSON above leaves out credits. A succeeded execute response includes that field. This example is the simulated run, so the actions are not charged. credits for an API call of this shape is 6: 5 for Support Triage and 1 for the API run. The Studio test does not charge the run fee, which is why its panel shows 5.

Look up the run later. This returns status, timing, and steps. It does not return the output. Keep the execute response if you need the category or the sample timestamp. Runs are kept for 30 days.

cURL
curl https://kovca.io/api/v1/runs/run_... \
  -H "Authorization: Bearer $KOVCA_API_KEY"

18f0a1b2c3d4e5aa is a key you choose. The message id is a natural one. Keys are kept for 24 hours. A retry with the same key and the same request returns the original run instead of labeling again. A new key can label again. Add label can be repeated without a second effect. Send message cannot: a later run posts another line. Kovca does not store the message or the output.

To run it from Gmail, open Activate. The checklist is what's left: connect Gmail, connect Slack, and, once an account is connected, choose that account on the trigger, on Add topic, on Add urgent, and on Ping channel. It says up to 17 credits per event. The activate row is Publish and activate: run on every new email. The button on that row says Publish & activate. That publishes the draft and starts it. A live automation runs that pinned version. Later edits don't reach it until you publish them to the automation.

Connect Gmail and Connect Slack are still to do. Tested is checked. Up to 17 credits per event. Publish and activate: run on every new email. The button says Publish & activate.

Connect Gmail and Slack from the checklist, or from the steps, when the routes in the Test tab look right. Until then, leave the accounts empty and keep Send real requests off.

A new message that passes the trigger settings starts a run when Gmail sends the event. Follow runs on the Runs page (filter by the workflow). While an automation is paused, events that arrive are skipped. Kovca does not keep them to run later. A failed run is not retried on its own, because the Slack message may already have been posted.

If someone already reads the inbox

You don't need this if a person can read the shared inbox and the volume is small. Gmail can filter on a sender or on words in the subject, and it already has a spam folder. A filter does not read the body, and it does not apply one of these five categories.

What the workflow adds is the same classification on every new message that matches the search you set, one topic label for the category, and an Urgent label plus a Slack line only when the priority is high. You still choose the accounts, replace to:support@example.com and the stand-in label ids, and read a sample of results before you activate it.

Make it yours

  • Point the search at the real inbox. to:support@example.com is a stand-in. Use the search your mailbox actually needs. Set In label once Gmail is connected if the mail already lands under one label, and clear the search if every message in that label should run.
  • Replace the label ids. Label_billing, Label_technical, Label_account, Label_product, Label_other, and Label_urgent are not ids from a mailbox. Use the ids Gmail lists once the account is connected. The names you see in Gmail are not what Add label sends.
  • Leave medium and low mail without the Urgent label. That is already what the false branch does. requires_human_review does not take that branch on its own.
  • Do not archive other. Mark as read (action:gmail/mark_as_read@1) and Archive (action:gmail/archive@1) exist. Each takes message_id. Mark as read removes the UNREAD label. Archive removes the INBOX label. Both are safe to retry. This template does not call them. other includes shipping, partnerships, and job inquiries as well as spam, so archiving every other message would file mail that is not noise. A Gmail filter is the place for a sender or a keyword you already trust.
  • Do not file the bug from here. A technical result only gets the technical label, and the Urgent label when the priority is high. To pull steps out of the email and open a tracker issue, use Turn customer bug reports from Gmail into issues.
  • Point Slack at a real channel. C08SUPPORT1 is a stand-in. Use the channel id you want, or remove Ping channel if the Urgent label is enough.
  • Keep the subject short enough. subject on Support Triage can be at most 200 characters. A longer Gmail subject stops the run there. An empty body_text stops it too, because message is required.
  • Change it without surprising a live mailbox. Edit the draft and publish the changes to the automation. The running version stays pinned until you do.

What it costs

Credits, and only for steps that succeed. Billing is the list.

A Studio test skips the run fee. It does not skip Support Triage. That step is 5 credits when it succeeds, including a test with Send real requests off. A simulated action is not charged, and an action that fails is not charged. A skipped action is not charged. With Send real requests off, Add topic is simulated, and on a high result Add urgent and Ping channel are simulated, so they add nothing.

  • A Gmail event: 6 credits for the run.
  • A published API call: 1 credit for the run.
  • Support Triage: 5 credits when it succeeds.
  • Add topic: 2 credits when it runs for real and succeeds.
  • Add urgent: 2 credits when it runs for real and succeeds. Only the true branch is charged.
  • Ping channel: 2 credits when it runs for real and succeeds, and only on the true branch.

The condition, the lookup, and the text step use no credits. A branch that doesn't run isn't charged. The Activate panel adds every step together, including the branch that does not run on the same event, so its number is an upper bound for a live event. With this template that upper bound is 17 credits per event: the 6 credit event fee, Support Triage, Add topic, Add urgent, and Ping channel. A live event that labels and pings is those 17 when all three actions succeed. A live event that only applies the topic label is 13. A published API call is 12 when it labels and pings, and 8 when it only applies the topic label. The response's credits field is the run's total. See the workflows API, HTTP actions, and automations.

On this page

  • What you'll build
  • Watch the test
  • Build it in the Studio
  • Publish, call it, and activate it
  • If someone already reads the inbox
  • Make it yours
  • What it costs

Built on Support Triage: Classify inbound support tickets by category and priority, and flag the ones a person should review.

Keep going

Workflows API
InputLead textLead Intellig…Follow up?Search contac…New contact?Create contactOutput
Lead Intelligence24 min read

Add qualified sales emails from Outlook to HubSpot

Build a Kovca workflow that starts from a new Outlook email, classifies it, and creates a HubSpot contact only when no matching contact is found.

Read guide
InputShipment Inte…Needs action?Ticket subjectOpen support …Output
Shipment Intelligence8 min read

Catch delivery exceptions from carrier tracking events

Build a Kovca workflow that reads every carrier tracking update, spots delays, failed deliveries, address problems, and disputes, and opens a support ticket when someone needs to act. Runs from the carrier's webhook. Step by step in the Studio, with a ready-made template.

Read guide
InputSupport TriageHigh priority?Create incide…Alert textPage on-callAdd reactionJoinOutput
Support Triage14 min read

Escalate urgent Slack channel messages into incidents

Build a Kovca workflow that starts from a new Slack message, classifies it, and on high priority opens an incident, posts to on-call, and reacts on the message.

Read guide
Sign inGet Started