Skip to content

Conversation

@erichugy
Copy link

  • 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.
Copilot AI review requested due to automatic review settings January 23, 2026 14:52
@erichugy erichugy requested review from a team and ermek-botpress as code owners January 23, 2026 14:52
Copy link
Contributor

Copilot AI left a 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.

@erichugy erichugy marked this pull request as draft January 23, 2026 15:10
… 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.
@botpress botpress deleted a comment from Copilot AI Jan 26, 2026
@erichugy erichugy marked this pull request as ready for review January 26, 2026 16:24
@erichugy erichugy requested a review from Copilot January 27, 2026 21:22
Copy link
Contributor

Copilot AI left a 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.

@erichugy erichugy changed the title fix (zoho-sales-iq-hitl): add tags to get or create user & upgrate to HITL plugin fix (zoho-sales-iq-hitl): add tags to get or create user & upgrade to HITL plugin Jan 28, 2026
@erichugy erichugy marked this pull request as draft January 28, 2026 16:39
erichugy and others added 4 commits January 28, 2026 11:42
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.
@erichugy erichugy marked this pull request as ready for review January 29, 2026 16:26
Copy link
Contributor

Copilot AI left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants