marjose123/laravel-zoho-cliq-alert

Quickly send a message to Zoho Cliq Channels.

1.0.0 2025-03-07 05:13 UTC

This package is auto-updated.

Last update: 2025-03-07 05:15:33 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package can quickly send alerts to Zoho Cliq. You can use this to notify yourself of any noteworthy events happening in your app.

use MarJose123\ZohoCliqAlert\Facades\ZohoCliqAlert;

ZohoCliqAlert::channel('marketing')->message("You have a new subscriber to the {$newsletter->name} newsletter!");

Under the hood, a job is used to communicate with Zoho Cliq. This prevents your app from failing in case Zoho Cliq is down.

Installation

You can install the package via composer:

composer require marjose123/laravel-zoho-cliq-alert

You can publish the config file with:

php artisan vendor:publish --tag="laravel-zoho-cliq-alert-config"

This is the contents of the published config file:

return [
  /*
    |--------------------------------------------------------------------------
    | OAuth Credentials
    |--------------------------------------------------------------------------
    |
    | These are OAuth credentials required for authentication with Zoho Cliq API.
    | You can obtain these credentials from your Zoho Cliq Developer Console:
    | https://api-console.zoho.com/
    |
    */
    'client_id' => env('ZOHO_CLIENT_ID', ''),
    'client_secret' => env('ZOHO_CLIENT_SECRET', ''),
];

Usage

Basic sending of message without using message card feature of Zoho Cliq.

use MarJose123\ZohoCliqAlert\Facades\ZohoCliqAlert;
use \MarJose123\ZohoCliqAlert\ZohoDataCenter;

ZohoCliqAlert::channel('marketing')
      ->asBot('MarketingWebsite')
      ->dataCenter(ZohoDataCenter::US)
      ->queue('default')
      ->message("You have a new subscriber to the {$newsletter->name} newsletter!")
      ->send();

You want to use modern card message. You can check Zoho Cliq Message Card for more details.

use MarJose123\ZohoCliqAlert\Facades\ZohoCliqAlert;
use \MarJose123\ZohoCliqAlert\ZohoDataCenter;

ZohoCliqAlert::channel('marketing')
      ->asBot('MarketingWebsite')
      ->dataCenter(ZohoDataCenter::US)
      ->queue('default')
      ->message("You have a new subscriber to the {$newsletter->name} newsletter!",[
       'card' => [
            "title" => "ANNOUNCEMENT",
            "theme" => "modern-inline",
            "thumbnail" => "https://www.zoho.com/cliq/help/restapi/images/announce_icon.png"
        ],
        'buttons' => [
            [
              "label" => "View",
              "type" => "+",
              "action" => [
                "type" => "invoke.function",
                "data" => [
                  "name" => "internlist"
                ]
              ]
           ]       
       ]
      ])->send();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.