Test Server-side Personalization Experience

MoEngage recommends testing your experience after publishing it to ensure the API integration is set up correctly.

Test serverside SS.png

Build Authorization Header

Use the Workspace ID and API Secret to generate an HTTP Auth Header, as explained in the Authentication section in the Personalize API article.

Copy Request

You can also copy the sample request in any of the supported languages from the Test Experience section in the dashboard and test it on an external console using the copy to clipboard icon.

Copy Workspace ID

The request header MOE-APPKEY should contain the Workspace ID value of your MoEngage Account. 

Attributes

The following attributes need to be passed in the request:

Request Field

Mandatory

Description

app_id

Yes

This is the Workspace ID of your MoEngage Account. The Workspace ID uniquely identifies your MoEngage workspace.

Authorization

Yes

This is the Base64 encoded authorization header (WorkspaceID: APISECRET) that needs to be passed for authentication.

user_id

No

This field is provided by your brand and should be pasted in the request. This field is the Client ID and identifies the user to whom the personalized content is to be shown. This is essential for event mapping back to the user. 

If an Invalid User ID or non-existent User ID is shared and the API request has valid recipient details, a new user profile will be created with valid recipient details.

If user_id is not present in the request, the request will still be processed by considering the value of the visitor_id field. If the value for the visitor_id field is not present in the request, the events will not be logged to any user in MoEngage.

visitor_id

No

This field is provided by the MoEngage SDK and should be pasted in the request if there is no unique id associated with the user. This is generally used for users who have visited your website in the past but have not logged in or created an account on your website.

The value for a unique id can be fetched, as explained here

experience_key

Yes

This field is used to uniquely identify each server-side experience created using MoEngage Personalize. You can pass multiple values in a single request and receive the personalized content defined for each experience in the response.

platform

No

This field identifies the platform used by the visitor to engage with your brand. Accepted values - web, mweb, android, ios

DAY_OF_THE_WEEK

No

This field must contain the day of the week for evaluating IN-session attribute-based experiences. Accepted values - Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday

TIME_OF_THE_DAY

No

This field must contain the time of the day for evaluating IN-session attribute-based experiences. Accepted values - 00, 01, 02, 03, 04, 05, 06, 07,….., 23
00 stands for the period between 12 AM - 1 AM; 01 stands for the period between 1 AM - 2 AM and so on.
Example: For a time interval between 7 PM - 11 PM, the input for this field should be “19,20,21,22”

USER_IP_ADDRESS

No

This field must contain the user’s IP address for evaluating geo-location-based experiences.

USER_AGENT

No

This field must contain the USER-AGENT HTTP header. This is essential to deliver personalized content based on in-session attributes like Device Type.

User identification for fetching personalized content

The API processes the user identity information shared in the request and identifies the user to whom the communication needs to be sent, as shown below.

Server-side.png

Once all the necessary information is added to the request, send the request from the external console.

Testing the request in Postman

To test in Postman, do the following:

  1. Click on the copy & open Postman icon to copy the cURL and import it in Postman. 

    • Add the authentication details by using the authorization section. Add the Workspace ID as the username and the API Key as the password.

    • The imported cURL will contain the payload details. Copy the experience key and update it in the respective field. Add the authorization header and other attributes.

    • Click on Send in Postman. This will send the request to the Fetch Personalize API.

For information about responses, error codes, and sample responses, refer to Fetch API Response.

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?