> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neuro-tech.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Register Event Handler

> Registers (or unregisters) an event handler on the client, that gets called when the account receives an XMPP message of a given type.

## Overview

Registers (or unregisters) an event handler on the client, that gets called when the account receives an XMPP message of a given type. When such a message is received that matches a registered event handler, the message is pushed as a client event to the client, instead of being stored on the broker, as an offline message.

Note: For client events to be received on the client, you need to include the /Events.js  javascript file on the page. This javascript file will register the current tab with the server, and enable it to receive asynchronous events from the server. If you are hosting the page on one server, and use the Agent API and Events API from another server, you need to include a meta header on the page, information the /Events.js javascript file where it will register itself to receive client events. To use this neuron, add the following to the HTML header of your page:

You also need to inform the AgentAPI that you want to use another host, than the server used to host the page. You do this by making a call to AgentAPI.IO.SetHost(Host,Secure) as follows:

## Authentication

Requires a valid JWT bearer token.

## Notes

This endpoint uses the request schema notation described in [Pattern matching](/guides/pattern-matching).


## OpenAPI

````yaml /test-api/openapi.yaml post /Agent/Xmpp/RegisterEventHandler
openapi: 3.1.0
info:
  title: Neuron Agent API
  version: 1.0.0
  description: |-
    The Agent API exposes core Neuron functionality over HTTP so services can
    operate without a persistent XMPP connection. Endpoints are grouped by
    capability, starting with Accounts and XMPP messaging.
servers:
  - url: https://{host}
    variables:
      host:
        default: neuron.example.com
        description: Neuron domain issued to you.
security:
  - bearerAuth: []
tags:
  - name: Accounts
  - name: Crypto
  - name: Open intelligence
  - name: Legal and contracts
  - name: State machines
  - name: Storage
  - name: Tokens
  - name: Wallet
  - name: XMPP messaging
paths:
  /Agent/Xmpp/RegisterEventHandler:
    post:
      tags:
        - XMPP messaging
      summary: Register Event Handler
      description: >-
        Registers (or unregisters) an event handler on the client, that gets
        called when the account receives an XMPP message of a given type.
      operationId: post_Agent_Xmpp_RegisterEventHandler
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                localName:
                  type: string
                namespace:
                  type: string
                type:
                  type: string
                function:
                  type: string
                tabId:
                  type: string
              additionalProperties: true
              required:
                - tabId
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties: {}
                additionalProperties: true
              example: {}
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````