---
schema_version: "1"
id: fca6fefc5becc7f624db65b937d3ee46ce4919e4a7b5887afcc4a39f83edd76d
title: Create Hooks for Odin Notification Handlers
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_create_hooks_for_odin_notification_handlers.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_create_hooks_for_odin_notification_handlers.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 9fc3c9ce623aa63a797e1dd1a9b0daa1c81fedcfa7e6a95aa536cdc5fe95eece
description: Odin Notification Handler APIs provide an option to let you write custom pre and post-hooks for each API to implement custom logic.
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# Create Hooks for Odin Notification Handlers

Odin Notification Handler APIs provide an option to let you write custom pre and post-hooks for each API to implement custom logic.

Pre-hooks execute before the actual handler API executes. Post-hooks execute after the actual handler API executes.

Here is an example of how to write a hook for an Order Item Assetize Notification:

1. Write the custom class to implement the pre and post-hook.
    
    Here is sample code for an Order Item Assetize hook:
    
    ```
    global with sharing class OdinOIAssetizeHandlerHookImplementation implements vlocity_cmt.VlocityOpenInterface
    {
        global Boolean invokeMethod(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) 
        {
    
            if( methodName.equalsIgnoreCase('processNotifications.PreInvoke')) {
                processNotifications_PreInvoke(methodName, input, output,options);
                return true;
            }
    
            if( methodName.equalsIgnoreCase('processNotifications.PostInvoke')) {
                processNotifications_PostInvoke(methodName, input, output,options);
                return true;
            }
    
            return false;
    
        }
    
    
        private void processNotifications_PreInvoke(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) {
            //This method gets called before processNotifications
            List<Object> notificationList = (List<Object>) input.get('notificationList');
            List<Map<String, Object>> notifMapList = convertToListOfMap(notificationList);
            for (Map<String, Object> oneNotifMap : notifMapList)
            {
                //Write your logic here
            }
        }
    
    
        private void processNotifications_PostInvoke(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) {
            //This method gets called after processNotifications
            List<Object> notificationList = (List<Object>) input.get('notificationList');
            List<Map<String, Object>> notifMapList = convertToListOfMap(notificationList);
            for (Map<String, Object> oneNotifMap : notifMapList)
            {
                //Write your logic here
            }
        }
    
        private List<Map<String, Object>> convertToListOfMap(List<Object> notificationList) {
            List<Map<String, Object>> notificationMapList = null;
            if (notificationList != null) {
                notificationMapList = new List<Map<String, Object>>();
                for (Object oneNotifObj : notificationList) {
                    notificationMapList.add((Map<String, Object>) oneNotifObj);
                }
            }
            return notificationMapList;
        }
    }
    ```
2. Create the interface implementation:
    
    - From the App Launcher, click Interface Implementations.
    - Click New.
    - In the **New Interface Implementation** dialog, enter the following:
        
        - **Interface Name**: OdinOrderItemAssetizeHandlerHookInterface
        - **Active Implementation Class**: OdinOIAssetizeHandlerHookImplementation
    - Click Save.
        
        ![OrderItem](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-comms_media_energy_managed-264-0-0-production-enus/ff4079f6-a384-475c-b863-578bbbb0ef9b/resources-product/images/odininterface1.png)
3. Create the interface implementation detail:
    
    - Click the Related tab for your newly created OdinOrderItemAssetizeHandlerHookInterface interface implementation.
    - Beside **Interface Implementation Detail**, click New.
    - In the **New Interface Implementation Detail** dialog, enter OdinOIAssetizeHandlerHookImpl for the **Available Implementation**.
    - Click **Active** to make this implementation the active implementation.
    - Click Save.
        
        ![Interface Implementation Detail](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-comms_media_energy_managed-264-0-0-production-enus/ff4079f6-a384-475c-b863-578bbbb0ef9b/resources-product/images/odininterface2.png)