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.
To get started, install the package via Composer:
composer require realrashid/laravel-zoho-cliq
Then, publish the configuration file:
php artisan cliq:install
After installing the package, you need to configure the OAuth credentials and default settings.
- 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
Here are some examples of how to use the package to interact with Zoho Cliq:
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 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 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 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);
});
Run the tests using Composer:
composer test
For recent changes, see the CHANGELOG.
We welcome contributions! Please see CONTRIBUTING for more details.
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.
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!
This package is licensed under the MIT License. See License File for more information.
Made with ❤️ from Pakistan