Skip to content

Commit

Permalink
feat: Added options for send-message route
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed May 10, 2022
1 parent fbc6529 commit 3284dd3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controller/messageController.js
Expand Up @@ -27,10 +27,12 @@ async function returnSucess(res, data) {
export async function sendMessage(req, res) {
const { phone, message } = req.body;

const options = req.body.options || {};

try {
let results = [];
for (const contato of phone) {
results.push(await req.client.sendText(contato, message));
results.push(await req.client.sendText(contato, message, options));
}

if (results.length === 0) return res.status(400).json('Error sending message');
Expand Down

0 comments on commit 3284dd3

Please sign in to comment.