Kibo Webhooks API Developer Guide
Understanding Webhooks (Events) in Kibo
In Kibo, the “Event” system is the implementation of webhooks. Instead of you constantly asking the Kibo API “Has anything new happened yet?” (a process called polling), Kibo’s event system proactively tells your application when something important occurs. Think of it like subscribing to a notification. You create a Subscription that tells Kibo: “When an event of this topic happens (e.g., an order is created), send a message containing the details to this endpoint (a URL you provide).” This “push” model is incredibly efficient and is the foundation for building real-time integrations, custom workflows, and data synchronization systems.How This Domain Fits Into Kibo
The Webhooks/Events domain is the connective tissue of the Kibo platform. It allows you to decouple your custom applications from Kibo’s core services. This is useful for building scalable, event-driven architectures.- Orders: Subscribe to
order.openedto send a notification to a custom order fulfillment system. - Customer: Subscribe to
customer.account.createdto add the new user to a marketing email platform like Mailchimp. - Inventory: Subscribe to
product.instock.updateto alert staff when a popular item is back in stock. - Returns: Subscribe to
return.openedto trigger a workflow in a customer support tool like Zendesk.
Prerequisites
- Kibo API credentials and basic setup (Tenant ID, Site ID, Client ID, Shared Secret).
- A publicly accessible URL (endpoint) that can receive
POSTrequests from Kibo. Services like ngrok are excellent for local development. - Node.js 16+ with TypeScript.
- Familiarity with REST APIs and
async/await.
What You’ll Learn
After completing this guide, you’ll understand:- How Kibo structures Webhook Subscriptions and Event payloads (based on official API specs).
- The key patterns Kibo uses for event management (verified from apidocs.kibocommerce.com).
- Common workflows like creating subscriptions and debugging failed deliveries using the Dead Letter Queue (with accurate, tested examples).
- How to avoid the most common beginner mistakes.
- How to find available event topics in the official API documentation.
Kibo Webhooks Fundamentals
How Kibo Organizes Event Data
Kibo’s eventing system is built on two primary concepts:-
EventSubscription: This is the configuration object for your webhook. It defines what you’re interested in and where the notification should be sent. Key properties include:id: The unique identifier for the subscription.endpoint: The URL of your application that Kibo will send aPOSTrequest to.topics: An array of strings representing the event categories you want to subscribe to (e.g.,product.created,order.fulfilled).isActive: A boolean to easily enable or disable the webhook without deleting it.
-
Event: This is the actual data payload Kibo sends to your endpoint when a subscribed event occurs. It has a consistent wrapper that contains the specific information about what happened.
Key Kibo Patterns You’ll See Everywhere
Before we write code, understand these patterns that appear in every Kibo API: Authentication Pattern: The Kibo SDK manages authentication for you. You create a singleConfiguration object containing your credentials. This object is then passed to the constructor of the EventApi client. The client will automatically handle the OAuth 2.0 token exchange behind the scenes for every API call to manage your subscriptions.
Request/Response Structure:
When Kibo sends an event to your endpoint, it arrives as an HTTP POST request. The body of the request is a JSON object with a standard structure:
Common Webhook Workflows
Kibo developers typically work with webhooks in these scenarios:- Creating and Managing Subscriptions: Setting up new webhooks to connect Kibo to other systems.
- Processing Incoming Events: Building the server-side logic at your endpoint to handle the data Kibo sends.
- Troubleshooting Deliveries: Inspecting the Dead Letter Queue to diagnose and resolve issues with your endpoint.
Listing Event Subscriptions: The Kibo Way
When You Need This
Before creating a new webhook, you often want to see what subscriptions are already configured for your Kibo tenant. This is a simple read-only operation that helps you get an overview of existing integrations.API Documentation Reference
- Endpoint:
GET /api/event/push/subscriptions - Method:
GET - SDK Method:
getSubscriptions
Understanding the Kibo Approach
Kibo provides a straightforward endpoint to list all configured subscriptions. This allows for easy auditing and management. The response is a collection object that includes details like the endpoint URL, the subscribed topics, and whether each subscription is currently active.Code Structure Walkthrough
Before we implement, let’s understand what we’re building (based on actual API requirements):Step-by-Step Implementation
Step 1: Setting Up the FoundationWhat Just Happened? (Code Explanation)
- The setup phase created the standard
Configurationobject needed for authentication. - The API call was made using an instance of
SubscriptionApi. This client is specifically designed for managing event subscriptions and related resources. - The response handling checks if the
itemsarray in the returned collection is populated. We then loop through the results and print a formatted summary of each subscription. Atry...catchblock is used to gracefully handle any potential API errors.
Common Beginner Mistakes
Mistake 1: Looking for event logs instead of subscriptions. The Event Push API (/api/event/push/subscriptions) is for managing the webhooks themselves, not for viewing a history of every event that has fired. To debug deliveries, you check the Dead Letter Queue.
Mistake 2: Confusing Push Subscriptions with Pull Queues.
Kibo also has a Pull API (/api/event/pull) for integrations that prefer to poll for events. The EventApi SDK client manages both. Ensure you are calling the correct methods (getSubscriptions for webhooks, getEvents for pull queues). This guide focuses on the more common webhook (push) pattern.
Multiple Real-World Examples
Here are 3 complete, production-ready examples for commonWebhook operations.
Example 1: List Events in a Dead Letter Queue (DLQ)
Essential for debugging. This checks a specific subscription for any events that Kibo failed to deliver.Example 2: View Events Sent
This example shows the alternative “pull” pattern. Instead of Kibo pushing to you, your app periodically asks Kibo for any new events.Example 3: Get Events By Topic
Useful when you need to filter events to a specific topic.Troubleshooting Your Webhook Implementation
Reading Kibo Error Messages
When managing subscriptions via the API, errors are structured just like other Kibo APIs.VALIDATION_ERROR: The request body for creating/updating a subscription is invalid. This often means theendpointURL is malformed or atopicdoes not exist.ITEM_NOT_FOUND: You tried to get, update, or check the DLQ for asubscriptionIdthat doesn’t exist.REQUIRED_FIELD_MISSING: Your request to create a subscription is missing a required field likeendpointortopics.
Common Development Issues
Issue 1: My endpoint isn’t receiving any events.- Why it happens:
- The subscription is marked as
isActive: false. - Your endpoint URL is incorrect, inaccessible from the public internet, or blocked by a firewall.
- Your endpoint is returning an error status code (e.g., 500 Server Error, 400 Bad Request), causing Kibo to stop trying and place the event in the DLQ.
Disable Callbacksis enabled. If the same credentials that are generating the event, are also receiving the event, this will prevent events being emitted.
- The subscription is marked as
- How to fix it:
- Use
getSubscriptionDetailsto verify the subscription is active and the URL is correct. - Use a tool like
ngrokto expose your local development server to the internet for testing. - Check the Dead Letter Queue! Use the
checkDeadLetterQueueexample function. This is the most important debugging step. - Ensure your endpoint returns a
2xxstatus code (e.g.,200 OKor202 Accepted) immediately upon receiving an event.
- Use
topics are available to subscribe to?
- Why it happens: The list of available event topics is extensive and not immediately obvious from the API endpoints for managing subscriptions.
- How to find it: The Kibo documentation maintains a list of all available events. Always refer to the official documentation for an up-to-date list before creating a subscription. Creating a subscription with a non-existent topic will result in a
VALIDATION_ERROR. - Reference: Search for “Kibo Event Topics” on the official Kibo documentation site.
Debugging Checklist
When your webhook implementation isn’t working:- Verify Subscription: Is the subscription
isActive? Is theendpointURL publicly accessible and correct? - Check the DLQ: Is Kibo trying to send events but failing? Use
getDeadLetterEventswith yoursubscriptionIdto find out. This is your primary diagnostic tool. - Inspect Endpoint Logs: Is your server receiving the
POSTrequest from Kibo? Is it throwing an unhandled exception? - Confirm Response Code: Is your endpoint code always returning a
200 OKresponse, even if your internal processing fails? Acknowledge receipt first, then process. - Validate Topics: Does the topic you subscribed to (
order.opened) actually exist in the Kibo documentation? - Check API Credentials: Are your API calls to manage subscriptions failing? Double-check your
Configurationobject for correct credentials.

