The Sample Moe Developer Hub

Welcome to the Sample Moe developer hub. You'll find comprehensive guides and documentation to help you start working with Sample Moe as quickly as possible, as well as support if you get stuck. Let's jump right in!

Search results for "{{ search.query }}"

No results found for "{{search.query}}".

Data Import APIs

Data APIs allow you to send data from an unsupported platform, or if you need to track information that comes from outside your mobile app.

List of APIs

Required Parameters

*DATA API ID* : Unique Id provided by MoEngage to identify the app. Replace <DATA API ID> with DATA API ID found under settings -> APIs on MoEngage dashboard.

Authentication

Authentication: Basic Authentication - username and password required for basic authentication are available under Settings - DATA API Settings as shown below. For first time, hit the Generate Key and then save.
User name - Data API ID
Password - Data API Key

To send a request using a client (as Postman), Authentication can be done in following way:

Request Body

Request Body is JSON, content of the request varies with API and the kind of data transition. There is a limit of 100kb per request.

Response

Response will be a json object, on a sucessful call you will receive response as

{"status":"success"}

on failure, response will be

{
  "status":"fail", 
  "error":{ 
    "type": "TypeError", 
    "attribute": "customer_id",
    "message":"expected string"
	}
}

Add/Modify User Information

API to use - User API
This API is used to set Unique Identifier of User (customer_id) and other User Attributes(ex: name, age etc.. ). ‘customer_id’ and 'platform' in attributes is mandatory and will be used to Map Actions and Devices to User.
NOTE: customer_id is essentially the Unique Identifier which is set and passed on from MoEngage SDK as USER_ATTRIBUTE_UNIQUE_ID

Signature for a user API request looks like:

POST https://api.moengage.com/v1/customer?app_id=<DATA API ID>

To set name as John for a user with unique id 12345 and platform android, pass the following payload

{
"type" : "customer",
"customer_id": "12345",
"attributes": {
    "name":"John",
  	"platforms" : [{"platform":"ANDROID", "active":"true"}]
    }
}

User attributes list is mentioned below:

  • name (string) - name of the user
  • first_name (string) - first name of the user
  • last_name (string) - last name of the user
  • email (string) - email of the user
  • age (numeric) - age of the user
  • gender (string) - "male" or "female" - case sensitive
  • mobile (string) - phone number of the user
  • geo (array of lat,lng in double) - location of the user for eg. [23.3,37.3]
  • source (string) - acquisition source of the user
  • created_time (numeric - epoch time in seconds) - user created time
  • last_seen (numeric - epoch time in seconds) - user last seen time
  • transactions (numeric) - no.of transactions done by the user
  • revenue (numeric) - LTV of the user
  • platforms (array) - platforms on which the user has interacted with the system. for eg.[{"platform":"ANDROID", "active":"true"},{"platform":"WINDOWS", "active":"true"},{"platform":"IOS", "active":"true"}]

To pass other attributes which are not part of the list, use the key value pairs that you intend to use. for ex. to set the points attribute for the user to 20

{
"type" : "customer",
"customer_id": "12345",
"attributes": {
    "points":20,
  	"platforms" : [{"platform":"ANDROID", "active":"true"}]
    }
}

Mandatory Attributes: customer_id and platforms.

Add/Modify Device Information

API to use - Device API
This API is used to Define Unique Identifier of Device (default device_id is customer_id) and Device Attributes (ex: push_id, platform etc..).

Signature for a device API request looks like:

POST https://api.moengage.com/v1/device?app_id=<DATA API ID>
{
	"type": "device",
 	"customer_id": "525689553535239acbfe",
 	"device_id" : "12345",
 	"attributes": {
    "model": "iPhone",
    "platform" : "iOS",
    "push_preference" : "true",
    "push_id" : "irBMohQPf_k2QrwP8iRzK3A/0CdLEzAoVGdF65HhH_I",
    "app_version" : "10.1",
    "os_version" : "2.5.4",
    "active" : "true",
    "created_time" : 143383676
  }
}

We defined reserved keywords for some of Device Attributes.

"model"  (string):  Model of Device
"platform" (string): os (ex: iOS)
"push_preference"  (string): is Push Enabled for Device ("true" or "false") 
"push_id" (string): Push Id or Push Token of Device. 
"app_version" : App Version
"os_version" : Os Version
"active" :   Installed status of device ("true" or "false")     
"created_time" : Created Time of Device (Epoch time in seconds)

To pass other attributes which aren't part of the list, use the key value pairs that you intend to use. for ex. to set the brand attribute for the device to Apple

{
	"type": "device",
 	"customer_id": "525689553535239acbfe",
 	"device_id" : "12345",
 	"attributes": {
  	"brand": "Apple",
    "platform": "iOS",
    "push_id": "irBMohQPf_k2QrwP8iRzK3A/0CdLEzAoVGdF65HhH_I"
  }
}

Mandatory Attributes: customer_id, platform and push_id.

User Events Information

API to use - Event API
This API is used to track Actions of a User.

Signature for event API request looks like:

POST https://api.moengage.com/v1/event?app_id=<DATA API ID>
{
    "type": "event",
    "customer_id": "525689553535239acbfe",
    "device_id" : "12345",
    "actions" : [
          {
              "action": "Added to Cart",
              "attributes": {
                "product"  : "Mobile",
                "color"  : "white",
                "Brand"  : "Apple"
              },
              "platform" : "iOS",
              "app_version" : "1.2.3",
              "user_time" : 1433836769,
              "current_time" : 1433836769
          },
          {
              "action": "Purchase",
              "attributes": {
                "product"  : "MacBook Air",
                "Brand"  : "Apple"
              },
              "platform" : "web",
              "app_version" : "1.2.3",
              "user_time" : 1433837969,
              "current_time" : 1433837969
          }
     ]
}

We defined reserved keywords for some of Device Attributes.

"actions" (array) : Array of Actions or events
"action"  (string): Name of Action or Event
"attributes" (json object) - Event Attributes
"platform" (string) - os 
"app_version" (string or numeric) - App Version
"user_time" (Epoch Time in seconds) - User Time
"current_time" (Epoch Time in seconds) - GMT time of User Time

Mandatory Attributes: customer_id, action and platform.

Bulk Import

API to use - Transition API
This API allows you to import “user , device and event requests” in a single batch.

Signature for transition API request looks like:

POST https://api.moengage.com/v1/transition?app_id=<DATA API ID>
{
    "type" : "transition",
    "elements":[
        {
            "type" : "customer",
            "customer_id": "12345",
            "attributes": {
                "name":"John"
            }
        },
        {
            "type": "device",
            "customer_id": "525689553535239acbfe",
            "device_id" : "12345",
            "attributes": {
                "brand": "Apple",
                "platform": "iOS",
                "push_id": "irBMohQPf_k2QrwP8iRzK3A/0CdLEzAoVGdF65HhH_I"
            }
        },
        {
            "type": "event",
            "customer_id": "525689553535239acbfe",
            "device_id" : "12345",
            "actions" : [
                {
                    "action": "Added to Cart",
                    "attributes": {
                        "product"  : "Mobile",
                        "color"  : "white",
                        "Brand"  : "Apple"
                    },
                    "platform" : "iOS",
                    "app_version" : "1.2.3",
                    "user_time" : 1433836769,
                    "current_time" : 1433836769
                },
                {
                    "action": "Purchase",
                    "attributes": {
                        "product"  : "MacBook Air",
                        "Brand"  : "Apple"
                    },
                    "platform" : "iOS",
                    "app_version" : "1.2.3",
                    "user_time" : 1433837969,
                    "current_time" : 1433837969
                }
            ]
        }            	
   	]
}

Change User Id

API to use - Customer Substitute API
This API is used to Update Unique Id of User (customer_id).

Signature for user substitute API request looks like:

POST https://api.moengage.com/v1/customer/substitute
{
	"type": "customer_substitute",
	"old_customer_id": "525689553535239acbfe",
	"customer_id": "123456789"
}
old_customer_id (string) : Old unique identifier for the User.
customer_id (string) : New unique identifier for the User.

Change Device Id

API to use - Device Substitute API
This API is used to Update Unique Id of Device (device_id).

Signature for device substitute API request looks like:

POST https://api.moengage.com/v1/device/substitute?app_id=<DATA API ID>
{
	"type": "device_substitute",
	"old_device_id": "12345",
	"device_id": "54321"
}
old_device_id (string) : Old unique identifier for the Device.
device_id (string) : New unique identifier for the Device.

Data Import APIs

Data APIs allow you to send data from an unsupported platform, or if you need to track information that comes from outside your mobile app.