Global hooks
Global Hooks Guide
Follow this step by step guide on creating a global hook in Mage.
Only in Mage Pro.
Try our fully managed solution to access this advanced feature.
Step 1: Navigate to the Global Hooks UI
- Log in to your Mage account.
If you are new to Mage, follow these steps to enable Global Hooks:
- From the Dashboard UI, click Pipelines from the left navigation pane
- Once in the Pipelines UI, click click Settings from the left navigation pane
- Scroll down to view the features settings and toggle on Global Hooks
- Click on Global Hooks in the left navigation pane
- Once on the Global Hooks view, click on the ”+ Add new global hook” button.
Step 2: Configure the Hook
- Hook UUID: Enter a unique name for your hook.
- Resource Type: Select the type of resource (API call type) from the resource drop down.
- Operation Type: Select the type of operation needed for your hook.
Once the “Create new global Hook” button is clicked the rest of the configuration settings will populate.
- Targeting Conditions: Enter conditions if you want it to apply the hook to only certain pipelines. Leave this field blank to apply the hook to all pipelines.
- Before Operation Starts Toggle: Toggle to on if you want the hook to run before an operation starts.
- After Operation Completes Toggle: Toggle to on if you want the hook to run after an operation ends.
- Run if Operation Succeeds Toggle: Toggle to on if you want to hook to run only if the operation succeeds.
- Run if Operation Fails Toggle: Toggle to on if you want the hook to run if the operation fails.
- Pipeline to Execute: Select the pipeline you want to execute the hook from.
- Valid Code Snapshot: Click the “Create Snapshot of code” button to validate the pipeline code.
When making a code change to the pipeline, you have to re-validate the global hook by clicking the “Create snapshot” button
- Stop Operation if Hook Fails Toggle: Toggle on if you want to stop the operation from running if the hook fails.
- Execute Hook with History and Logging Toggle: Toggle to on if you want to log the hook’s execution, but be aware of potential performance impacts.
Toggling on the history and logging feature will significantly degrade performance of the of the operations resolution time.
- Run Hook Asynchronously: Enable this setting to run hooks asynchronously and not block the current resource operation from resolving
- Block Outputs: To select block output features, Click the ”+ Add block outputs” button
- Block to Extract Data From: If needed, select the block data will be merge from into the hook operation’s data.
- Object to Merge Block into data: If needed, select the type of data that will be merged into the hook operation’s data.
- Additional Dictionary Keys: Enter information into this field if you have nested objects in your block.
Step 3: Save and Test the Hook
- Click the “Save changes” button to update the global hook with the new configuration changes.
- To execute a global hook, perform the action or operation that matches the hook’s configured conditions, and the hook will run the designated code or pipeline based on its defined settings.
Was this page helpful?