WhatsApp.PostWhatsApp
Skip to content
mnscript
StringResult WhatsApp.PostWhatsApp(Secret, Secret, string) 

Description ​

Posts message to your WhatsApp.

Arguments ​

Secret - The secret containing the CallMeBot auth key
Secret - The secret containing your WhatsApp Phone number
string - The message to send to your WhatsApp.

Returns ​

StringResult

Example ​

msc
using System;
using Web;
using Secrets;

//1. Add the phone number +34 644 31 95 65 into your Phone Contacts. (Name it it as you wish)
//2. Send this message "I allow callmebot to send me messages" to the new Contact created (using WhatsApp of course)
//3. Wait until you receive the message "API Activated for your phone number. Your APIKEY is 123123" from the bot.
//   Note: If you don't receive the ApiKey in 2 minutes, please try again after 24hs.
// You need to make sure the secret is set beforehand with 'secret add whatsapp-key <YOUR_KEY_HERE>'
// You need to make sure the secret is set beforehand with 'secret add whatsapp-number <YOUR_NUMBER_HERE>' with country code e.g. +44
// Your webhook shoud look something like "12341234"
// Your phone number shoud look something like "+447221123123"

Secret secretKey = Secrets.GetSecret("whatsapp-key");
Secret secretNumber = Secrets.GetSecret("whatsapp-number");
string message = "You are being raided!!";

// Creates a WhatsApp, adds some fields and posts it to your webhook
WhatsApp hook = new WhatsApp();

hook.PostWhatsApp(secretKey, secretNumber, message);