The Node.js SDK re-exports the WAJS namespace for TypeScript. This reference describes types from WA-JS 4.8.5-rc.0. For operations available on a connected Node.js client, see Whatsapp. For functions running inside WhatsApp Web, see the WA-JS browser API.
// full example
WPP.chat.sendLocationMessage('[number]@c.us', {
lat: -22.95201,
lng: -43.2102601,
name: 'Cristo Rendentor', // optional
address: 'Parque Nacional da Tijuca - Alto da Boa Vista, Rio de Janeiro - RJ', // optional
url: 'https://santuariocristoredentor.com.br/' // optional
});
// minimal
WPP.chat.sendLocationMessage('[number]@c.us', {
lat: -22.95201,
lng: -43.2102601,
});
// name and address
WPP.chat.sendLocationMessage('[number]@c.us', {
lat: -22.95201,
lng: -43.2102601,
name: 'Cristo Rendentor',
address: 'Parque Nacional da Tijuca - Alto da Boa Vista, Rio de Janeiro - RJ'
});
// with buttons
WPP.chat.sendLocationMessage('[number]@c.us', {
lat: -22.95201,
lng: -43.2102601,
name: 'Cristo Rendentor',
address: 'Parque Nacional da Tijuca - Alto da Boa Vista, Rio de Janeiro - RJ',
buttons: [
{
url: 'https://example.test/',
text: 'URL example'
},
{
phoneNumber: '+55 12 3456 7777',
text: 'Phone Number'
},
{
id: 'id1',
text: 'First'
},
{
id: 'id2',
text: 'Second'
},
{
id: 'other',
text: 'Other'
}
],
});
Send a location message