Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whizzes/walink
WhatsApp Links Generation Utilities
https://github.com/whizzes/walink
javascript walink whatsapp
Last synced: 23 days ago
JSON representation
WhatsApp Links Generation Utilities
- Host: GitHub
- URL: https://github.com/whizzes/walink
- Owner: whizzes
- License: mit
- Created: 2023-01-30T03:50:56.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-28T00:07:25.000Z (over 1 year ago)
- Last Synced: 2024-10-01T07:41:49.068Z (about 1 month ago)
- Topics: javascript, walink, whatsapp
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@whizzes/walink
- Size: 221 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
walink
WhatsApp Links Generation Utilities
![Build](https://github.com/whizzes/walink/workflows/build/badge.svg)
![Tests](https://github.com/whizzes/walink/workflows/test/badge.svg)
![Lint](https://github.com/whizzes/walink/workflows/lint/badge.svg)
![Publish](https://github.com/whizzes/walink/workflows/publish/badge.svg)
[![Version](https://img.shields.io/npm/v/@whizzes/walink.svg?style=flat)](https://www.npmjs.com/package/@whizzes/walink)
[![Downloads](https://img.shields.io/npm/dm/@whizzes/walink.svg?style=flat)](https://www.npmjs.com/package/@whizzes/walink)## Getting Started
Install in your project
```bash
npm i @whizzes/walinkyarn 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.```ts
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.```ts
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