PedibeeHelp

Answer from a visitor's account

Let your bot read a signed-in visitor's own details, from their contact fields or your own MCP server.

When a visitor is signed in to your site, your bot can answer questions about their own account, like "when do I renew?" or "why was I charged twice?". Visitors who aren't signed in get the bot as usual, and it can't read any account for them.

There are two places the bot can read from:

SourceBest forWhat you build
Contact fieldsDetails you already send to Pedibee, like a plan or a renewal dateA token, and sending your data to Pedibee
Your MCP serverLive data, like invoices or a failed paymentA token, and an MCP server

Account data is on paid plans. Managers and the owner set it up on the Account data tab of Support bot.

Step 1: Recognise signed-in visitors

Your server tells Pedibee who is signed in by signing a short token.

  1. Make a key pair, ES256 or RS256 (RSA of at least 2048 bits). Keep the private key on your server.
  2. Paste the public key under Public key and select Save keys. You can save two, so a new key can overlap the old one.
  3. Add a route on your server that signs a token for the signed-in user:
import { SignJWT, importPKCS8 } from 'jose';

const key = await importPKCS8(process.env.PEDIBEE_PRIVATE_KEY, 'ES256');

// Only for a signed-in user. Use your own user id.
const token = await new SignJWT({ email: user.email })
  .setProtectedHeader({ alg: 'ES256' })
  .setSubject(user.id)
  .setAudience('pkb_your_bot_key') // shown on the Account data tab
  .setIssuedAt()
  .setExpirationTime('10m')
  .sign(key);
  1. Give the chat a way to get it, on every page where the visitor is signed in:
Pedibee.identify(async () => {
  const res = await fetch('/api/pedibee-token');
  return res.ok ? (await res.json()).token : null;
});

// When they sign out:
Pedibee.logout();

The chat asks for a new token when it opens and before the old one runs out.

ClaimWhat it must be
subYour own user id, up to 255 characters
audThis bot's key
iat, expWhen it was signed and when it ends, at most 15 minutes apart
emailOptional. Shown to your team in the inbox

A token that is wrong or expired never stops the chat: the visitor is treated as not signed in.

Each chat belongs to the user who signed in. It only opens with a valid token for that user, so the next person on a shared computer can't read it, and it can't be opened from an emailed link. Emails about these chats don't include Continue the chat.

Step 2: Read their contact fields

  1. Send each user's details to Pedibee with the contacts API or events, with externalId set to the same user id as sub.
  2. On the Account data tab, tick the custom fields the bot may read, and select Save fields.

The bot reads only the ticked fields of the contact whose externalId matches. It never matches on email, and it never sees a contact's stage, owner, tags, notes or history.

  • A ticked field can be shown to that visitor. Don't tick internal notes.
  • The bot can't tell how old a value is, so send changes as they happen.

Step 3: Read live data from your MCP server

Use this for what isn't in Pedibee. Your server must be on a public https address and use Streamable HTTP. Servers that only run on your own machine can't connect.

Every call carries two things:

  • Authorization: Bearer <your token>: proves the call is from Pedibee.
  • _meta["com.pedibee/identity"]: the visitor's signed token: says which user is asking. The AI model can't see or change it.

What your server must do

  1. Check the token on every call. Verify its signature with your own key, and its aud and exp. Refuse the call if it's missing or wrong.
  2. Check every record against that user. The AI model fills in the tool's arguments, so it can ask for any invoice number a visitor gives it. Your tool must only return a record that belongs to the user in the token:
const { sub } = await verifyPedibeeToken(ctx.mcpReq._meta?.['com.pedibee/identity']);
const invoice = await db.invoices.findOne({ id: args.invoiceId, userId: sub });
if (!invoice) return { isError: true, content: [{ type: 'text', text: 'Not found' }] };
  1. Have a pedibee_whoami tool. It takes no input, and returns { "sub": "<the verified user id>" } as JSON text, or an error if the token isn't valid. Pedibee only ever calls this tool to check your server.

Don't connect a general admin server, like a billing provider's own MCP server. It can read all your customers, and it has nothing to limit it to one user.

Connect it

  1. Under Read live data from your MCP server, enter the address and the bearer token.
  2. Paste a test token your server signed for a test user.
  3. Select Connect. Pedibee calls pedibee_whoami three ways and connects only if the answers are right: with the test token it must name that user; with no identity and with a forged one it must refuse.
  4. Tick the tools the bot may use. Everything starts off.

The check proves your server verifies tokens. It can't prove each tool checks each record, so that part is yours.

Tick read-only tools only. A server can label a tool read-only without it being so, so Pedibee can't check this: the label only decides whether you see a warning.

After you connect

Once a day Pedibee reads your tool list and repeats the refusals.

  • A changed tool switches off until you tick it again, and the bot keeps seeing only the version you approved. A new tool starts off.
  • If your server stops refusing, every tool stops until a check passes. Select Check now after you fix it.
  • If your server is down, the bot says it can't check right now and offers a person. It never guesses or shows your server's error.

The bot makes up to 60 calls a minute and 5,000 a day for each workspace, with 10 seconds and 8,000 characters for each.

In your inbox

Chats and tickets show Verified by your site with the user id and email, and which tools ran. They don't show what the tools returned.

Privacy

A visitor's details reach our AI provider to write the answer. The bot's answer can repeat them, and it is kept with the chat for 180 days. Cover this in your privacy policy. Tell the bot not to discuss what it shouldn't under Instructions, but don't rely on that: only give it tools and fields a visitor may see.

On this page