Configuring Extensions

Objective

After completing this lesson, you will be able to configure Extensions to perform custom logic using synchronous server-side custom code.

Configuring Extensions

Enhancing SAP Customer Data Cloud with Extensions

Extensions complement SAP Customer Data Cloud webhooks and JavaScript parameters to form a powerful extensibility suite. Unlike client-side parameters or asynchronous webhooks, extensions execute securely on the server, synchronously, allowing you to enforce policies, validate data, and perform lightweight enrichment right before SAP CDC writes data or finalizes a session.

Using Extensions, you can meet a wide range of business use-cases, such as:

  • Save updated data from a third-party system to a user's profile
  • Prevent a user from registering with an abusive username
  • Prevent a user from registering with a disposable email address
  • Validate that zip codes match country and state provided
  • Send SAP Customer Data Cloud SMS messages via any provider you choose, and customize the message received by users

Supported API Extension Endpoints

Knowing which endpoints support extensions tells you exactly where your code can act—these are the precise touchpoints to enforce policies, enrich data, or block the operation at critical moments in registration, login (including social), and profile updates.

The following API extension hooks are supported in SAP Customer Data Cloud:

  • OnBeforeAccountsRegister: Triggered within the accounts.register API, right after SAP CDC runs all validation checks required for creating the user in the database and right before creating the user.
  • OnBeforeAccountsLogin: Triggered during accounts.login, right after SAP CDC runs the validation checks that are required for logging the user in.
  • OnBeforeSocialLogin: Triggered during socialize.login, right after SAP CDC runs the validation checks that are required for logging the user in.
  • OnBeforeSetAccountInfo: Triggered during accounts.setAccountInfo, immediately before account data is written to the database.
Diagram showing four connected events in a vertical flow: OnBeforeAccountsRegister, OnBeforeAccountsLogin, OnBeforeSocialLogin, and OnBeforeSetAccountInfo, linked by circles and lines.

Configuring Extensions

Now that you know which API extension hooks are available, here are the high-level steps to attach your hosted function to the right hook and configure its runtime behavior in SAP Customer Data Cloud.

  1. Host your custom function (HTTPS POST endpoint) on your servers or in the cloud.
  2. In SAP Customer Data Cloud, choose the specific flow (extension hook) to attach it to.
  3. Provide the endpoint URL, set the timeout (default 1000 ms; allowed 10–5000 ms).
  4. Optionally add custom HTTP headers (key–value) to pass context (IDs, flags) downstream.
  5. Save and test to ensure the hook executes within the timeout and behaves as expected.

Managing Extensions

After learning how to configure extensions in the Console, the next step is to manage them programmatically with REST APIs—controlling lifecycle, fallback behavior, and settings at scale.

  • Use the following REST APIs to manage the extension lifecycle:
    • accounts.extensions.create
    • accounts.extensions.delete
    • accounts.extensions.get
    • accounts.extensions.list
    • accounts.extensions.modify
    List of five REST API endpoints for accounts extensions management: accounts.extensions.create REST, accounts.extensions.delete REST, accounts.extensions.get REST, accounts.extensions.list REST, and accounts.extensions.modify REST.
  • Configure a fallback policy for failures (timeout, returned error, or technical error):
    • IgnoreAllErrors (default): The flow continues; errors are logged.
    • FailOnAnyError: The flow stops to ensure no one bypasses extension logic.
  • Scope and Constraints:
    • Supported only for fully registered user accounts (not Lite Accounts).
    • One extension per extension type, per site (or parent site for site groups).
    • Fields with null values are not sent.
  • Request/response and hosting:
    • Your custom code must be hosted at a designated HTTPS URL.
    • SAP CDC calls your endpoint via HTTPS POST and sends JSON.
    • You can reuse the same code/URL and branch logic per extension point so that you need only host one piece of code on one designated URL.
  • User messaging and localization:
    • Extensions can return custom messages to users, including per-language variants.
  • Implementation detail:
    • In your code, refer to the user’s email as email (not profile.email).

Extension Payloads and Responses

With extensions configured and manageable via REST, the next step is understanding the request/response contract—what payloads SAP CDC sends to your endpoint and how your responses (OK, FAIL, ENRICH) drive the flow.

Payloads are the extension request parameters. The payload contains common parameters and different parameters per each endpoint. The common payload for all the extension requests are the shared parameters that are always sent from SAP Customer Data Cloud when posting to the URL.

Documentation of SAP CDC's HTTPS POST request structure showing JSON format with base-64 encoded JWS parameter, example payload with apiKey and extensionPoint fields, and expected HTTP 200 OK response format with JSON status message.

Response indicating that SAP Customer Data Cloud should proceed as usual with the registration process:

Code Snippet
12345
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "status": "OK", }

Response indicating that the registration should be failed:

Code Snippet
1234567891011121314
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "status": "FAIL", "data": { "validationErrors" : [ { "fieldName": "string of up to 200 characters", "message": "custom error message the user will see" } ] } }

Response when the status is set to ENRICH:

Code Snippet
12345678910
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "status": "ENRICH", "data": { "profile": {"firstName": "extensionFirstName"}, "data": {"dataField1": "dataField1"} } }

Debugging and Monitoring Extensions

Use the Extensions > Logs view to monitor and troubleshoot every SAP Customer Data Cloud extension call. It provides quick filters, clear status indicators, and key details (timestamp, duration, data center, hook, message) so you can verify behavior, investigate failures, and validate fallback policy outcomes.

  • View extension calls logged over the last 7 days (up to 1,000, newest first)
  • Filter by time range, extension point, or call ID
  • Identify status using icons: allowed (valid), malformed/timeout (policy-dependent), blocked (valid stop)
  • Review details for each entry: timestamp, duration, data center, extension point, and returned message

Summary

  • Server-Side Extensibility: SAP CDC Extensions execute synchronously on the server to enforce policies, validate data, and enrich user profiles before SAP CDC writes or finalizes any operation.
  • Supported Hooks: Four interception points — OnBeforeAccountsRegister, OnBeforeAccountsLogin, OnBeforeSocialLogin, and OnBeforeSetAccountInfo— allow custom logic to run immediately after SAP CDC validation and before data is committed.
  • Configuration and Management: Extensions are bound to a hook via the SAP CDC Console or REST APIs, with configurable timeouts and a fallback policy (IgnoreAllErrors or FailOnAnyError) to control failure behavior.
  • Responses and Monitoring: Endpoints return OK, FAIL, or ENRICH responses, and all calls are logged in the SAP CDC Console for up to 7 days for debugging and monitoring.