Send localitation

The structure presented is as follows:

function Location(number, latitude, longitude, nameloc, addressloc){
    const data = JSON.stringify({
        "messaging_product": "whatsapp",    
        "recipient_type": "individual",
        "to": number,
        "type": "location",
        "location": {
            "latitude": latitude,
            "longitude": longitude,
            "name": nameloc,
            "address": addressloc
        }
    });
    return data;
}

The parameters received are a number, latitude, longitude, location name and finally the address of the audio to be sent.

We recommend sending in the following way in the process files:

let answer = dictionaryModule.function();
let model = models.Location(answer,number);

If not also in the whatsappModels file:

Última actualización