Messaging
Messaging
The Messaging module is responsible for performing message sending actions such as SMS and WhatsApp. Its methods can be accessed as in the example below:
js
await Messaging.whatsAppSendMessage["v1_0_0"]({
originWhatsAppInstance: "1008888888823000088a8d18",
destinationNumbers: ["5511998888888"],
message: "Hello world!"
})
Methods
whatsAppSendMessage
Method responsible for sending a message on WhatsApp to one or more mobile numbers.
js
await Messaging.whatsAppSendMessage["v1_0_0"]({
originWhatsAppInstance: "1008888888823000088a8d18",
destinationNumbers: ["5511998888888"],
message: "Hello world!"
})
Required parameters
originWhatsAppInstance: String - it is a key that references the instance of the mobile number registered in the device. You can find this key on the "WhatsApp bots" screen.
Warning
To use the customer option, the user's mobile number must be registered according to the register WhatsApp number tutorial.
destinationNumbers: String[] - It is an array of strings, where each position must be a phone number. The message is sent to every number in this array.message: String - Message to be sent.
Optional parameters
There are no optional parameters.
Return
This action has no return.
whatsAppSendMedia
Method responsible for sending a media file (image, video, document, etc.) through WhatsApp to one or more mobile numbers.
js
await Messaging.whatsAppSendMedia["v1_0_0"]({
originWhatsAppInstance: "1008888888823000088a8d18",
destinationNumbers: ["5511998888888"],
mediaPath: "C:\\Users\\Roberty\\Downloads\\imagem.png",
message: "Segue o arquivo solicitado."
})
Required parameters
originWhatsAppInstance: String - it is a key that references the instance of the mobile number registered in the device. You can find this key on the "WhatsApp bots" screen.destinationNumbers: String[] - It is an array of strings, where each position must be a phone number. The media is sent to every number in this array.mediaPath: String - full path of the media file that will be sent.
Optional parameters
message: String - optional text to be sent alongside the media.
Return
This action has no return.
sendSMS (Profissional)
Method responsible for sending an SMS message to a mobile number.
js
await Messaging.sendSMS.v1_0_0({
destination: ['5511998888888'],
message: 'Hello World!'
})
Required parameters
destination: String - expects a string that must be a phone number which will receive the SMS message.message: String - Message to be sent, with at most 140 characters.
Optional parameters
There are no optional parameters.
Return
This action has no return.