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
});Onboarding
Connect a business number from your own product. Create a hosted Embedded Signup link, or run Embedded Signup yourself and finish it with one API call.
Onboarding
const session = await client.onboarding.createSession({
redirectUrl: "https://yourapp.com/whatsapp/connected",
reference: "customer_123",
fundingMode: "CUSTOMER_FUNDED"
});
// Send session.url to the business. Then poll or wait for the
// account.connected webhook.
const latest = await client.onboarding.getSession(session.id);
if (latest.status === "COMPLETED") console.log(latest.account.phoneNumberId);
// Running Embedded Signup in your own page instead:
await client.onboarding.complete({
code: codeFromFbLogin,
wabaId,
phoneNumberId,
fundingMode: "CUSTOMER_FUNDED"
});Numbers, Profile and Analytics
Verify and register numbers, set PINs, edit the business profile, create QR links, manage Flows and read Meta analytics.
Numbers, Profile and Analytics
const { data: accounts } = await client.accounts.list();
const phoneNumberId = accounts[0].phoneNumberId;
const health = await client.accounts.health(phoneNumberId);
await client.businessProfile.update({
phoneNumberId,
about: "Fast replies, 9am to 9pm",
vertical: "RETAIL"
});
const qr = await client.qrCodes.create({
phoneNumberId,
prefilledMessage: "Hi, I want to know more"
});
const pricing = await client.analytics.pricing({
start: "2026-09-01",
end: "2026-09-30",
dimensions: ["pricing_category"]
});Billing
Read plan quota, the Meta wallet balance and the rate card, and estimate template costs before a campaign. Writes use 1 request unit, reads are free.
Billing
const plan = await client.billing.subscription();
console.log(plan.usage.remaining, "request units left");
const wallet = await client.billing.wallet();
const estimate = await client.billing.estimate({
countryCode: "IN",
category: "marketing",
count: 5000
});
if (!estimate.sufficientBalance) console.log("Top up the Meta wallet first");Webhooks
Register endpoints for message, status, template and account events, and verify each delivery signature.
Webhooks
import { verifyWebhookSignature } from "@flowsell/connect";
const endpoint = await client.webhooks.create({
url: "https://yourapp.com/webhooks/flowsell",
events: ["message.*", "account.*", "template.status"]
});
// Store endpoint.secret. It is shown once.
// In your handler, use the raw request body:
const ok = await verifyWebhookSignature(
rawBody,
req.headers["x-flowsell-signature"],
process.env.FLOWSELL_WEBHOOK_SECRET,
req.headers["x-flowsell-timestamp"]
);