Skip to main content
Sdks
TypeScript SDK
The TypeScript SDK offers a strongly-typed and flexible way to integrate WhatsApp messaging into Node.js applications. It provides better IntelliSense, compile-time safety, and works seamlessly with modern TypeScript projects.
Both SDKs support the same features and endpoints, so functionality is identical across them.
Advantages of TypeScript SDK
- Built-in type safety
- Better IDE autocomplete
- Fewer runtime errors
- Works with JavaScript projects
- Ideal for scalable applications
Best Fit For
- Production applications
- Medium to large projects
- Automation scripts
- Type-safe backend services
Installation
Node.js
npm install @duochat/{{brand_nam}}-sdk
Node.js Usage
import { SdkSendMessageDto, duochatSdk } from "@duochat/{{brand_nam}}-sdk";
(async (): Promise<void> => {
constduochat = new duochatSdk({
token: "YOUR_TOKEN_HERE", // 👈 Get this from https://{{brand_nam}}/
});
const sdkSendMessageDto: SdkSendMessageDto = {
countryCode: "91",
phoneNumber: "9876543210",
messageType: "text",
templateName: "welcome_template",
messageText: "Hello from {{brand_nam}}!",
components: ["button1", "button2"],
context: {},
mediaMessage: {},
media: {},
};
const { data } =
awaitduochat.sdk.sdkControllerSendMessage(sdkSendMessageDto);
console.log("Message sent successfully:", data);
})();
Was this page helpful?