realrashid / laravel-zoho-cliq
A Laravel package for integrating with Zoho Cliq, allowing you to send messages, notifications, and rich content seamlessly from your Laravel application.
Fund package maintenance!
realrashid
Patreon
Ko Fi
Issuehunt
www.buymeacoffee.com/realrashid
Requires
- php: ^7.3|^8.1|^8.2|^8.3
- laravel/framework: ^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^6.0.0||^7.0.0||^8.20||^9.0.0
- pestphp/pest: ^2.35
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
README
Introduction
Laravel Zoho Cliq is a Laravel package designed to seamlessly integrate with Zoho Cliq, allowing you to send messages and notifications directly from your Laravel application. Whether you need to communicate with individual users or broadcast messages to channels, this package provides an easy-to-use interface to interact with Zoho Cliq's API.
Installation
To get started, install the package via Composer:
composer require realrashid/laravel-zoho-cliq
Then, publish the configuration file:
php artisan cliq:install
Configuration
After installing the package, you need to configure the OAuth credentials and default settings.
Obtaining Client ID and Secret
- Go to Zoho API Console.
- If you do not have any client, click the Get Started button.
- A modal will appear. Select Self Client and click Create.
- You will be prompted with "Are you sure to enable self-client?" Click OK.
- Copy the Client ID and Client Secret provided.
- Add them to your
.env
file:
CLIQ_API_BASE_URL=https://cliq.zoho.com/api/v2 CLIQ_CLIENT_ID=your-client-id CLIQ_CLIENT_SECRET=your-client-secret CLIQ_DEFAULT_CHANNEL=your-default-channel CLIQ_DEFAULT_SEND_TO=buddies
Usage
Here are some examples of how to use the package to interact with Zoho Cliq:
Send a Message to Multiple Users
Send a message to multiple Zoho Cliq users:
// Route to send a message to multiple users Route::get('/send-buddy-message', function () { $response = Cliq::to(['user1@example.com', 'user2@example.com']) ->send("Hello team! This is a message from Laravel."); return response()->json($response); });
Send a Message to a Single User
Send a message to a single Zoho Cliq user:
// Route to send a message to a single user Route::get('/send-single-buddy-message', function () { $response = Cliq::to('user@example.com') ->send("Hi there! This is a personal message from Laravel."); return response()->json($response); });
Send a Message with a Card
Send a rich message with a card to a Zoho Cliq channel:
// Route to send a message with a card Route::get('/send-card-message', function () { $response = Cliq::toChannel()->to('alerts') ->card( 'New Feature Released!', 'https://example.com/image.jpg', 'https://example.com/image.jpg', 'modern-inline', 'Release Bot', [ [ 'label' => 'Learn More', 'hint' => 'Click to learn more about the feature', 'action_type' => 'open.url', 'web_url' => 'https://example.com/feature', ], [ 'label' => 'Feedback', 'hint' => 'Provide feedback on the new feature', 'action_type' => 'open.url', 'web_url' => 'https://example.com/feedback', ] ] ) ->send("We are excited to announce the release of our new feature!"); return response()->json($response); });
Send a Message to a Channel
Send a message to a specific Zoho Cliq channel:
// Route to send a message to a channel Route::get('/send-message-channel', function () { $response = Cliq::toChannel()->to('general') ->send("Good morning, everyone! Here’s the latest update from Laravel."); return response()->json($response); });
Testing
Run the tests using Composer:
composer test
Changelog
For recent changes, see the CHANGELOG.
Contributing
We welcome contributions! Please see CONTRIBUTING for more details.
Security Vulnerabilities
If you discover a security vulnerability, please report it to us responsibly by emailing realrashid@gmail.com. We will address the issue as promptly as possible.
Credits
Support My Work
If you find this package useful and would like to support my work, you can buy me a coffee. Your support helps keep this project alive and thriving. Thank you!
License
This package is licensed under the MIT License. See License File for more information.
Made with ❤️ from Pakistan