Encoding Customer IDs for Gamify Campaigns

When linking to Gamify (formerly Adact) campaigns, you might use a URL structure that includes a customer ID in plain text. For enhanced security and to prevent users from easily substituting other IDs, you can encode the customer ID before it's passed in the URL.

This guide walks you through creating a dedicated Data Connection via an API call. This connection will use the Gamify JWT Generator to automatically encode customer IDs, which you can then use in your campaign links.

Prerequisites

Before you begin, ensure that a mapping is already configured in Opti-X for your tenant ID. This mapping links an Opti-X brand to your Optimove tenant.

If this mapping is not in place, please contact your Customer Success Manager to have it enabled.

Step 1: Get Your API Credentials

First, you'll need to retrieve your API and Brand keys to authenticate the request.

  1. Log in to Opti-X and select the brand associated with the tenant you're working on.
  2. Navigate to the Developer Tools section and find the API Keys tab.
  3. Copy the x-api-key and x-brand-key values. You'll need these for the next step.
A placeholder image showing the API Keys screen in Opti-X Developer Tools

API and Brand keys from Developer Tools

Step 2: Create the Data Connection

Next, you will execute a cURL command to create the Data Connection in Opti-X. This command defines an external API call to the Gamify JWT Generator service.

Execute the following command in your terminal, replacing API-KEY and BRAND-KEY with the values you copied in the previous step.

curl --request POST \
  --url [https://api.opti-x.optimove.net/api/data-connections/v1/connections](https://api.opti-x.optimove.net/api/data-connections/v1/connections) \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: API-KEY' \
  --header 'x-brand-key: BRAND-KEY' \
  --data '{
	"name": "Gamify JWT Generator DC",
	"primary_key": "customerId",
	"description": "DC to call the Gamify API to generate an encoded JWT",
	"externalApiDetails": {
		"url": "[https://functions-lb-prod-eu.optimove.net/adact-jwt-generator-prod-eu](https://functions-lb-prod-eu.optimove.net/adact-jwt-generator-prod-eu)",
		"http_method": "POST",
		"headers": {},
		"body": {
			"payload": {
		  	"cid": "{customerId}"
		  }
		},
		"sample_placeholder_values": {
			"customerId": "10194489"
		},
		"timeout": 30,
		"ttl": 3600,
		"retries": 1
	}
}'

 

Step 3: Verify the Data Connection

After successfully executing the command, you can verify that the Data Connection was created.

In the Formula Builder modal, the new "Gamify JWT Generator DC," should now appear in the dropdown list of available Data Connections.

The output formula should look similar to this: [%DC_245708d5-aede-402d-a58c-d9ef0f59c977:[%CUSTOMER_ID%]::base64:%].

Use Case: Building an Encoded Campaign Link

Now you can use the Data Connection formula to build secure Gamify campaign links.

  • Before: https://brand.adact.me/campaign?cid=[%CUSTOMER_ID%]
  • After: https://brand.adact.me/campaign[%DC_245708d5-aede-402d-a58c-d9ef0f59c977:[%CUSTOMER_ID%]::base64:%]

When a campaign is executed, Optimove will call the Data Connection, which sends the CUSTOMER_ID to the JWT Generator. The service returns the encoded JWT, which is then inserted into the URL in place of the formula. This ensures the customer ID passed to your Gamify campaign is securely encoded.