pip install moengage
from moengage import Moengage
mo = Moengage(<BASE_URL>, <APP_ID>, <API_KEY>)
BASE_URL
is the Moengage DATA API endpoint base url. eg: "https://api-03.moengage.com"APP_ID
for your MoEngage account is available on the MoEngage Dashboard in Settings > App Settings > Account Settings > APP ID.API_KEY
is the api_key generated by navigating to Settings > APIs > DATA API Settings. Please refer to MoEngage documentation for further details regarding these.
mo.create_or_update_user(<USER_ID>, <USER_NAME>, <USER_PHONE>, <USER_EMAIL>, **kwargs)
USER_ID
is mandatory. It is a unique identifier for a user provided by the client that will be used for updating user profile and firing events for the user.USER_NAME
,USER_PHONE
andUSER_EMAIL
are optional parameters that will be set as user standard attributes if provided.- Custom user attributes can be set by passing the attribute name and value in keyword arguments.
mo.publish_event(<USER_ID>, <EVENT_NAME>, **kwargs)
USER_ID
is mandatory. It is the unique identifier of the user for which the event is to be tracked.EVENT_NAME
is mandatory. The event will be tracked in MoEngage with this name.- Custom event attributes can be set by passing the attribute name and value in keyword arguments.