Licence
MIT
Version
0.1.0
Deps
0
Size
9 kB
Vulns
0
Weekly
0
walink
WhatsApp Links Generation Utilities
Getting Started
Install in your project
npm i @whizzes/walink
yarn add @whizzes/walink
pnpm i @whizzes/walink
Usage
Theres two ways you can consume this package in your code. By either providing
a singleton-like WhatsAppLinkMaker instance, or using the utility function:
makeWhatsAppLink.
Using WhatsAppLinkMaker instance
The WhatsAppLinkMaker instance allows you to specify the phone number to
use once and then make multiple messages with a single instance.
import { WhatsAppLinkMaker } from '@whizzes/walink';
const waLink = new WhatsAppLinkMaker('+112312344321');
const productLink = 'https://example.com/products/1';
const link = waLink.make(
`Hello I would like to know more about this product: ${productLink}`,
);
Using makeWhatsAppLink utility function
If you need to use different phone numbers on every message, the makeWhatsAppLink
function will be useful instead.
import { makeWhatsAppLink } from '@whizzes/walink';
const phoneNumber = '+112312344321';
const productLink = 'https://example.com/products/1';
const message = `Hello I would like to know more about this product: ${productLink}`;
const link = makeWhatsAppLink(phoneNumber, message);
License
Licensed under the MIT License