UChat Official

Introduction

In this detailed overview, we explore the process of testing various webhook events supported by the Chat Partner API.

After setting up your webhook, understanding how to trigger and verify each event is crucial for seamless integration and automation.

This guide covers the supported events, their triggers, data payloads, and practical testing methods, empowering developers to efficiently utilize webhook functionalities for enhanced user engagement and operational automation.


Deep Dive into Supported Webhook Events

Overview of Supported Events

The Chat Partner API currently supports six key webhook events, with potential for future additions. These events facilitate real-time updates on user and workspace activities, enabling automation, CRM synchronization, and user engagement strategies.

Event Name

Trigger Condition

Data Provided

Use Cases

User Registration

When a new user registers, regardless of registration source

User email, registration timestamp, source, etc.

Sync user data into CRM, initiate onboarding workflows

Workspace Created

When a user creates a new workspace, triggered on first creation and subsequent creations

Workspace ID, owner ID, owner email, workspace name, etc.

Lead generation, onboarding, trial management

Workspace Deleted

When a workspace is deleted

Workspace ID, owner details, deletion timestamp

Re-engagement campaigns, soft deletion tracking

Plan Changed

When a user upgrades or downgrades their plan

Plan ID, billing cycle info, owner email, auto-renew status

Automate billing updates, targeted marketing

Plan Renewed

When a subscription renews

Renewal date, plan details, billing info

Renewal confirmation, customer retention strategies

Overdue Payment

When a payment becomes overdue

Payment ID, amount, due date, user info

Payment reminders, recovery campaigns

Understanding Event Triggers and Data

User Registration & Workspace Creation

  • User Registration: Triggered once per email, regardless of registration source (chatbot, custom domain, landing page). Useful for capturing new user data.

  • Workspace Created: Can trigger multiple times for the same user if they create multiple workspaces. First trigger occurs alongside registration; subsequent triggers occur on additional workspace creation.

Workspace Deletion

  • Triggered when a workspace is deleted, providing data such as workspace ID, owner info, and deletion timestamp. Useful for soft deletion tracking and re-engagement.

Plan Changes

  • Triggered when a user upgrades or downgrades their plan.

  • Upgrade: Plan ID indicates a paid plan, auto-renew is typically on.

  • Downgrade: To free plan, auto-renew is off, and billing cycle info is absent.

  • Enables automation for billing updates, user segmentation, and targeted offers.

Plan Renewal & Overdue Payments

  • These events are more complex to trigger manually but can be simulated.

  • Provide critical data for renewal confirmations and overdue payment reminders.

How to Test Webhook Events: Practical Steps

Setting Up Listening Mode

  • Enable webhook listening mode in your system.

  • Use tools like Postman, curl, or custom scripts to send test payloads.

  • Observe incoming data to verify correct event triggers.

Testing Each Event

1. User Registration & Workspace Creation

  • Create a new user via your registration form or platform.

  • Create a new workspace for an existing user.

  • Expected outcome: Receive user_registered and workspace_created events with relevant data.

Example:

{
  "event": "workspace_created",
  "data": {
    "workspace_id": "abc123",
    "owner_id": "user456",
    "owner_email": "[email protected]",
    "workspace_name": "My Workspace"
  }
}

2. Workspace Deletion

  • Delete a workspace through your admin panel or API.

  • Expected outcome: Receive workspace_deleted event with details.

Example:

{
  "event": "workspace_deleted",
  "data": {
    "workspace_id": "abc123",
    "owner_email": "[email protected]",
    "deletion_time": "2024-04-27T10:00:00Z"
  }
}

3. Plan Change (Upgrade/Downgrade)

  • Change plan via the workspace settings.

  • Expected outcome: Receive plan_changed event with plan ID, billing info, and owner email.

Example:

{
  "event": "plan_changed",
  "data": {
    "plan_id": "business",
    "owner_email": "[email protected]",
    "auto_renew": true,
    "start_date": "2024-04-01",
    "end_date": "2024-05-01"
  }
}
  • To downgrade to free plan, the event will indicate plan_id as free, with auto_renew off.

4. Plan Renewal & Overdue Payments

  • These events are typically triggered automatically by billing cycles.

  • Simulation: Send sample payloads manually to test handling.

Sample Data for Renewal:

{
  "event": "plan_renewed",
  "data": {
    "renewal_date": "2024-05-01",
    "plan_id": "business",
    "owner_email": "[email protected]"
  }
}

Sample Data for Overdue Payment:

{
  "event": "overdue_payment",
  "data": {
    "payment_id": "pay789",
    "amount": 49.99,
    "due_date": "2024-04-20",
    "owner_email": "[email protected]"
  }
}

Practical Use Cases and Automation Strategies

Leveraging Webhook Data for Business Automation

Event

Potential Automation

Example Actions

User Registration

Sync new users into CRM, initiate onboarding workflows

Send welcome email, assign user to onboarding sequence

Workspace Created

Lead capture, trial management, onboarding

Send trial activation email, assign account manager

Workspace Deleted

Re-engagement campaigns, soft delete tracking

Send re-engagement offers, survey for feedback

Plan Changed

Billing updates, targeted marketing, retention campaigns

Offer discounts for downgrades, upsell for upgrades

Plan Renewed

Renewal confirmation, loyalty rewards

Send thank-you message, offer loyalty discounts

Overdue Payment

Payment reminders, recovery campaigns

Send overdue notices, offer payment plans

Automating Responses Based on Events

  • User Registration & Workspace Creation: Automate onboarding emails, CRM updates.

  • Workspace Deletion: Trigger re-engagement campaigns or soft delete logs.

  • Plan Changes: Adjust marketing segmentation, trigger billing updates.

  • Renewals & Overdue Payments: Automate reminders, special offers, or cancellation notices.

Best Practices for Testing and Implementation

  • Simulate Events: Use sample payloads to test webhook handling.

  • Verify Data Integrity: Ensure payloads contain all necessary fields.

  • Handle Edge Cases: Test scenarios like multiple workspace creations, plan downgrades, or cancellations.

  • Monitor Logs: Keep detailed logs of webhook receptions for troubleshooting.

  • Secure Endpoints: Validate webhook signatures to prevent unauthorized triggers.


Final Thoughts: Maximizing Webhook Utility

Webhook testing is essential for building reliable integrations. By understanding each event's trigger conditions, data payloads, and potential automation use cases, developers can create robust workflows that enhance user experience, streamline operations, and boost engagement. Regular testing, simulation, and monitoring ensure your system responds accurately and efficiently to real-time events, unlocking the full potential of the Chat Partner API.


Summary

In conclusion, mastering webhook event testing empowers you to automate and optimize your platform's interactions. Whether it's onboarding new users, managing workspace lifecycle, or handling billing changes, these events provide vital touchpoints for engaging your users and maintaining operational excellence. Keep experimenting with simulated payloads, refine your automation strategies, and leverage these insights to build a dynamic, responsive system that scales with your needs.