Check balance in vonage / twilio and notify on xmpp
Find a file
2024-10-15 15:33:29 +05:30
.gitignore mvp 2024-10-15 15:33:29 +05:30
check-balance.sh mvp 2024-10-15 15:33:29 +05:30
README.md mvp 2024-10-15 15:33:29 +05:30

Balance Check

Setup

sudo apt install curl jq

Get your Twilio Auth Token and SID from account info section of your twilio console

Get Vonage API key and secret from your nexmo dashboard

Put them in .env file like this:

TWILIO_AUTH_TOKEN=....
TWILIO_SID=....
VONAGE_API_KEY=....
VONAGE_API_SECRET=....

Running

./check-balance.sh

The above command will source the secrets from your .env, check balance, and then fetch the right column from output using jq.

Setup notification via xmpp

Install and configure any of

  1. go-sendxmpp
  2. sendxmpp-rs
  3. sendxmpp

For go-sendxmpp, you can create ~/.config/go-sendxmpp/config with content like:

username: jid
password: password
alias: balancechecker

The alias is used in MUCs

You have to chmod 400 ~/.config/go-sendxmpp/config

Run with notification

./check-balance.sh | go-sendxmpp -c [email protected]

Scheduling

You can use cron to schedule it as you like