---
title: "Hooks Integration"
description: "Integrate your addon with Mumara's hook system"
url: https://campaigns.kb.mumara.com/en/articles/43-hooks-integration
collection: "Developer Guides"
updated: 2026-06-12
language: en
---

# Hooks Integration

Integrate your addon with Mumara's hook system

Hooks let your addon extend or modify Mumara Campaigns behavior without touching core files. Hook implementations live in the addon's `hooks/` directory and are loaded by your service provider's `boot()` (typically a glob over `hooks/*.php`). There are two kinds: **module hooks**, which react to application events, and **output hooks**, which inject HTML into specific page locations.

You register a callback with `add_hook('HookName', $priority, $callback)`. Module hooks include contact events (`AddContact`, `EditContact`, `DeleteContact`, `ImportList`), campaign events (`StartBroadcast`, `CompleteBroadcast`, `EmailSentPostProcess`), and tracking events (`EmailOpened`, `LinkClicked`, `EmailBouncedPostProcess`); some hooks let you return modified data. Output hooks like `HeadEnd`, `BodyEnd`, `PrimaryMenu`, and `AlertBar` return HTML strings, while `addPageHtml` can return an array with `html`, a CSS `selector`, and an `action` (`prepend`, `append`, `before`, `after`) for precise, route-conditional placement. Priority controls execution order — lower runs first (1-3 critical, 5-10 standard, 50+ logging/cleanup). Your addon can also define its own hooks for other addons via `listen_hook()` and `run_hook_in_background()`, and utilities like `hook_exist()`, `hook_get()`, and `hook_get_all()` query the registry.

Keep hook callbacks lightweight (dispatch heavy work to queued jobs), always return an empty string from output hooks when not applicable, return early when conditions don't match, and catch exceptions inside callbacks so a hook failure never breaks core flows.

📖 [**Read the full guide on docs.mumara.com →**](https://docs.mumara.com/campaigns/addons/hooks-integration)
