FlowSell Connect SDK
Learn one FlowSell interface. Provider URLs, tokens, WABA IDs, template components, and raw provider payloads stay inside FlowSell Connect. Pass phoneNumberId only when you intentionally choose between multiple connected numbers.
Use the JavaScript / TypeScript package in backend workers, API routes, or server-side apps.
Install
npm install @flowsell/connect
Environment
FLOWSELL_API_KEY=fsc_your_secret FLOWSELL_API_BASE_URL=https://cmwhd2hdarqpip3krnua6ep3le0qhstm.lambda-url.ap-south-1.on.aws FLOWSELL_PHONE_NUMBER_ID=1131858666672190
Client
import { FlowSell } from "@flowsell/connect";
const client = new FlowSell({
apiKey: process.env.FLOWSELL_API_KEY!,
baseUrl: process.env.FLOWSELL_API_BASE_URL
});
const usage = await client.usage.get();
console.log(usage.remaining);Messages
The same message contract is used by the SDK and REST FlowSell Request Body.
client.messages.send(input)
await client.messages.send({
channel: "whatsapp",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190",
to: "+919999999999",
message: "Hello from FlowSell Connect SDK"
});
await client.messages.send({
channel: "whatsapp",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190",
to: "+919999999999",
type: "buttons",
body: "Choose an option",
buttons: [
{ type: "reply", reply: { id: "yes", title: "Yes" } },
{ type: "reply", reply: { id: "no", title: "No" } }
]
});
await client.messages.send({
channel: "whatsapp",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190",
to: "+919999999999",
type: "flow",
body: "Complete your order details.",
flowId: "1234567890",
flowCta: "Open form",
flowAction: "navigate",
flowScreen: "ORDER_DETAILS",
flowData: { order_id: "#1234" }
});Templates
Create templates with named variables like {{customer_name}}. FlowSell extracts, validates, and maps variables to provider payloads internally.
Templates
await client.templates.create({
channel: "whatsapp",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190",
name: "order_update",
category: "UTILITY",
content: `Hello {{customer_name}}
Your order {{order_id}} has shipped.`,
sampleVariables: {
customer_name: "John",
order_id: "#1234"
}
});
const template = await client.templates.get({
name: "order_update",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190"
});
await client.messages.sendTemplate({
channel: "whatsapp",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190",
to: "+919999999999",
template: "order_update",
variables: {
customer_name: "John",
order_id: "#1234"
}
});Media
Upload media through FlowSell, list stored media IDs, and reuse those IDs in normal messages or approved media-header templates.
Media
const media = await client.media.upload({
channel: "whatsapp",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190",
url: "https://example.com/invoice.pdf",
filename: "invoice.pdf"
});
const library = await client.media.list({
channel: "whatsapp",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190"
});
await client.messages.send({
channel: "whatsapp",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190",
to: "+919999999999",
type: "document",
mediaId: media.id,
filename: "invoice.pdf"
});
console.log(library);Advanced Templates
Supported now: URL buttons, quick replies, phone buttons, text headers, and media-header sends when you already have an approved template.
Advanced templates
await client.templates.create({
channel: "whatsapp",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190",
name: "track_order",
category: "UTILITY",
content: `Hello {{customer_name}}
Your order {{order_id}} has shipped.
Track your order using the button below.`,
buttons: [
{
type: "url",
text: "Track Order",
url: "https://track.example.com/{{tracking_id}}"
}
],
sampleVariables: {
customer_name: "John",
order_id: "#1234",
tracking_id: "1234"
}
});
await client.messages.sendTemplate({
channel: "whatsapp",
phoneNumberId: process.env.FLOWSELL_PHONE_NUMBER_ID || "1131858666672190",
to: "+919999999999",
template: "invoice_ready",
headerType: "document",
headerMediaId: "1234567890",
headerFilename: "invoice.pdf",
variables: {
customer_name: "John",
invoice_number: "INV-1234"
}
});Usage
Track monthly quota, purchased packs, consumed operations, and remaining balance.
Usage
const usage = await client.usage.get();
console.log({
baseQuota: usage.baseQuota,
packQuota: usage.packQuota,
consumed: usage.consumed,
remaining: usage.remaining
});