Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Initialization

// Simple init 
pcsdk.initPush();

//onClick listener
pcsdk.initPush(onClickCallback);

// onReceivetive listener
pcsdk.initPush(false, onReceiveCallback);

// you can use different callback for notification, when app is in background.    
pcsdk.initPush(false, onReceiveCallback, onBackgroundReceiveCallback);
// If onBackgroundReceiveCallback not specified, used onReceiveCallback listener. 

// onClickCallback params
{
  "bigPictureUrl": "MESSAGE_IMAGE",
  "channelId": "personaclick-push", 
  "data": {
    "id": "MESSAGE_ID",
    "type": "MESSAGE_TYPE"
  }, 
  "foreground": true, 
  "id": "MESSAGE_ID", 
  "largeIconUrl": "MESSAGE_ICON",
  "message": "MESSAGE_BODY", 
  "title": "MESSAGE_TITLE", 
  "userInteraction": true
}
// onReceiveCallBack, onBackgroundReceiveCallback params
{
  "data": {
    "action_urls": "[]", 
    "actions": "[]",
    "body": "MESSAGE_BODY",
    "icon": "MESSAGE_ICON", 
    "id": "MESSAGE_ID",
    "image": "MESSAGE_IMAGE", 
    "title": "MESSAGE_TITLE", 
    "type": "MESSAGE_TYPE"
  }, 
  "from": "MESSAGE_FROM", 
  "messageId": "FMC_MESSAGE_ID", 
  "sentTime": TIMESTAMP, 
  "ttl": TTL_VALUE
}

Token Send

pcsdk.setPushTokenNotification('NEW_TOKEN');

Actions Tracking

const params = {
  code: 'CODE',
  type: 'TYPE'
};
// Track user click notification
pcsdk.notificationClicked(params);

// Track Notification received
pcsdk.notificationReceived(params);

  • No labels