Skip to content
Community Hub
  • Login
  • Site
  • Search
  • User

x Want to ask a question or reply? Click here to join the group.
Sage CRM
  • Sage Global Solutions

Sage CRM

Welcome to the Sage CRM Support Group on Community Hub! Available 24/7, the forums are a great place to ask and answer product questions, as well as share tips and tricks with Sage peers, partners, and pros.
Example Components & Developer Resources Implement Webhooks
  • Forums
  • Blogs
  • Videos
  • Members
  • Resources
  • More
  • Cancel
LinlsCount:0
  • Ask a question
  • -Example Components & Developer Resources
    • +Sage CRM 2025 Components
    • +Sage CRM 2024 Components
    • +Sage CRM 2023 components
    • -Sage CRM Labs
      • Enable Quote Templates
      • Hide Top Menu
      • Implement Webhooks
      • My Companies My Persons
      • Quick Configuration
      • Sticky Buttons

Implement Webhooks

Webhooks Component – Summary

The Webhooks component for Sage CRM adds the ability to automatically send outbound HTTP requests (webhooks) to external systems when specific CRM events occur — such as when a company is updated or a case is created. This enables real-time integration between Sage CRM and third-party platforms like ERP systems, marketing tools, or messaging services.


What This Component Does

Once installed, the Webhooks component allows System Administrators to:

  • Define Webhook Target Systems, including optional authentication (Basic Auth or API Key).

  • Define Webhook Event Targets, which specify:

    • The event type (e.g. company.update)

    • The endpoint URL that should receive the webhook

  • Automatically trigger webhooks from Table Level Scripts using the provided helper functions.


Admin Interface

After installation, new admin pages will appear under:

Administration > Advanced Customization > Web Hook Configuration, including:

  • Webhook Target Systems – where you define:

    • Target system name

    • Authentication method:

      • None

      • Basic Authentication (username + password)

      • API Key (header name + key value)

  • Webhook Event Targets – where you specify:

    • The event type (e.g. company.update)

    • The target URL (full endpoint to receive POST request)

    • A link to the associated target system

These configuration pages make it easy to manage and review all webhook integrations in one place.

Manual Step Required – Registry Key

The Webhooks feature uses a shared script file for helper functions. To enable this, you must create a new registry key:

Path:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\eWare\Config\YourCRMInstance

Name:
ScriptCommonFunctions

Type:
String

Value:
Labs25Webhooks\webhookcommon.js

This tells Sage CRM to load the helper functions automatically for use in Table Level Scripts.


Note for Sage CRM Implementations Integrated with Sage 300

If your Sage CRM system is integrated with Sage 300, the registry key ScriptCommonFunctions may already exist.  It was used by older versions of the Sage 300 integration to load custom script files.

To enable the Webhooks component, you must ensure that the registry key:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\eWare\Config\<YourCRMInstance>

…includes the following value:

ScriptCommonFunctions = Labs25Webhooks\webhookcommon.js

If ScriptCommonFunctions already exists:

Update its value to Labs25Webhooks\webhookcommon.js.

If other components rely on a previous file, you will need to merge the relevant functions from both scripts into a single shared file and point the registry key to that merged file.

Only one file path is supported in the ScriptCommonFunctions key, so this update is essential for the Webhooks feature to work.


Helper Functions in webhookcommon.js

The webhookcommon.js file contains reusable functions to simplify the use of webhooks in your scripts:

  • log(message) – Simple logger

  • Base64Encode(str) / Base64Decode(str) – Base64 helpers

  • customStringify(obj) – JSON-safe stringifier

  • getBasicAuthHeader(username, password) – Builds Basic Auth header

  • getBasicAPIKeyAuthHeader(key) – Builds API Key header

  • sendWebhookRequest(endpoint, authHeader, payload) – Sends HTTP POST and returns status + response


Example Table Level Script

You can add the following to a Company Table Level Script:

function InsertRecord() {
    // Handle insert logic
}

function PostInsertRecord() {
    // Handle post-insert logic
}

function UpdateRecord() {
    var whtsRecord = CRM.FindRecord("WebhookTargetSystem, vWebhookTargetSystem", "whts_systemname = 'WebHook TestSite'");

    var authHeader;

    if (whtsRecord.whts_authmethod == 'Basic') {
        log("Basic Authorization");
        var username = whtsRecord.whts_username;
        var password = whtsRecord.whts_password;
        authHeader = getBasicAuthHeader(username, password);
    }
    if (whtsRecord.whts_authmethod == 'APIKey' && whtsRecord.whts_apikeyheader == "Authorization") {
        log("API Key Used");
        var apikeyvalue = whtsRecord.whts_apikeyvalue;
        authHeader = getBasicAPIKeyAuthHeader(apikeyvalue);
    }

    var whetRecord = CRM.FindRecord("WebhookEventTarget, vWebhookEventTarget", "whet_eventtype = 'company.update' and whet_webhooktargetsystemid = " + whtsRecord.whts_targetsystemid);
    var endpoint = whetRecord.whet_targeturl;

    var payload = {
        companyName: Values("comp_name"),
        companyType: Values("comp_type")
    };

    var apiResponse = sendWebhookRequest(endpoint, authHeader, payload);

    log("Payload Sent: " + customStringify(payload));
    log("HTTP Status: " + apiResponse.status);

    if (apiResponse.error) {
        log("Request FAILED: " + apiResponse.text);
    } else {
        log("Request Succeeded. Response:");
        log(apiResponse.text);
    }
}

function DeleteRecord() {
    // Handle delete logic
}

Uninstalling the Webhooks Feature

To uninstall the component:

  1. Re-run the component installer and select Uninstall.

  2. This will remove the Web Hook Configuration screens from the CRM interface.

  3. Then, manually remove the registry key from the CRM instance registry path: ScriptCommonFunctions = Labs25Webhooks\webhookcommon.js

This will fully disable the Webhooks feature and return the system to its previous state.

  • Share
  • History
  • More
  • Cancel
Recommended
Sage
Africa & Middle East Canada France Portugal Spain United Kingdom & Ireland United States Global Solutions
  • facebook
  • instagram
  • linkedin
  • youtube
COMMUNITY
  • Site help
  • Site map
COMPANY
  • Overview
  • About us
  • Careers
  • News
  • Sage events
  • Investors
  • Sage Foundation
PARTNERS
  • Sage Partner Program
  • Partner Hub
  • Developers & ISVs
  • Sage Marketplace
SUPPORT & TRAINING
  • Contact Support
  • Sage Knowledgebase
  • Sage University
  • Sage Advice Blog
  • © Sage Group plc 2024
  • Privacy
  • Cookies
  • Community guidelines
  • General data protection regulation

*Community Hub is the new name for Sage City