function createPinpointEvent()

in source/rest-api-handler/index.js [33:50]


function createPinpointEvent (preferenceCenterID, eventType, endpoint, attributes) {
  if(!endpoint) endpoint = {};
  if(!attributes) attributes = {};

  var customEvent = {
    Endpoint: endpoint,
    Events: {}
  };
  
  log.debug(JSON.stringify(customEvent,null,2));

  customEvent.Events[`preferenceCenter_${preferenceCenterID}`] = {
    EventType: eventType,
    Timestamp: moment().toISOString(),
    Attributes: attributes
  };
  return customEvent;
}