-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5157bea
commit 84ff673
Showing
1 changed file
with
10 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,33 +33,37 @@ class MessageAPI { | |
return response.data | ||
} | ||
|
||
/** Send text message to chat or phone. Method call adds message to sending queue | ||
/** Send text message to chat or phone. Method call adds message to sending queue | ||
* | ||
* @param {String} chatId - chat id using Whatsapp format ([email protected] - for private messages). | ||
* @param {string} message - text message | ||
* @param {String} phoneNumber - number ([email protected] - for private messages). | ||
* @param {String} message - text message | ||
* @param {array} options - array of objects | ||
* @param {boolean} multipleAnswers - allow answers | ||
* @param {String} quotedMessageId - id of message | ||
*/ | ||
|
||
async sendPoll(chatId, message,options,multipleAnswers = false,quotedMessageId = null) { | ||
CommonUtils.validateChatIdPhoneNumber(chatId); | ||
async sendPoll(chatId, phoneNumber, message, options, multipleAnswers, quotedMessageId) { | ||
CommonUtils.validateChatIdPhoneNumber(chatId, phoneNumber); | ||
CommonUtils.validateString('message', message); | ||
CommonUtils.validateArray('options' , options); | ||
|
||
const method = 'sendPoll'; | ||
|
||
const postData = { | ||
'message': message, | ||
'options' : options, | ||
'multipleAnswers' : multipleAnswers, | ||
'quotedMessageId' : quotedMessageId, | ||
}; | ||
|
||
this.addChadIdParam(postData, chatId); | ||
this.addPhoneParam(postData, phoneNumber); | ||
|
||
const response = await axios__default["default"].post(CommonUtils.generateMethodURL(this._restAPI.params, method), postData); | ||
return response.data | ||
} | ||
|
||
|
||
|
||
/** Send buttons message to chat. Method call adds message to sending queue | ||
* | ||
* @param {String} chatId - chat id using Whatsapp format ([email protected] - for private messages). | ||
|