PHP code example of realrashid / laravel-zoho-cliq

1. Go to this page and download the library: Download realrashid/laravel-zoho-cliq library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

realrashid / laravel-zoho-cliq example snippets


// Route to send a message to multiple users
Route::get('/send-buddy-message', function () {
    $response = Cliq::to(['[email protected]', '[email protected]'])
        ->send("Hello team! This is a message from Laravel.");

    return response()->json($response);
});

// Route to send a message to a single user
Route::get('/send-single-buddy-message', function () {
    $response = Cliq::to('[email protected]')
        ->send("Hi there! This is a personal message from Laravel.");

    return response()->json($response);
});

// 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);
});

// 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);
});
bash
php artisan cliq:install