imaker-synq
v1.0.0
Published
Official Node.js & TypeScript SDK for iMaker Synq WhatsApp Marketing & API Platform
Downloads
332
Maintainers
Readme
iMaker Synq Node.js SDK
Official Node.js & TypeScript SDK for the iMaker Synq WhatsApp Marketing Platform. Easily integrate WhatsApp messaging, template broadcasts, contact management, and chat conversations into your Node.js or TypeScript applications.
📦 Installation
npm install imaker-synq
# or
yarn add imaker-synq
# or
pnpm add imaker-synq🚀 Quick Start
1. Initialize the Client
import { Synq } from 'imaker-synq';
// Or CommonJS: const { Synq } = require('imaker-synq');
const client = new Synq({
apiKey: process.env.SYNQ_API_KEY!, // From iMaker Synq Dashboard -> Settings -> API Keys
clientId: process.env.SYNQ_CLIENT_ID, // (Optional) Default client ID
baseUrl: 'https://api.whatsify.in', // (Optional) Custom API endpoint
});💬 Messaging
Send a Text Message
try {
const response = await client.messages.sendText({
to: '+1234567890', // Recipient phone with country code
message: 'Hello from iMaker Synq SDK!',
previewUrl: true, // Enable link previews (optional)
});
console.log('Message sent successfully:', response);
} catch (error) {
console.error('Failed to send text message:', error);
}Send Media (Image, Video, Audio, or Document)
const response = await client.messages.sendMedia({
to: '+1234567890',
mediaType: 'image', // 'image' | 'video' | 'audio' | 'document'
mediaUrl: 'https://example.com/assets/receipt.pdf',
caption: 'Here is your receipt', // Optional
filename: 'receipt.pdf', // Optional for documents
});Send an Approved Template Message
const response = await client.messages.sendTemplate({
to: '+1234567890',
templateName: 'order_confirmation',
language: { code: 'en_US' },
components: [
{
type: 'body',
parameters: [
{ type: 'text', text: 'Alex' },
{ type: 'text', text: '#ORD-12345' },
],
},
],
});👥 Contacts
Create a Contact
const contact = await client.contacts.create({
name: 'Jane Doe',
phone: '+1234567890',
email: '[email protected]',
tags: ['VIP', 'Lead'],
});List Contacts
const contacts = await client.contacts.list({
page: 1,
limit: 20,
search: 'Jane',
});📂 Templates
List Approved Templates
const templates = await client.templates.list({
status: 'APPROVED',
});
console.log('Approved templates:', templates);💬 Conversations
List Conversations
const conversations = await client.conversations.list({
page: 1,
limit: 10,
});Mark Conversation as Read
await client.conversations.markAsRead('CONVERSATION_ID');⚠️ Error Handling
The SDK throws a strongly-typed SynqError for all API failures and network issues:
import { Synq, SynqError } from 'imaker-synq';
try {
await client.messages.sendText({
to: '+1234567890',
message: 'Hello!',
});
} catch (error) {
if (error instanceof SynqError) {
console.error('iMaker Synq API Error:', {
message: error.message,
statusCode: error.status,
details: error.details,
});
} else {
console.error('Unexpected error:', error);
}
}⚙️ Configuration Options
| Option | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| apiKey | string | Yes | - | Your iMaker Synq API Key |
| clientId | string | No | undefined | Default client ID for multi-tenant setups |
| baseUrl | string | No | 'https://api.whatsify.in' | Base API URL |
| apiVersion | string | No | 'v1' | API version route |
| timeout | number | No | 15000 | Request timeout in milliseconds |
📄 License
MIT © iMaker Synq
