@whizzes/walink
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

walink

WhatsApp Links Generation Utilities

Build Tests Lint Publish Version Downloads

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

Readme

Keywords

none

Package Sidebar

Install

npm i @whizzes/walink

Weekly Downloads

3

Version

0.1.0

License

MIT

Unpacked Size

9.13 kB

Total Files

11

Last publish

Collaborators

  • estebanborai