Tuesday, August 8, 2023

Sending Whatsapp Messaging Alerts Using Api !!!

 

CallMeBot: Sending Alerts to Various Messaging Apps using APi.


atOptions = { 'key' : '82d94c040bceecfd196f525a0e5ee173', 'format' : 'iframe', 'height' : 90, 'width' : 728, 'params' : {} }; document.write(''); {"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="callmebot" data-large-file="https://aacable.files.wordpress.com/2022/08/callmebot.png?w=1024" data-medium-file="https://aacable.files.wordpress.com/2022/08/callmebot.png?w=300" data-orig-file="https://aacable.files.wordpress.com/2022/08/callmebot.png" data-orig-size="1220,678" data-permalink="https://aacable.wordpress.com/2022/08/10/callmebot-sending-alerts-via-whatsapp/callmebot/" height="274" sizes="(max-width: 493px) 100vw, 493px" src="https://aacable.files.wordpress.com/2022/08/callmebot.png?w=493&h=274" srcset="https://aacable.files.wordpress.com/2022/08/callmebot.png?w=493&h=274 493w, https://aacable.files.wordpress.com/2022/08/callmebot.png?w=986&h=548 986w, https://aacable.files.wordpress.com/2022/08/callmebot.png?w=150&h=83 150w, https://aacable.files.wordpress.com/2022/08/callmebot.png?w=300&h=167 300w, https://aacable.files.wordpress.com/2022/08/callmebot.png?w=768&h=427 768w" style="border: none; clear: both; display: block; height: auto; margin-left: auto; margin-right: auto; max-width: 100%;" width="493" />


At multiple ISP’s or networks, I use either GSM Modems or 3rd party SMS API to send various information / alerts messages to admin or users , & it involves minor cost on a per SMS basis or as bundle. Another method to send messages on WHATSAPP & its FREE , very simple to use CALLMEBOT APi’s. Its a online FREE service via which you can send basic messages to multiple messaging services like WhatsApp / messenger / Signal / Telegram apps.  The only caveat is that you cannot send messages to EVERY contact. The receiver contact must have the callmebot API KEY , which he can easily get via adding callmebot number in there contact list & send particular message & he will get it instantly. so EACH API EKY is tagged with that particular mobile number only. Once you know the key & its tagged mobile number, you can send message to that contact using the API_KEY & his mobile number using various methods.

In this guide we will be using callmebot API to send various test message to admin WhatsApp number. Follow the below steps …

  • First, You need to get the API key form the CallMeBot. Add the phone number +34 644 91 96 80 into your Phone Contacts. (Name it it as you wish like CallMeBoT / My_Alerts etc )
  • Using WhatsApp, Send this message to this contact

I allow callmebot to send me messages

  • once it is sent, Wait until you receive the message like “API Activated for your phone number. Your APIKEY is XXXXXX” from the bot. Note down the APIKEY
    Note: If you don’t receive the Api Key in 2 minutes, please try again after 24hs.
  • The WhatsApp message from the CallMeBot will contain the API key needed to send messages using various API.
  • Now You can send text messages using the API after receiving the confirmation.

Following are few methods, which I am using to send various informational/warning/critical messages to Admin WhatsApp


Send message using Browser HTTP APi:

Using browser, you can send message by using below

(As always, change the Phone/Api Key)

1
https://api.callmebot.com/whatsapp.php?phone=+923333333333&apikey=321321&text=Fiber+Link+is+Down


Linux Examples:

CMD: on Terminal/shell

(As always, change the Phone/APiKey)

1
curl --insecure 'https://api.callmebot.com/whatsapp.php?phone=+923333333333&apikey=321321&text=Linux+Msg+Test+z'


Linux Bash Script Example using separate Text file as attachment.

(As always, change the Phone/APiKey)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# DAILY SMS SCRIPT FOR whatsapp MSG Testing
PATH=/opt/someApp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Version 2.0 -
# Created in year 2013
# Last modified 20-NOV-2017
set -x
logger DAILY 8 am SMS executed for whatsapp testing
#ntpdate -u 91.189.91.157
COMPANY="Independence-Day"
TMP="/tmp/dailysms.txt"
> $TMP
# CHAGNE BELOW API KEY AS PER YOUR'S
API_KEY=321321
# CHANGE CELL AS PER YOUR's
CELL1="923333333333"
UPTIME=`uptime | awk -F'( |,|:)+' '{if ($7=="min") m=$6; else {if ($7~/^day/) {d=$6;h=$8;m=$9} else {h=$6;m=$7}}} {print d+0,"days,",h+0,"hours,",m+0,"minutes"}'`
DATE=`date`
FOOTER="Powered By ns"
# Print total and each vlan users
MSG="$COMPANY - Msg Test !
Daily Msg Test @
UPTIME = $UPTIME
$DATE
$FOOTER"
echo "$MSG" > $TMP
cat $TMP
 
# Finally SEND MSG to WhatsApp using CALLMEBOT
curl --insecure "https://api.callmebot.com/whatsapp.php?phone=+$CELL1&apikey=$API_KEY" -G --data-urlencode text@$TMP
 
rm $TMP
# THE END



Mikrotik RouterOS Example:

Terminal:

(As always, change the Phone/APiKey)

1
/tool fetch http-method=get mode=https url="https://api.callmebot.com/whatsapp.php\?&apikey=123123&phone=+923333021909&text=Mikrotik+Router+Whatsapp+Msg+Example+SJZ"



Mikrotik DUDE (for Windows) Example:

First download the windows base WGET utility, copy it in any local folder of dude server. & now add notification like this

On DUDE App, Goto Notifications, Click on + ICON to add new notification, a new popup will appear, fill it as per below

Name: networkingssolutions
Enabled: Ticked
Type: Execute on Server
& in Command Window section, use below cmd

(As always, change the Phone/APiKey)

1
C:\wget\wget.exe --no-check-certificate "https://api.callmebot.com/whatsapp.php?phone=+923333333333&apikey=321321&text=Service [Probe.Name] on [Device.Name] is now [Service.Status] ([Service.ProblemDescription])"

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home