Create Event
This API allows you to track the actions of a user.
- You cannot use “moe_” as a prefix while naming events, event attributes, or user attributes. It is a system prefix and using it might result in periodic blacklisting without prior communication.
- Following are the valid moe_os_type accepted in Moengage:
- For RokuTV, moe_os_type should be ROKU.
- For LGTV, moe_os_type should be WebOS.
- For AndroidTV, moe_os_type should be AndroidTV.
- For AppleTV, moe_os_type should be tvOS.
- For SamsungTV, moe_os_type should be Tizen.
- For FireTV, moe_os_type should be FireOS.
- For VizioTV, moe_os_type should be VizioTV.
- For Xbox, moe_os_type should be Xbox.
- MoEngage generates Current_time and User_time if they are not provided in the request. Use the following information and provide Current_time, User_time, and User_timezone_offset accordingly:
- If you don’t provide any of Current_time, User_time, and User_timezone_offset, MoEngage automatically uses the UTC time when the request was received by MoEngage as the Current_time. MoEngage uses internal data to calculate the User_timezone_offset to generate the User_time.
- If you provide only the Current_time, MoEngage uses internal data to calculate the User_timezone_offset to generate the User_time.
- If you provide only the User_time, MoEngage uses internal data to calculate the User_timezone_offset to generate the Current_time.
- If you send the Current_time and User_time, MoEngage uses them as is.
- If you provide the Current_time and User_timezone_offset, MoEngage generates the User_time.
- If you provide User_time and User_timezone_offset, MoEngage generates the Current_time.
Example Payload
The example payload provides tracking of numeric, boolean, and date type event attributes. Use the payload described, where the price is numeric, departure_date is a date type attribute and premium_seat is a boolean attribute.To view the sample payload, select example_payload from the drop-down.Array Support
If you want to pass an attribute in an array, the appropriate syntax for that is:User Identity Resolution
If the User Identity Resolution feature is enabled in your workspace, identifiers set up in the workspace must be mentioned within the user_identifiers parameter. To view this sample payload where moe_mobile is one of the identifiers, select user_identity_resolution from the drop-down.Authorizations
This authentication parameter, used for access control, must be passed along with the request. The API request will be authenticated through Basic Authentication. Basic Authentication sends a Base64-encoded string containing your username and password with every API request. It encodes a 'username:password' string in Base64 and appends the encoded string with 'Basic '. This string is included in the authorization header as shown below:
{"Authorization: Basic Base64_ENCODED_WORKSPACEID_APIKEY=="}
The username and password details can be obtained from the MoEngage Dashboard. If you're using the API for the first time, follow these steps:
- Navigate to Settings -> Account -> APIs.
- Copy the following details:
- Username: Under Workspace ID (earlier app id), click the copy icon to copy the username.
- Password: In the API keys section, click the copy icon in the Data tile to copy the API key.
Use these details to authenticate the API requests.
Headers
The 'X-Forwarded-For' header is used to specify the IP address of the client that made the request. This header may be added by proxy servers or load balancers. The header value must contain the IP address of the original client that initiated the request. Multiple IP addresses may be specified in the header value, separated by commas.
"203.0.113.195"
Path Parameters
This is your MoEngage account's Workspace ID that has to be passed along with the request. You can find your MoEngage Workspace ID at Settings > Account > APIs > Workspace ID.
"OAPQQ2AMD01MJZYZX1YPG"
Body
This is used to identify the type of request. Allowed value is event.This field is case-sensitive. Follow the case as in the example when passing the value in the request.
event Identifier to identify or create a user in MoEngage. Not mandatory in Identity resolution enabled workspaces.
Device_id in event payload is optional. The default value is the customer_id value. The value is used to map events to specific devices.
Required if Identity Resolution is enabled and customer_id is not provided.
{ "moe_mobile": "+919876543210" }