Skip to content

Commit

Permalink
Update methods
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyMalyshkin committed Nov 7, 2023
1 parent 5157bea commit 84ff673
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/utils/MessageAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit 84ff673

Please sign in to comment.