webmobyle/africastalking-credit-alert

Laravel package to monitor Africa's Talking credit balance and send email/SMS alerts when it falls below a configured threshold.

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

pkg:composer/webmobyle/africastalking-credit-alert

1.0.2 2026-01-30 19:58 UTC

This package is auto-updated.

Last update: 2026-01-30 19:59:23 UTC


README

Packagist Version License Laravel

A Laravel package to monitor your Africa's Talking application credit balance and send Email and/or SMS alerts when the balance falls below a configurable threshold.

🚀 Features

  • Monitor Africa's Talking app credit balance
  • Email and/or SMS notifications
  • Configurable threshold
  • Queue‑friendly notifications
  • Optional cooldown to prevent alert spam
  • No database required
  • Fully environment‑driven configuration

📦 Installation

composer require webmobyle/africastalking-credit-alert

Publish the configuration file:

php artisan vendor:publish --tag=africastalking-credit-alert-config

⚙️ Environment Variables

Add the following to your .env file:

AT_CREDIT_ALERT_ENABLED=true
AT_CREDIT_ALERT_EMAIL_ENABLED=true
AT_CREDIT_ALERT_SMS_ENABLED=true

AT_CREDIT_ALERT_THRESHOLD=50

AT_CREDIT_ALERT_EMAIL_RECIPIENTS="alerts@example.com"
AT_CREDIT_ALERT_SMS_RECIPIENTS="+265991234567"

AFRICASTALKING_USERNAME=your_username
AFRICASTALKING_API_KEY=your_api_key

AT_CREDIT_ALERT_SMS_FROM=   # Optional. Leave empty if not using sender ID

Cooldown (Optional)

AT_CREDIT_ALERT_COOLDOWN_ENABLED=true
AT_CREDIT_ALERT_COOLDOWN_MINUTES=360
AT_CREDIT_ALERT_RESEND_IF_DROPS_BY=10

🧩 Usage

Run the credit check manually:

php artisan africastalking:credit-check

Schedule it in app/Console/Kernel.php:

$schedule->command('africastalking:credit-check')->everyThirtyMinutes();

💬 SMS Sender ID

  • If you do not have an approved sender ID, leave AT_CREDIT_ALERT_SMS_FROM empty.
  • Passing an invalid sender ID will cause "InvalidSenderId" errors.

👷 Queue Workers

This package uses Laravel notifications and queues by default. Ensure your queue worker is running:

php artisan queue:work

🧱 Requirements

DependencyVersion
PHP^8.2
Laravel10.x – 12.x
Africa’s Talking PHP SDK (africastalking/africastalking)^3.0

📦 Versioning

This package follows Semantic Versioning (SemVer) — tag releases like v1.0.0, v1.1.0, etc.

🪪 License

This package is open-sourced software licensed under the MIT License.

👤 Author

Barnett Temwa Msiska
Founder, Webmobyle Limited
📧 barnett@webmobyle.com

⭐ Support

If you find this package useful, please star it on Packagist or Bitbucket.
Contributions, pull requests, and issues are welcome!

Email: contact@webmobyle.com