bitrix-events

Publish and handle Bitrix events across modern and legacy APIs.

33|3|Updated Jun 5, 2025
One-click install
npx skills add https://github.com/bxmaximum/bitrix_ai_challenge --skill bitrix-events
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bitrix-events
Source: https://github.com/bxmaximum/bitrix_ai_challenge/tree/main/.agents/skills/bitrix-events
Command: npx skills add https://github.com/bxmaximum/bitrix_ai_challenge --skill bitrix-events

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Bitrix developers face fragmentation between new event-driven architecture and legacy hooks, making integration across modules error-prone and hard to maintain. This Skill provides a unified approach to publish and handle events across Bitrix's two event models, enabling consistent lifecycle management and cross-module communication.

Core Features & Use Cases

  • Supports the modern Bitrix event system (Event, EventResult) for custom events.
  • Supports legacy OnBefore/OnAfter hooks for compatibility and gradual migration.
  • Provides guidance on creating, registering and consuming events across modules to ensure decoupled architectures and reliable integrations.
  • Use Case: When integrating two custom modules, publish a PostCreated event and react to it with a notifier, with error-safe handling and proper registration.

Quick Start

Create and publish a custom PostCreatedEvent, then register a handler to respond to it.

Frequently Asked Questions about bitrix-events

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle Bitrix events across custom modules using the modern API?

You handle Bitrix events across custom modules by using Bitrix\Main\EventManager to register handlers and dispatch events via the Bitrix\Main\Event class. This approach ensures decoupled module communication with structured EventResult processing and error handling.

What is the best way to migrate legacy OnBefore and OnAfter hooks to the Bitrix event system?

The best way to migrate legacy OnBefore and OnAfter hooks is to use a unified architecture that supports both legacy hooks and modern Bitrix\Main\Event dispatching, enabling gradual migration while maintaining reliable cross-module communication.

Does this approach support both modern Bitrix\Main\Event and legacy event hooks simultaneously?

Yes, this approach supports both modern Bitrix\Main\Event and legacy OnBefore/OnAfter hooks simultaneously. It provides a unified method to publish and consume events, ensuring compatibility and error-safe integration across custom modules during gradual migration.

How do I publish a custom event in Bitrix and register a handler in another module?

To publish a custom event in Bitrix and register a handler in another module, create a custom event using Bitrix\Main\Event, dispatch it from the source module, and use EventManager to register a consuming handler in the target module to achieve decoupled, error-safe communication.

Why does my Bitrix event handler not trigger across different custom modules?

Your Bitrix event handler may not trigger across custom modules due to improper handler registration with EventManager or missing error handling during dispatch. Ensure you correctly register the handler and enforce proper use of Bitrix\Main\Event for reliable cross-module propagation.