HTTP API for WhatsApp messages. Built on whatsapp-web.js.
npm install @tictic/sdk
import TicTic from '@tictic/sdk';
await TicTic.requestCode('5511999887766');
const apiKey = await TicTic.verifyCode('5511999887766', '123456');
const tictic = new TicTic(apiKey);
await tictic.connect(); // Shows QR code
await tictic.sendText('5511999887766', 'Hello!');
import TicTic from '@tictic/sdk';
async function main() {
const tictic = new TicTic(); // Uses TICTIC_API_KEY from env
// Connect if needed
if (!(await tictic.isReady())) {
await tictic.connect();
}
// Send message
const result = await tictic.sendText('5511999887766', 'Hello! ✓✓');
console.log('Message sent:', result);
}
main().catch(console.error);
// Request verification code
await TicTic.requestCode(phone);
// Verify code and get API key
const apiKey = await TicTic.verifyCode(phone, code);
const tictic = new TicTic(apiKey?); // Uses TICTIC_API_KEY if not provided
// Check if connected
const ready = await tictic.isReady();
// Get detailed status (for debugging)
const status = await tictic.getStatus();
// Returns: { ready: boolean, status: string, phone?: string, next_step?: string }
// Connect to WhatsApp
await tictic.connect();
// Send text message
const result = await tictic.sendText(to, text);
// Check usage
const { used, limit, remaining } = await tictic.getUsage();
TICTIC_API_KEY=tk_xxxxx # Your API key
TICTIC_API_URL=https://... # API URL (optional)
try {
await tictic.sendText('5511999887766', 'Hello!');
} catch (error) {
if (error.name === 'TicTicError') {
console.error(`Error ${error.code}: ${error.message}`);
if (error.help) {
console.error(`Help: ${error.help}`);
}
}
}
Use the interactive setup script:
node examples/signup.js
Process:
- Request your phone number
- Send code via WhatsApp
- Generate your API key
- Show how to use it
- Node.js 18+
- Terminal with Unicode support
- WhatsApp account
- Built on whatsapp-web.js (unofficial)
- Requires active WhatsApp Web session
- Use at your own risk
This project uses Conventional Commits:
git commit -m "feat: add new feature"
git commit -m "fix: resolve bug"
git commit -m "docs: update readme"
Automated via GitHub Actions when pushed to main
.
MIT - see LICENSE.
SDK para mensagens WhatsApp via HTTP API. Baseado em whatsapp-web.js.
npm install @tictic/sdk
import TicTic from '@tictic/sdk';
await TicTic.requestCode('5511999887766');
const apiKey = await TicTic.verifyCode('5511999887766', '123456');
const tictic = new TicTic(apiKey);
await tictic.connect(); // Exibe QR code
await tictic.sendText('5511999887766', 'Olá!');
import TicTic from '@tictic/sdk';
async function main() {
const tictic = new TicTic(); // Usa TICTIC_API_KEY do env
// Conectar se necessário
if (!(await tictic.isReady())) {
await tictic.connect();
}
// Enviar mensagem
const result = await tictic.sendText('5511999887766', 'Olá! ✓✓');
console.log('Mensagem enviada:', result);
}
main().catch(console.error);
// Solicitar código de verificação
await TicTic.requestCode(telefone);
// Verificar código e obter chave de API
const apiKey = await TicTic.verifyCode(telefone, codigo);
const tictic = new TicTic(apiKey?); // Usa TICTIC_API_KEY se não fornecido
// Verificar se conectado
const ready = await tictic.isReady();
// Obter status detalhado (para debug)
const status = await tictic.getStatus();
// Retorna: { ready: boolean, status: string, phone?: string, next_step?: string }
// Conectar ao WhatsApp
await tictic.connect();
// Enviar mensagem de texto
const result = await tictic.sendText(para, texto);
// Verificar uso
const { used, limit, remaining } = await tictic.getUsage();
TICTIC_API_KEY=tk_xxxxx # Sua chave de API
TICTIC_API_URL=https://... # URL da API (opcional)
try {
await tictic.sendText('5511999887766', 'Olá!');
} catch (error) {
if (error.name === 'TicTicError') {
console.error(`Erro ${error.code}: ${error.message}`);
if (error.help) {
console.error(`Ajuda: ${error.help}`);
}
}
}
Use o script interativo para começar:
node examples/signup.js
Processo:
- Solicita seu número de telefone
- Envia código via WhatsApp
- Gera sua chave de API
- Mostra como usar
- Node.js 18+
- Terminal com suporte Unicode
- Conta WhatsApp
- Baseado em whatsapp-web.js (não oficial)
- Requer sessão ativa do WhatsApp Web
- Use por sua conta e risco