0.0.4 • Published 6 years ago

whatsapp-url v0.0.4

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

WhatsApp url

Create a Whatsapp url

Install

$ yarn add whatsapp-url

Usage

const whatsappUrl = require('whatsapp-url')

console.log(whatsappUrl({
  url: '5541984401163',
  text: 'Hello World, its me Mario!'
}))
// https://api.whatsapp.com/send?text=Hello%20World,%20its%20me%20Mario!&phone=5541984401163

console.log(whatsappUrl({
  url: '5541984401163',
  text: 'Hello World, its me Luigi!',
  isWeb: true
}))
// https://web.whatsapp.com/send?text=Hello%20World,%20its%20me%20Luigi!&phone=5541984401163

When add the url to a <a/> tag it should work like this

Examples

Check the examples

API

whatsappUrl(options)

Returns a string

text

Type: string Example: Hello%20World,%20its%20me%20Mario!

phone

Type: string Example: 55984401163


Inspired by

bukinoshita/share-twitter - Thank you!

License

MIT © Fernando Moreira