✨ Feature: Add Support for Zoho Cliq Notification Service#173
✨ Feature: Add Support for Zoho Cliq Notification Service#173guanguans merged 1 commit intoguanguans:mainfrom
Conversation
PR Compliance Guide 🔍(Compliance updated until commit d9ddccf)Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label Previous compliance checksCompliance check up to commit d9ddccf
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for the Zoho Cliq notification service to the notification SDK library. The implementation follows the existing patterns established in the codebase by extending foundation classes and providing OAuth-based authentication.
- Implements Zoho Cliq notification service with OAuth 2.0 token generation
- Adds support for rich message features including cards, buttons, and bot customization
- Removes conflicting
guanguans/ai-commitdevelopment dependency
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ZohoCliq/Authenticator.php | Implements authentication using URI template and bearer token patterns with OAuth token generation helper |
| src/ZohoCliq/Client.php | HTTP client for Zoho Cliq API with base URI configuration |
| src/ZohoCliq/Messages/Message.php | Message structure supporting text, cards, buttons, slides, and bot customization |
| src/ZohoCliq/Token.php | OAuth 2.0 token generation utility for client credentials flow |
| tests/ZohoCliq/ClientTest.php | Test suite covering basic messages, bot customization, and card-based notifications |
| src/ZohoCliq/README.md | Service-specific documentation with API reference links |
| README.md | Updated main documentation to include ZohoCliq in supported services list |
| composer.json | Added ZohoCliq to package metadata and removed conflicting ai-commit dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private string $clientId; | ||
| private string $clientSecret; | ||
|
|
||
| public function __construct(string $clientId, string $clientSecret) |
There was a problem hiding this comment.
The $clientSecret parameter should be marked with #[\SensitiveParameter] attribute to prevent accidental exposure in stack traces and logs, similar to the pattern used in Authenticator::__construct() and other authenticators in the codebase.
| public function __construct(string $clientId, string $clientSecret) | |
| public function __construct(string $clientId, #[\SensitiveParameter] string $clientSecret) |
| parent::__construct(...$authenticators); | ||
| } | ||
|
|
||
| public static function generateToken(string $clientId, string $clientSecret): string |
There was a problem hiding this comment.
The $clientSecret parameter should be marked with #[\SensitiveParameter] attribute to prevent accidental exposure in stack traces and logs, consistent with the security practices used elsewhere in the codebase.
| public static function generateToken(string $clientId, string $clientSecret): string | |
| public static function generateToken(string $clientId, #[\SensitiveParameter] string $clientSecret): string |
|
|
||
| $body = (string) $response->getBody(); | ||
| $json = json_decode($body ?: '[]', true, 512, \JSON_THROW_ON_ERROR); | ||
|
|
There was a problem hiding this comment.
The access_token key may not exist in the API response if authentication fails or an error occurs. This will cause an undefined array key error. Consider adding error handling to check if the key exists or handle potential API error responses.
Example:
if (!isset($json['access_token'])) {
throw new \RuntimeException('Failed to retrieve access token from Zoho API response');
}
return $json['access_token'];| if (!isset($json['access_token'])) { | |
| throw new \RuntimeException('Failed to retrieve access token from Zoho API response: ' . $body); | |
| } |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #173 +/- ##
=============================================
- Coverage 100.00% 98.69% -1.31%
- Complexity 377 385 +8
=============================================
Files 146 150 +4
Lines 1443 1455 +12
=============================================
- Hits 1443 1436 -7
- Misses 0 19 +19 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@ricardoapaes thank you. |
|
The 3.4.0 version was re-released, and it was temporarily changed to support only webhook. If you have any good ideas, you can tell me. Related details link:
|
User description
This Pull Request introduces support for the Zoho Cliq notification service, allowing users to send messages to Cliq channels through this library.
Key Changes:
New Notifier Implementation: A new service class for Zoho Cliq has been added, following the repository's notification pattern and data structure.
JWT Token Generation: To meet Cliq's authentication requirement, a new utility class named Token (or similar) was created to encapsulate the JSON Web Token (JWT) Generation logic.
Data Structure: Mapping of necessary parameters (such as the WebHook URL and Access Token) for the new notifier's configuration.
Note on Development Dependencies:
To ensure successful composer install, it was necessary to temporarily remove the guanguans/ai-commit package from require-dev. This package was causing dependency conflicts with other project requirements, preventing a complete installation. Further investigation or updating the version of ai-commit is suggested to reintroduce it without conflicts.
PR Type
Enhancement
Description
Add Zoho Cliq notification service with full integration support
Implement OAuth token generation for Zoho Cliq authentication
Create message structure supporting text, cards, buttons, and bot customization
Remove conflicting
guanguans/ai-commitdependency from require-devUpdate documentation and metadata to include ZohoCliq service
Diagram Walkthrough
File Walkthrough
Authenticator.php
Zoho Cliq authentication with OAuth supportsrc/ZohoCliq/Authenticator.php
AggregateAuthenticatorcombining URI template and bearerauthentication
parameters
generateToken()to create OAuth tokens viaTokenclassClient.php
HTTP client for Zoho Cliq APIsrc/ZohoCliq/Client.php
Clientclass for Zoho Cliq API communicationhttps://cliq.zoho.com/Authenticatorinstance for request authenticationMessage.php
Message structure for Zoho Cliq notificationssrc/ZohoCliq/Messages/Message.php
Messageclass with Zoho Cliq-specific fieldsToken.php
OAuth token generation utilitysrc/ZohoCliq/Token.php
ClientTest.php
Test suite for Zoho Cliq clienttests/ZohoCliq/ClientTest.php
README.md
Update documentation with ZohoCliq serviceREADME.md
README.md
Add ZohoCliq service documentationsrc/ZohoCliq/README.md
composer.json
Update package metadata and dependenciescomposer.json
guanguans/ai-commitfrom require-dev due to dependencyconflicts