Pular para o conteúdo
← Back to Skalablog

Published article

How do you give a Grok its own email inbox?

Software EngineeringGrok

Grok email setup means giving an agent its own mailbox, then firing a webhook each time a message arrives. In the setup shown in this video, a Grok routine called Nat labels the owner's real inbox twice a day, while a second Grok called Stephanie answers mail on an AgentMail address that no human reads.

The video, "Grok Manages My Inbox (and has its own)", splits the work into two independent builds on purpose. Labelling is a scheduled job over mail a human already receives; wake-on-email is an event-driven job over mail the agent owns. Keeping them in separate routines means a failure in one does not take out the other.

Grok email setup: what the video actually builds

Grok email setup means giving an agent its own mailbox and firing a webhook into a Grok routine whenever that mailbox receives a message. The video splits the work into two independent builds: an inbox manager that labels a human's real mail, and a second agent that answers mail sent to its own AgentMail address.

The first build is a Grok routine called Nat. It runs twice a day, at 6:45 a.m. and 6:45 p.m., and sorts messages into primary, notifications, outreach, urgent, and newsletters. The four original categories were primary, notifications, outreach, and urgent; newsletters was added after Grok pointed out how much newsletter mail the inbox received.

The second build gives a Grok agent a real address through AgentMail, then connects that address back to the agent with a webhook. Stephanie, the demo agent, only woke when a message arrived, and only for one inbox.

The two builds solve different problems. Labelling is a scheduled task over mail a human already receives. Wake-on-email is an event-driven task over mail the agent owns. Mixing them in one routine makes the second one harder to debug, so the video keeps them apart.

Grok is xAI's assistant, available in X and as a standalone app, and its routines feature carries both builds. The video shows a desktop app update partway through, and the webhook settings that were hidden before the update appeared afterward. The video's author is Dev Doido; if you want the Portuguese-language twin of this walkthrough, it is on the Dev Doido do canal do youtube channel.

Grok agent inbox automation with routine scheduling

Grok agent inbox automation works best when one routine handles classification and notification, with no drafting or replying. Nat's prompt set four labels, told Grok to mark primary and urgent mail as important, and asked for a ClickUp direct message after each run so the owner gets a phone notification.

The labelling agent does not write replies. In the video that constraint is explicit: it labels, it marks important mail, and it reports. If you want drafted responses, that belongs in a separate routine so a labelling failure does not also break your reply workflow.

Account connection happens through the Grok marketplace, where Gmail, Outlook, and comparable providers are added as accounts. Multiple inboxes can be connected at once, and the video recommends giving each one a distinct label so agents do not confuse them later.

Each connected account can be assigned its own agent. That matters when you manage more than one mailbox, because a single labelling agent working across two accounts has no natural way to tell the owner which inbox a flagged message came from.

The demo's own ClickUp DM carries a small footer label reading "sent by Nat", so the notification identifies which routine produced it. That is a five-second addition to the prompt and it saves you guessing later when three routines are sending you messages.

The whole labelling build takes 5 to 10 minutes according to the video, because the prompt does almost all the work. There is no code, no endpoint, and no header: you create a bot, describe the categories, connect an account, and set the schedule.

Routing rules: the decision you make before touching settings

Routing rules are the classification decisions you make before any account is connected, and they determine everything downstream. The video's rule set assigns an email to exactly one of five labels based on who sent it and what it asks for.

LabelWhat belongs there, per the videoMarked important
PrimaryLive conversations the owner is actively having with peopleYes
UrgentBills, invoices, anything with a deadlineYes
NotificationsMail from banks and services the owner signed up forNo
OutreachSponsorship pitches and cold ideas from strangersNo
NewslettersBulk subscription mail the agent asked to add itselfNo

The two labels that matter most are primary and urgent, and those are the ones the video asks Grok to flag red immediately. Everything else is filed and forgotten until review.

Get the routing rules written down before you touch any settings. Every later step (which account you connect, whether you need a filter, how you read the ClickUp digest) is downstream of this list. Changing categories after the routine has been running for a week means re-labelling a week of mail by hand.

How to set up Grok email with AgentMail

Grok email setup uses AgentMail as the mailbox provider and a Grok webhook routine as the wake-up trigger, and the whole chain is four steps:

  1. Create a mailbox in AgentMail. The video creates an inbox named YouTube test on the default agentmail.to domain, after the first name it tried was already taken. A custom domain can be connected instead.
  2. Connect AgentMail in the Grok marketplace. AgentMail is listed there as a native connector, so no custom integration is needed; you authorize the connection and pick the account you want the agent to use.
  3. Create the agent and tell it that its job is to respond to email arriving at that address through the connected AgentMail credential.
  4. Create a webhook routine in Grok. The routine's trigger is "when a webhook fires," and the endpoint details appear in the routine after the desktop app has been updated.

The order matters. Creating the webhook routine before the AgentMail connection exists leaves you with nothing to point the endpoint at, and the connector is what gives the agent permission to act on the mailbox.

One detail worth knowing before you start: the agent credential is separate from the webhook authorization. Connecting AgentMail in the marketplace grants the agent permission to read and send mail. The webhook header is a second, unrelated credential that grants AgentMail permission to wake the routine. Both have to be in place, and either one alone will fail silently.

Wiring the webhook endpoint and authorization header

Wiring the endpoint means pasting Grok's webhook URL into AgentMail and adding an authorization header so AgentMail is allowed to trigger the routine. Without both pieces, the endpoint either does not exist or gets rejected.

In AgentMail, open webhooks and add an endpoint. Paste the URL copied from the Grok routine, give the endpoint a description, then subscribe it to the events that should trigger the agent. The video selects messages so that any received message wakes the agent, and notes that the event catalog offers finer granularity if you want it.

The header is then added under advanced, in custom headers. The name is authorization and the value is the word bearer, one space, then the key copied from Grok. The video types the header name by hand rather than copying it, to avoid picking up a stray character.

Both the endpoint URL and the key are credentials. Anyone holding the pair can trigger the routine, so treat them the way you would treat any API key and keep them out of screenshots and shared documents. The video explicitly deletes the demo keys after recording for exactly this reason.

Filtering one inbox to one agent

Filtering matters once you run more than one agent, because AgentMail's webhooks do not ask which inbox should trigger which endpoint. With two inboxes and two endpoints, both agents receive events from both mailboxes until you add a filter.

The video's workaround is a payload filter inside the webhook. Opened under advanced, the transformation editor accepts a small JavaScript block that checks the inbox identifier and lets the event through only when it matches. In the demo the filter restricts the endpoint to the YouTube test inbox, and the separate trading agent ignores the test message entirely.

An alternative is to filter inside the Grok routine: tell the agent to respond only to mail arriving at one address. The video uses that as a fallback and calls it less clean, since the agent wakes for mail it will discard.

The video asks AgentMail for a simpler inbox selector in the user interface. As of the recording, the mapping is configured through the endpoint's transformation code rather than a dropdown, which is why the author had to write JavaScript for a job that looks like a settings toggle.

What the test run showed, and what it did not

The test run sent one email asking for confirmation and a favourite joke, then watched Grok and AgentMail for activity. Both signs appeared: the routine showed work in progress, and the agent replied in the same thread.

The reply arrived in the AgentMail inbox, confirming that the webhook path worked and that the inbox filter held. The trading agent did not react, which was the intended result of the per-inbox filter.

One interesting side effect: because the routine prompt never answered the original question, Grok proactively updated its own routine to only touch emails from that address. The agent, in other words, tightened its own scope after the first run.

Two limits are worth stating plainly. The filter is a payload transformation, so a change to AgentMail's payload shape can break it, and the demo does not test what happens when a message arrives that the agent cannot answer.

The demo also does not cover error handling. There is no retry policy, no dead-letter path, and no alert if the routine fails, so the owner's only signal that something broke is the absence of a reply.

Cost, limits, and credential hygiene

Cost and limits are the parts most likely to have changed since the recording, and the video's plan numbers are a snapshot rather than a current figure. Check current pricing yourself before you design around it.

In the demo, AgentMail's free plan showed two remaining inboxes, which is why only one test mailbox was created. The dashboard also reported counts of messages sent and received, so you can track volume without leaving the provider.

Credential hygiene is not optional here. The endpoint URL and authorization key together grant the ability to wake the routine and make the agent act, so they belong in a password manager rather than a text file.

A rotating key is the safer design. Where the provider supports it, rotate on a schedule and update the header value in AgentMail at the same time, so a leaked pair has a short useful life.

A practical test: if you can trigger the routine from a terminal with curl and the pair of values, you have confirmed the setup is live, and you have also confirmed how much damage a leak would do. Treat the second realisation as the more important one. One dated example: as of 2025, both the video and its Portuguese companion piece were still describing AgentMail's inbox cap as a live constraint, so re-check the number before you plan a multi-agent rollout in 2026 and beyond.

FAQ

What is a Grok email address?

It is a mailbox, in this setup one created through AgentMail, that belongs to an agent rather than a person. The agent wakes when mail arrives at that address instead of running on a schedule, and can reply in the same thread.

Does a Grok need its own email account to answer messages?

For the workflow shown in the video, yes. The agent needs an address it owns and a webhook that fires on incoming mail, because a routine triggered only by a timer has no signal that something new arrived.

How do you stop one agent from reading another agent's inbox?

Add a filter in the webhook's transformation code that checks the inbox identifier, or tell the routine to ignore mail arriving at other addresses. The code filter is cleaner because the agent never wakes for mail it will discard.

Is the AgentMail and Grok webhook connection secure?

The connection itself relies on an endpoint URL and an authorization header, so security depends on keeping both private and rotating the key. Anyone with the pair can trigger the routine, and the video's own demo keys were deleted after recording.

What happens if many emails arrive at once?

The video does not address burst behaviour, rate limits, or queuing, so treat high-volume sending as untested. Test with a controlled batch in your own environment before relying on the routine for time-sensitive mail.

Can two agents share one inbox?

Nothing in the setup prevents it, but the video does not test it. If you do this, expect both routines to fire on the same message and to race on the reply, which is exactly the problem the per-inbox filter was designed to avoid.

Do I have to use AgentMail?

No. AgentMail is the provider the video uses, and it happens to be a Grok marketplace connector, which is why setup is four steps instead of a custom build. Any mailbox provider that can fire a webhook with a custom authorization header could be wired up the same way.

Is the trading bot shown in the video the same as the inbox agent?

No, and that is the point. The trading agent and the inbox agent are two separate routines with two separate endpoints, which is why testing one does not accidentally trigger the other. Keeping them separate is what made the demo's filter test meaningful.

Where do you find the webhook URL and key inside Grok?

Inside the routine, under the "when a webhook fires" trigger. On older desktop builds this panel was hidden or blank; the video had to wait a day for a desktop update before the values appeared. If you cannot find them, check for a pending update first.

Where to take this next

The setup in this video ends with two working pieces: a labelling agent that keeps a human inbox tidy on a schedule, and a reply agent that owns an address and wakes on incoming mail. The interesting part is the second one, because it turns an email address into an interface other software can talk to.

Other agents can then reach your Grok agent by sending mail, which is why the video points to cross-agent messaging as the reason to give a bot a mailbox at all. Agents inside the same account can already talk to each other directly, so the address is the bridge to systems outside that boundary. In the video's own example, a research agent sends a trade instruction by email to a Grok called trader, which wakes on that message and places or sells the position.

If you build on this, start with the filter and the credentials, since those are the two places where a mistake is hardest to notice. The labelling half is forgiving. The wake-on-email half is not.

For the Portuguese-speaking audience, a related walkthrough of the same world of automation experiments appears at crazystack.com.br, and the Brazilian channel Dev Doido do canal do youtube covers comparable build-and-break sessions.

From an inbox routine to a written guide

What makes this walkthrough usable is the part that is easy to skip on video: the header value typed by hand, the filter added only after a second agent appeared, the bug that needed a desktop update. Those details are what the original build captured, and they are what a written version preserves for readers who arrive months later.

If you have similar knowledge sitting in a YouTube video, Skala Blog turns that recording into a structured article by transcribing the video and generating a draft you can edit before publishing. Paste a YouTube URL, let it transcribe the video, and edit the draft it generates before you publish.

Source video

Build your own inbox agent with Skalablog

Giving an agent its own inbox is mostly a matter of remembering small details: type the header by hand, add the filter after the second agent, subscribe only to the messages event. Those details are the whole difference between a routine that works and one that silently waits.

The same is true of the knowledge in your own videos. If you have a build, a walkthrough, or an argument that already exists on YouTube, you can turn that recording into an article: paste the URL into Skala Blog, let it transcribe the video, and edit the draft it produces into your own voice.