@Gusik Prasetyo
Example how to Blast / Bulk message (Different message per number)
type blast: Text (yourhost.com/send-message)
1. Create New spreadsheet :
Column : ColA | ColB | ColC
Exp. Col Name : Destination | Message | Status
*Note Destination:
- use numberphone send to personal (628xxxxxxxx)
- use JID send to group (blablabla@g.us) (how to get JID? click Fetch From Selected Device on menu mpwa Phonebook)
2. Create send button:
a. Click Insert -> Drawer (textboxt, SEND) -> Save & Close
b. On shape, right click 3 dot on left choose Assign script type: sendAll
3. Create Google Apps Script:
a. Still on your spreadsheet, click menu Extension -> Apps Script
b. Copy paste sript below:
// Start Here
var url = "http://yourhost/send-message";
var apiKey = "your api_key";
var sender = "your number sender";
function blastWa(number, message) {
var data = {
'api_key': apiKey,
'sender': sender,
'number': number,
'message': message
};
var options = {
"method": "POST",
"contentType": "application/json",
"payload" : JSON.stringify(data),
};
UrlFetchApp.fetch(url, options);
}
function sendFromSheets(){
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2;
var numRows = sheet.getLastRow() - 1;
var dataRange = sheet.getRange(startRow, 1, numRows, 2);
var data = dataRange.getValues();
for (var i = 0; i < data.length; i++){
var row = data[i];
var status;
try {
var response_data = blastWa(row[0], row[1]);
status = "Success";
}
catch(err) {
Logger.log(err);
status = "Error";
}
sheet.getRange(startRow + i, 3).setValue(status);
Utilities.sleep(10000); //example time delay
}
}
function sendAll(){
sendFromSheets();
}
//End Here
c. Save (give all permission needed).
4. Running on spreadsheet click on button SEND you have been create.
How if wanna blast/bulk message different media per number?
yourhost.com/send-media, change method post (API Docs)
{
"api_key": "1234567890",
"sender": "62888xxxx",
"number": "62888xxxx",
"media_type": "image",
"caption": "Hello World",
"url": "https://example.com/image.jpg"
}