Blog
guide

How to Connect PostHog to Grok Bot Using Sequel

Musthaq Ahamad
Musthaq Ahamad
How to Connect PostHog to Grok Bot Using Sequel

PostHog answers product questions well once you know which insight to open. Grok Bot is xAI's bot builder, an agent that keeps context and reaches your tools through plugins. Connect PostHog through Sequel and the bot writes the HogQL itself, using the event and property names you actually track.

TL;DR

What you're connectingA PostHog project to Grok Bot
Setup timeAbout 6 minutes
Setup methodOne chat message. Grok Bot has no MCP config file
Auth to PostHogPersonal API key with read-only scopes
Auth to the botOAuth to Sequel. No key in the chat
Query languageHogQL, written by the agent
Works withUS Cloud, EU Cloud, and self-hosted

What You'll Accomplish

Once this is wired up, you can ask your bot:

  • "What's the signup to activation funnel conversion for users created in the last 30 days?"
  • "Show 7-day retention for the Power Users cohort, by signup week."
  • "Which pages had the most unique viewers yesterday, by country?"

Prerequisites

  • A Sequel account: sign up free at sequel.sh
  • A PostHog account, Cloud or self-hosted
  • A personal API key with query:read, event_definitions:read, property_definitions:read, insight:read, cohort:read, project:read
  • Your host and numeric project ID
  • A Grok account with a bot you can send messages to

Step 1: Connect PostHog to Sequel

In PostHog, go to Settings → Personal API Keys → Create personal API key and grant the six read scopes above. Copy the key, PostHog shows it once.

Then sign in to sequel.sh, open Data Sources, click New Connection, and choose PostHog.

Choose a connector

FieldWhat to enter
API keyThe personal API key you just created
Hosthttps://us.posthog.com, https://eu.posthog.com, or your self-hosted base URL with no trailing slash
Project IDThe number from app.posthog.com/project/<id>

Sequel verifies the credentials against your project and confirms it by name.

What you get, all read-only:

ToolWhat it returns
HogQL queriesArbitrary SQL over events, persons, sessions, groups, cohort_people
Event definitionsEvent names with first and last seen, plus 30-day volume
Property definitionsEvent and person properties with type information
InsightsSaved trends, funnels, and retention insights
CohortsSaved segments, referenceable from HogQL

Step 2: Add Sequel to Grok Bot

Grok Bot has no MCP config file and no settings form to fill in. You add a server by asking the bot.

Open a chat with your bot and send this:

Add a custom MCP server called sequel at https://api.sequel.sh/mcp

Say custom server explicitly. Leave those words out and the bot searches the plugin marketplace instead of registering your endpoint.

Sequel's Grok Bot install card

The bot reads the name and URL back to you. Check both, confirm, and it posts a connect card in the chat. Click Authorize, sign in to Sequel, and approve access. The OAuth token stays on the connector side, so there is no API key to copy and nothing to keep in sync.

To confirm it registered, open Settings → Plugins → Yours. Every server on your account is listed there, including the ones you added by chat.

Grok's plugins panel

Then attach it to a task: type @ in the chat and pick sequel.

Using Grok chat rather than a bot? The steps do not carry over. On grok.com, open Plugins → New Connector → Custom, set the name to Sequel and the Server URL to https://api.sequel.sh/mcp, click Add Connector, and sign in.

Grok custom connector form

Step 3: Ask Grok Bot About Your PostHog Data

Attach @sequel and ask:

What's the signup to activation funnel conversion for users created in the last 30 days?
Show 7-day retention for the Power Users cohort, broken out by signup week.
How many unique users triggered $pageview yesterday, by country?

What You Can Do Now

  • Funnels without the builder: describe the steps in a sentence and get the conversion table back.
  • Scheduled product digests: the bot runs unattended, so weekly activation numbers arrive on their own.
  • Cohort questions: "How do users in the Power Users cohort differ on feature adoption?" in one message.
  • Event hygiene: "Which events have not fired in 30 days?" catches broken tracking.
  • Cross-source joins: with Postgres connected, compare in-product behaviour with plan and billing state.

Troubleshooting

SymptomLikely fix
The bot searched the marketplace instead of adding the serverResend the message with the words "custom server" in it.
The server is not listed under Settings → Plugins → YoursThe registration did not complete. Resend the message and confirm the name and URL when the bot reads them back.
The bot answers without touching your dataYou did not attach it. Type @ in the chat and pick sequel before asking.
Invalid or unauthorized keyRecreate the personal API key with all six read scopes and paste it again.
Wrong project or a connection failureConfirm the host matches your region, and that the project ID is the number from the PostHog URL.
Queries return nothingCheck that data exists in the date range, and confirm the event name with a "list events" question first.

Related Guides

Try Sequel

Build your company brain.

Sequel connects the systems your company runs on and learns how your team defines every metric, so any AI agent can answer from it. Free for up to 3 seats, no credit card required.

Get started free

Frequently asked questions

How do I add Sequel to Grok Bot?

Ask the bot. Send "add a custom MCP server called sequel at https://api.sequel.sh/mcp", confirm the name and URL it reads back, then click Authorize on the connect card and sign in to Sequel. Say "custom server" explicitly so the bot adds the endpoint instead of searching the plugin marketplace.

Do I need a Sequel API key for Grok Bot?

No. Sequel is a remote MCP server with OAuth. The bot posts a connect card, you authorize in the browser, and the token stays on the connector side. There is no key to paste into a chat.

Is this the same as Grok chat or Grok Build?

No, and the steps do not carry over. Grok chat on grok.com adds servers under Plugins, New Connector, Custom. Grok Build is the terminal coding agent and uses grok mcp add. Grok Bot is the bot builder, where you add servers by asking the bot.

Which PostHog API scopes does Sequel need?

Read-only ones, namely query:read, event_definitions:read, property_definitions:read, insight:read, cohort:read, and project:read. Granting only these means Sequel cannot change insights, dashboards, cohorts, or feature flags even in principle.

Does this work with self-hosted PostHog?

Yes. Set the host field to your own base URL with no trailing slash, instead of us.posthog.com or eu.posthog.com.

Where do I find my PostHog project ID?

In the URL. It is the number in app.posthog.com/project/<id>.

Does the bot write HogQL?

Yes. Sequel exposes PostHog's query API, and the bot composes HogQL against events, persons, sessions, groups, and cohort_people using your real event and property names.

Can I revoke access later?

Yes. Rotate or delete the personal API key in PostHog settings at any time, and the connection stops working immediately.

Written by

Musthaq Ahamad
Musthaq Ahamad

Co-founder and CEO of Sequel. Previously built developer tools and data infrastructure. Passionate about making data accessible for everyone.