Experimental API - Context Connectors is experimental and subject to breaking changes.
Prerequisites
- A Vercel account (or Express server)
- Augment API credentials
- AWS credentials + S3 bucket
- A GitHub repo you control
Steps
1. Create a Vercel project
npx create-next-app@latest my-webhook --typescript --app
cd my-webhook
npm install @augmentcode/context-connectors @aws-sdk/client-s3
2. Create the webhook handler
Create app/api/webhook/route.ts:
import { createVercelHandler } from "@augmentcode/context-connectors/integrations/vercel";
import { S3Store } from "@augmentcode/context-connectors/stores";
const store = new S3Store({ bucket: process.env.INDEX_BUCKET! });
export const POST = createVercelHandler({
store,
secret: process.env.GITHUB_WEBHOOK_SECRET!,
shouldIndex: (event) => event.ref === "refs/heads/main",
});
3. Set environment variables in Vercel
AUGMENT_API_TOKEN=your-token
AUGMENT_API_URL=https://your-tenant.api.augmentcode.com/
GITHUB_WEBHOOK_SECRET=your-secret
INDEX_BUCKET=my-indexes
AWS_ACCESS_KEY_ID=your-key
AWS_SECRET_ACCESS_KEY=your-secret
4. Deploy
Note the URL (e.g., https://my-webhook.vercel.app).
- Go to your repo → Settings → Webhooks → Add webhook
- Payload URL:
https://my-webhook.vercel.app/api/webhook
- Content type:
application/json
- Secret: same as
GITHUB_WEBHOOK_SECRET
- Events: Just the push event
- Click “Add webhook”
6. Test it
Push a commit to main. Check Vercel logs for:
Indexed myorg/myrepo: 142 files indexed
Done!
Your index updates automatically on every push to main.
Also Works With
| Instead of… | Try… |
|---|
| Vercel | Express: createExpressHandler() from integrations/express |
| Vercel | Any framework: createGitHubWebhookHandler() + verifyWebhookSignature() |
| Main branch only | Customize shouldIndex to match any branch pattern |
| S3 storage | FilesystemStore for local/self-hosted setups |