-
Notifications
You must be signed in to change notification settings - Fork 15
fix (zoho-sales-iq-hitl): add tags to get or create user & upgrade to HITL plugin #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
erichugy
commented
Jan 23, 2026
- throw error when tags passed to getOrCreateUser are not fruitful
- added zod schemas for request responses
- upgraded to use HITL plugin
- Migrate from deprecated HITL agent to HITL plugin architecture - Upgrade @botpress/sdk to 5.2.0 and @botpress/client to 1.28.0 - Update hitl interface to 2.0.0 - Add comprehensive error handling for failed conversation creation - Add debug response logging for API calls - Improve input validation for startHitl action - Refactor entity definitions to use ticket schema for hitlSession
Introduce comprehensive Zod-based type definitions for all Zoho Sales IQ API responses and webhook events. Replaces `any`/`unknown` types with properly validated schemas, adding runtime validation throughout the client, event handlers, and setup workflows. Includes new webhook-events.ts with structured event definitions and enhanced schemas.ts with API response wrappers.
…alls Created validation utility to ensure conversation IDs and user email IDs are non-empty before passing to client.getOrCreateConversation and client.getOrCreateUser functions. Updated all event handlers to use the new validation functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR upgrades the Zoho Sales IQ HITL integration to use the new HITL plugin (version 2.0.0) and adds comprehensive validation for webhook events and API responses using Zod schemas. The changes include improved error handling, removal of debug logging with sensitive data, and better type safety throughout the integration.
Changes:
- Upgraded from HITL plugin 0.4.0 to 2.0.0, and Botpress SDK from 3.3.0 to 5.2.0
- Added Zod schema validation for webhook events and API responses
- Implemented tag validation with error handling for getOrCreateUser and getOrCreateConversation
- Improved error handling with proper type guards and removed logging of sensitive information
- Added handlers for unsupported message types (bloc, file, video, audio, image)
Reviewed changes
Copilot reviewed 36 out of 39 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
src/utils/validation.ts |
New validation utilities for conversation and user tags with error handling |
src/definitions/webhook-events.ts |
New Zod schemas for all webhook event types (operator replied, attender updated, conversation completed/missed) |
src/definitions/schemas.ts |
Added Zod schemas for OAuth, conversation creation, and app config responses |
src/setup/handler.ts |
Refactored to use schema validation instead of switch statement for event routing |
src/setup/unregister.ts |
Removed unused parameters |
src/events/*.ts |
Updated event handlers to use validated tags and new event types |
src/client.ts |
Improved error handling, removed sensitive logging, added response validation |
src/channels.ts |
Fixed error message, added unsupported message type handlers |
src/actions/hitl.ts |
Added validation for conversation creation, improved email checking, removed debug logs |
package.json |
Upgraded dependencies including SDK, client, CLI, and HITL plugin |
integration.definition.ts |
Added ticket entity definition and updated version to 3.0.1 |
bp_modules/hitl/* |
Removed generated interface files (to be regenerated by build) |
sample-logs.txt |
Added sample logs (contains sensitive data) |
.gitignore |
Added .claude directory |
Files not reviewed (1)
- integrations/zoho-sales-iq-hitl/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… handling Extract shared JSON schema definitions into dedicated literals file, improve validation error messages with detailed webhook event information, and strengthen input validation in action handlers.
Organize imports alphabetically, remove redundant comments, fix type assertions, and improve error handling across the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 39 out of 42 changed files in this pull request and generated 7 comments.
Files not reviewed (1)
- integrations/zoho-sales-iq-hitl/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
integrations/zoho-sales-iq-hitl/bp_modules/hitl/definition/actions/startHitl/input.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Houssam Eddine Righi <[email protected]>
Co-authored-by: Houssam Eddine Righi <[email protected]>
… handling Remove RuntimeError throws in favor of returning result objects. Auto-refresh credentials when missing and set access token expiry to 1 hour. Simplify sendMessage and getApp methods to return structured result objects. Add note that Zoho refresh tokens never expire.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 38 out of 41 changed files in this pull request and generated 3 comments.
Files not reviewed (1)
- integrations/zoho-sales-iq-hitl/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.