Botmotive

Connect Vercel to Botmotive

This page helps you send your Vercel request logs to Botmotive with the Botmotive integration, and enforce fixes with the Node guard.

The integration adds a log drain to your Vercel team. The drain sends request logs from the projects you pick, or all of them, to one Botmotive site. A drain only sends logs. To enforce fixes, add the Node guard to your app as well. The integration can set the guard's environment variables for you.

What you need first

  • A Botmotive account. See Getting started. You can create the site during the install.
  • A Vercel Pro or Enterprise team. Log drains don't work on the Hobby plan. Vercel bills drain data at its usual rate.
  • For the guard: your site ID and ingest token, which starts with bm_.

A new site starts with no token. The drain doesn't use one, but the guard does. Its install page makes one for you: open your site, choose Vercel (or click Connection steps in Settings), and click Make a token. The token is shown only once, and Botmotive keeps only a hash of it. You can also make one in Settings:

  1. Open your site in the dashboard and click Settings.
  2. Under Tokens, click New token. Name it after what will use it, such as Vercel, and click Make token.
  3. Click Copy and store the token somewhere safe.

Other tokens keep working. If an old token may have leaked, click Revoke next to it.

Install the integration

  1. Open the Botmotive integration on Vercel and install it on your team.

    If your site's Vercel install page has an Install on Vercel button, you can start there instead. Botmotive then ties the install to your sign-in, and refuses it if it comes back in someone else's session.

  2. Vercel sends you to the Botmotive Connect Vercel page. Sign in if asked. Nothing is linked yet.

  3. Check what the page shows:

    • Vercel team: the team's name, its slug and its ID (team_...), or Personal account.
    • Installed by: the email (and username) of the Vercel user who installed.

    If either isn't yours, stop and close the page. A link someone else sent you would send their logs into your site, and the guard option would put a token for your site into their projects.

    If the installer's email isn't the one you sign in to Botmotive with, or Vercel didn't say who installed, the page warns you. To go on, you must tick I trust this Vercel team and want to link it.

  4. Click Yes, link this Vercel account. You have 10 minutes from when the page opens to do this.

  5. Under Site, pick the Botmotive site for these logs. Or pick New site… and type a Name.

  6. Under Projects to send logs from, tick the projects for this site. Tick none to send every project, including ones you add later.

  7. If the page says This Vercel account already sends logs to Botmotive, another site already gets logs from some of these projects. Pick other projects, or tick Connect anyway if you want the logs in both sites.

  8. To enforce fixes, tick Also set up the guard on these projects. Then tick the box that names the projects and the Vercel team the token is written to, after checking they're yours. See Add the guard to enforce fixes.

  9. Click Connect. Botmotive creates a drain called Botmotive on your team. You return to Vercel, or to your site's dashboard.

  10. In Botmotive, open Settings. Fill in Domain under Your site's address, then click Save. Botmotive then reads your robots.txt and sitemap once a day.

You have 30 minutes from clicking Yes, link this Vercel account to click Connect. After that, start the install again from Vercel.

Add the guard to enforce fixes

If you ticked Also set up the guard on these projects, Botmotive already set BOTMOTIVE_SITE and BOTMOTIVE_TOKEN on those projects, for production and preview. The token can only fetch rules. Skip to step 3.

If Vercel wouldn't take the variables on a project, the page names it. Set them there by hand.

  1. Make a token for the site, as described above, if you don't have one.
  2. In your Vercel project, add the environment variables BOTMOTIVE_SITE and BOTMOTIVE_TOKEN.
  3. Install @botmotive/guard and add it to proxy.ts or middleware.ts. Follow Next.js and Node.
  4. Redeploy. Variables only reach new deployments.

Settings that matter

One site per drain. The drain covers the projects you ticked, or every project on the team. All their traffic lands in the one site you picked. To split projects between sites, connect each site with its own projects.

Client IP. The drain sends the client IP that Vercel logged, so it needs no setting. The guard reads x-real-ip by default. Vercel sends it on every request, set to the visitor's public address. See Vercel's request headers.

Several instances. The guard keeps throttle counters in memory per instance. Vercel runs many instances, so each enforces its own share of a throttle limit. Blocks and allow rules work the same everywhere.

Fewer signals. Vercel logs carry no request headers. Botmotive labels Vercel traffic with fewer signals than a full access log. It also can't verify agents that sign their requests (Web Bot Auth).

robots.txt and /license.xml. The guard can add your AI bot rules to app/robots.ts and answer /license.xml. See Next.js and Node.

Check it worked

  1. In Vercel, open your team's Settings and select Drains. There should be a drain called Botmotive.

  2. Open your site in the Botmotive dashboard and click the 15m tab.

    Once requests arrive, the dashboard says Receiving data with a count of requests so far. Results follow 15 to 30 minutes after the first request, and the dashboard opens on the tab that has them.

  3. If you added the guard, check it as described in Next.js and Node.

Updating and removing

  • Connecting again. Each time you click Connect, Botmotive makes a new drain. Connecting the same site again replaces that site's old drain. Connecting a different site leaves the first site's drain running. If both cover the same project, its logs go to both sites, so the page warns you first.

    The Connect Vercel page only opens from a fresh install, because it needs the one-time code Vercel sends then. To connect again later, uninstall the Botmotive integration in Vercel and install it again.

  • Removing. Uninstall the Botmotive integration in Vercel. Vercel then removes everything the integration made, including its log drains and the variables it set in your projects (Vercel's API reference). Botmotive forgets the install and revokes the guard tokens it set.

    To disconnect one site only, open the site, choose Vercel (or click Connection steps in Settings), and click Disconnect Vercel. Only owners see the button. Botmotive deletes the drain and revokes the guard token it set. The variables stay in your Vercel projects but no longer work, so remove them or replace the token.

  • Removing the guard. See Next.js and Node.

If something goes wrong

  • "Vercel would not create the log drain (drains need a Pro or Enterprise team)". Upgrade the team, or install on a Pro or Enterprise team.
  • "This Vercel install has expired; start it again from Vercel." More than 10 minutes passed before you confirmed, or 30 minutes after. Start the install again.
  • "Confirm this Vercel install is yours first". Reload the page and click Yes, link this Vercel account.
  • "This Vercel install was not started from your Botmotive account". The install was started from Botmotive in a different sign-in, or the link is older than 30 minutes or was already used. Start the install again while signed in to the account you want to link.
  • The page says the install wasn't made by you. The Vercel user who installed has a different email from your Botmotive account, or Vercel didn't say. That's expected if a teammate installed it or you use different emails. Otherwise, stop.
  • The page says "This page is opened by Vercel". You opened the page directly. Start the install from Vercel.
  • The page names a team ID instead of a name. Botmotive couldn't look up the team name. Check the ID is your team's (in Vercel, Settings > General > Team ID) before you continue.

For more, see Troubleshooting.

All guides