Making Webhook Calls

Oracle Marketing Cloud - Universal Webhook Connector for Unity App Feature

To make a webhook call using the Universal Webhook Connector app for Unity, you need to configure your external system to send calls to the Inbound Webhook created in Step 5 of adding inbound webhook calls. While each external system will vary slightly, this page should provide some useful information to help you get started.

Basic Authentication

This method is likely the simplest method if generating your own API calls. Basic authentication uses an encoded version of the familiar username and password in the header of the calls. Check out this article for more information on configuring calls using basic authentication.

Webhook Signature

This method is most commonly used when integrating and sending directly from the external system (e.g., commerce platform, CRM, etc.). However, you can also use this method with a custom implementation.

Configuring Webhooks in External Systems

The Universal Webhook Connector app has been tested using the below systems. However, if you are interested in using a different system, email us at [email protected] and we will look into adding it.

Oracle Commerce Cloud
Shopify
WooCommerce

Webhook Custom Implementation

First, generate a signature:

  1. Start with the request body.
  2. Hash the request body using SHA256.
  3. Base64 encode the hash.

Then, on your request, include a header with "x-r1-content-hmac-sha256" as the key and the generated signature as the value.

String algorithm = "HmacSHA256"; // Use this algorithm for use with the header x-r1-content-hmac-sha256
String token = "1571b9d1-8455-4f58-830c-53973ad7c472"; // The token provided by the app
String body = "{\"email\":\"[email protected]\"}"; // The body of your request

SecretKey secretKey = new SecretKeySpec(token.getBytes(), algorithm); //javax.crypto.SecretKey, javax.crypto.spec.SecretKeySpec
Mac mac = Mac.getInstance(algorithm); // javax.crypto.Mac
mac.init(secretKey);
byte[] hashedBody = mac.doFinal(body.getBytes()); // Generate a hash of the body. Note that whitespace matters.
System.out.println("hashedBody: " + Arrays.toString(hashedBody)); // [-17, -72, -125, -45, -119, 62, 42, -2, 123, -25, 22, -39, 126, -126, 35, 29, -88, 77, 15, -126, 43, -104, -67, 37, 56, -73, 110, -64, 71, 0, -74, 25]
String signature = Base64.getEncoder().encodeToString(hashedBody); // Encode the hash using Base 64. The result is the signature
System.out.println("signature: " + signature); // 77iD04k+Kv575xbZfoIjHahND4IrmL0lOLduwEcAthk=