Skip to main content

Setup

1. Install

npm install @boostgpt/router

2. Configure

.env
WHATSAPP_CONTACTS=2349012345678,2349087654321

Usage

import { Router, WhatsAppAdapter } from '@boostgpt/router';

const router = new Router({
  apiKey: process.env.BOOSTGPT_API_KEY,
  projectId: process.env.BOOSTGPT_PROJECT_ID,
  adapters: [
    new WhatsAppAdapter({
      allowedContacts: process.env.WHATSAPP_CONTACTS.split(','),
      useLocalAuth: true
    })
  ]
});

await router.start();
// Scan QR code when prompted

Options

allowedContacts
Array<string>
Whitelist of phone numbers (with country code, no +)
useLocalAuth
boolean
default:"true"
Save session locally

QR Code

Scan the QR code with WhatsApp on your phone to authenticate.
The first time you run it, scan the QR code. Sessions are saved locally for subsequent runs.