inbox.dog with Pi
Pi is Inflection AI's conversational assistant. While Pi doesn't support MCP natively, you can build Gmail-powered workflows that work alongside Pi using the inbox.dog SDK.
How it works
Pi doesn't have a plugin or tool-use system, so the integration pattern is different from MCP-based agents. Instead, you:
- Get credentials from inbox.dog/connect
- Install the inbox.dog SDK in a Node.js project
- Build a bridge script that reads/sends Gmail and formats context for Pi via the Inflection API
1. Get your credentials
Head to inbox.dog/connect and sign in with Google. You'll get a client_id and client_secret.
Add them to your environment:
export INBOX_DOG_CLIENT_ID=your_client_id
export INBOX_DOG_CLIENT_SECRET=your_client_secret 2. Install the SDK
Create a new project and install the inbox.dog SDK:
mkdir pi-gmail-bridge && cd pi-gmail-bridge
npm init -y
npm install inbox.dog 3. Authenticate with Gmail
Use the SDK to complete the OAuth flow and get your tokens. Create auth.js:
import InboxDog from 'inbox.dog';
const client = new InboxDog({
clientId: process.env.INBOX_DOG_CLIENT_ID,
clientSecret: process.env.INBOX_DOG_CLIENT_SECRET,
});
// Start the OAuth flow — opens a browser window
const tokens = await client.authenticate();
console.log('Authenticated as:', tokens.email);
console.log('Save your access token securely.'); 4. Build the bridge
This script reads your recent emails via inbox.dog, formats them as context, and sends them to Pi via the Inflection API. Create bridge.js:
import InboxDog from 'inbox.dog';
const mail = new InboxDog({
clientId: process.env.INBOX_DOG_CLIENT_ID,
clientSecret: process.env.INBOX_DOG_CLIENT_SECRET,
accessToken: process.env.INBOX_DOG_ACCESS_TOKEN,
});
// Fetch recent emails
const emails = await mail.readEmails({ maxResults: 5 });
// Format emails as context for Pi
const emailSummary = emails
.map((e) => `From: ${e.from}
Subject: ${e.subject}
Snippet: ${e.snippet}`)
.join('\n---\n');
// Send to Pi via the Inflection API
const response = await fetch('https://api.pi.ai/v1/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${process.env.PI_API_KEY}`,
},
body: JSON.stringify({
messages: [
{
role: 'user',
content: `Here are my recent emails:\n\n${emailSummary}\n\nSummarize them and flag anything urgent.`,
},
],
}),
});
const data = await response.json();
console.log('Pi says:', data.text); node bridge.js 5. Send emails based on Pi's response
You can close the loop by having your script parse Pi's output and send replies. Create reply.js:
import InboxDog from 'inbox.dog';
const mail = new InboxDog({
clientId: process.env.INBOX_DOG_CLIENT_ID,
clientSecret: process.env.INBOX_DOG_CLIENT_SECRET,
accessToken: process.env.INBOX_DOG_ACCESS_TOKEN,
});
// After Pi drafts a reply, send it via inbox.dog
await mail.sendEmail({
to: 'colleague@example.com',
subject: 'Re: Q3 Report',
body: 'Thanks for sending this over — looks good. I'll review in detail tomorrow.',
});
console.log('Email sent.'); Example: daily email digest with Pi
Combine the above into a cron job that runs every morning:
import InboxDog from 'inbox.dog';
const mail = new InboxDog({
clientId: process.env.INBOX_DOG_CLIENT_ID,
clientSecret: process.env.INBOX_DOG_CLIENT_SECRET,
accessToken: process.env.INBOX_DOG_ACCESS_TOKEN,
});
// Search for unread emails from the last 24 hours
const unread = await mail.searchEmails({
query: 'is:unread newer_than:1d',
});
if (unread.length === 0) {
console.log('Inbox zero — nothing to summarize.');
process.exit(0);
}
const digest = unread
.map((e) => `• ${e.from}: ${e.subject}`)
.join('\n');
// Ask Pi to prioritize
const res = await fetch('https://api.pi.ai/v1/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${process.env.PI_API_KEY}`,
},
body: JSON.stringify({
messages: [
{
role: 'user',
content: `I have ${unread.length} unread emails:\n\n${digest}\n\nRank them by urgency and suggest which to reply to first.`,
},
],
}),
});
const data = await res.json();
console.log(data.text); Run with node digest.js or add to crontab: 0 8 * * * node /path/to/digest.js
Trust & security
- OAuth flow with PKCE — inbox.dog never sees your Gmail password
- CASA Tier 2 certified for restricted Gmail scopes
- Your bridge script controls exactly what context is shared with Pi
- Self-host available if you want full control
Next steps
- Handle token refresh — access tokens expire after 1 hour
- API reference — full documentation of all endpoints
- Pi by Inflection AI — Pi's official site