Sure, you can add a conditional statement to check the value of “message_type” and then send the appropriate type of message. Here’s how you can modify your code: for (let i = 0; i < students.length; i++) { const chatId = `${students[i][this.whatsapp]}@c.us`; const message = this.content.replace(/\//g, ''); console.log("מספר:", students[i][this.whatsapp]); try { if (this.message_type === "SendMessage") { await [axios.post](http://axios.post)(apiUrl, { chatId, message }); } else if (this.message_type === "SendFileByUrl") { await [axios.post](http://axios.post)(apiUrl, { chatId, urlFile: "https://my.site.com/img/horse.png", // replace with your URL fileName: "horse.png", // replace with your file name caption: "Little horse" // replace with your caption }); } } catch (error) { console.error(error); } } Please replace the urlFile, fileName, and caption with your own values. This code will check the message_type and send a text message if it’s “SendMessage”, or a media message if it’s “SendFileByUrl”.