Setting Up m3sh Webhook Triggers - m3ter Documentation

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

The m3sh Webhook Triggers capability in the m3ter Connector for Salesforce managed package offers Salesforce administrators a declarative, no-code solution to send Salesforce record data to m3sh Workflows via webhook endpoints. This topic explains how to set up and work with the m3sh Webhook Triggers feature:

Important!

Overview

The m3sh Triggers feature is built on top of the existing custom metadata framework developed for the m3ter Connector. Three distinct integration patterns are supported:

All three patterns leverage the same underlying webhook delivery infrastructure, ensuring consistent behavior, authentication, payload formatting, and execution logging across all integration methods.

Prerequisite Configuration

There is some prerequisite configuration you’ll need to perform in your Salesforce Org before creating and deploying m3sh Webhook Triggers:

Enabling m3sh Webhook Triggers

In order to create m3sh Webhook Triggers for your m3ter Connector for Salesforce, you must first enable them in the m3ter Admin App. To enable m3sh webhook triggers:

  1. In your Salesforce Org, navigate to Setup > Custom Settings > m3 Org Settings > Manage > Edit:

  2. Check the Enable m3sh Triggers box and then select Save.

Configuring Remote Site Settings

The m3sh Webhook Triggers feature will make callouts to your m3ter Organization, which means you must configure a remote site setting for m3sh Webhook endpoints. To create a remote site setting for m3sh Webhook endpoints:

  1. In your Salesforce Org, navigate to Setup > Security > Remote Site Settings:

  2. Under Remote Site Settings > Remote Site Details enter these settings for the m3ter Webhook endpoint:

    • Remote Site Name: m3ter_Webhook
    • Remote Site URL: https//< _m3ter_Org_ID_ >>.webhook.m3ter.com
    • Active: TRUE

Creating m3sh Webhook Triggers

When you’ve enabled the m3sh Webhook Triggers feature for the m3ter Admin App in your Connector for Salesforce, you can create m3sh Webhook Triggers. To create a m3sh webhook trigger:

  1. In your Salesforce Org, navigate to the m3ter Admin app.

  2. Under Setup, select the m3sh Triggers tab:

  3. Select Create New Trigger. The tab adjusts and you can enter the details of the new Trigger:

Tip: m3sh Webhook Trigger naming? A composite name is given to a new m3sh Webhook Trigger using the Salesforce object selected followed by a dash followed by the name of the target m3sh Workflow selected - in the above example: Account - Amazing m3sh Workflow. You can update the name as required.

  1. Select Create. The new m3sh Trigger is saved:
    • Note that if you want to review or edit an active m3sh Webhook Trigger, you can return to the m3sh Triggers tab and use the Active drop-down to select the Trigger:

Testing Active m3sh Webhook Triggers

You can run a test of an active m3sh Webhook Trigger. To test an active m3sh trigger:

  1. In your Salesforce Org, navigate to the m3ter Admin app.

  2. Under Setup, select the m3sh Triggers tab.

  3. In the Active drop-down list, select the m3sh Webhook Trigger. The Trigger configuration is shown and you can read-off:

    • The Salesforce Object the Trigger is configured to transfer data for.
    • The Status of the Trigger.
    • The Webhook URL defined for the Trigger.
  4. Select Test. A Test Webhook modal opens:

  5. On the modal, select the Account you want to run the test for, and then select Run Test:

Note! Please be aware that Test runs will trigger the m3sh Workflow as normal.

Implementation Notes

This section provides further guidance on successfully implementing the m3sh Webhook Triggers feature for your m3ter Connector for Salesforce managed package:

Adding Webhooks as Triggers for m3sh Workflows

m3sh Workflows in m3ter can be configured to use different types of Trigger, including webhooks. In addition to the setup required in your Salesforce Org when implementing the m3sh Webhook Triggers feature, you must also ensure a corresponding webhook is configured in the m3ter Console as the Trigger for the target m3sh Workflow. The correct credentials set up is necessary for the webhook you configure as a Trigger for the m3sh Workflow. Therefore please ensure that when setting up the webhook Trigger for the m3sh Workflow, the integration credentials used match those of the service user used to set up the sync between the m3ter Connector for Salesforce managed package and m3ter, that is, the integration credentials in the managed package.

Implementation Patterns - Options

Once a m3sh Webhook Trigger has been successfully configured and tested, you are ready to implement it in your process. Three different implementation patterns are available.

Salesforce Flows

The invocable action has two required inputs:

Note: Because the Invocable Action makes callouts, it needs to be added to an Asynchronous Path.

Apex

// Trigger delegation pattern
trigger AccountTrigger on Account (after insert, after update) {
    AccountTriggerHandler.handleAfterInsertUpdate(Trigger.new, Trigger.oldMap);
}

// Trigger Handler class
public class AccountTriggerHandler {

public static void handleAfterInsertUpdate(List<Account> newRecords, Map<Id, Account> oldMap) {
        if (Trigger.isInsert || (Trigger.isUpdate && needsSync(newRecords, oldMap))) {
            Set<Id> recordIds = new Map<Id, Account>(newRecords).keySet();
            sendToWebhookAsync(recordIds, 'Account_Realtime_Sync');
        }
    }

@future(Callout=true)
    public static void sendToWebhookAsync(Set<Id> recordIds, String configDeveloperName) {
        // Note: In subscriber orgs, use the namespace prefix 'm3' before class names
        // Example: m3.M3shSendWebhookService for production installations

m3.M3shSendWebhookService.M3shWebhookRequest request = new m3.M3shSendWebhookService.M3shWebhookRequest();
        request.configDeveloperName = configDeveloperName;
        request.recordIds = new List<Id>(recordIds);

List<m3.M3shSendWebhookService.M3shWebhookResult> results =
            m3.M3shSendWebhookService.sendToWebhook(new List<m3.M3shSendWebhookService.M3shWebhookRequest>{ request });

if (!results.isEmpty() && !results[0].success) {
            System.debug(LoggingLevel.ERROR, 'Webhook failed: ' + results[0].message);
        }
    }

private static Boolean needsSync(List<Account> newRecords, Map<Id, Account> oldMap) {
        // Implement your logic here
        return true;
    }
}

Scheduled Apex Jobs

For a configured m3sh Webhook Trigger, you can to set up scheduled Apex jobs to periodically send records to the m3sh Webhook:

After selecting a Run Interval - available options are every 15 mins, every 30 mins, or every hour - select Enable Scheduled Runs:

With this feature enabled the m3ter Connector for Salesforce managed package will, for every configured m3sh Webhook Trigger:

Monitoring Execution Logs

To aid debugging and monitoring of the callouts made to m3sh Workflows, a new object and tab has been added to the m3ter Connector for Salesforce managed package. This new tab in the m3ter Admin App is called m3sh Execution Logs:

Each time a callout is made, the request payload, the response, and HTTP Status code is logged, along with other useful information like the Execution Type and name of the CMDT Config. The possible values for the Execution Type are listed below: