• Surendra Mandipalle
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi,

We have an app developed on iOS, and our customers will login to that app. the app is integrated with Salesforce. Now I want to send a push notification based on the real time changes to customer records in salesforce.

Steps I followed:
Integrated the mobile app with Salesforce.
Created a connected app, and enabled push notifications.
Saved the devike token in salesforce for each mobile user (non- Salesforce).

Tested the configuration with "Send test notification" option on connected app by providing the device token as recipient, it worked fine.
User-added image


I tried creating a trigged to send notification, here is the sample code:

Messaging.PushNotification msg =new Messaging.PushNotification();
        Map<String, Object> payload =Messaging.PushNotificationPayload.apple('data has been changed', ' ', 0 );
        msg.setPayload(payload);     
        set<string> receipient=new set<string>();
        receipient.add('005g00000057P5v');
        msg.send('appname', receipient);

In the msg.send method we have to provide connected app name and list of user(salesforce).
But, i want to send the push notification to non salesforce users based on their device token which is generated by APNC and its stored in Salesforce.

Is there any other method to send the push notification based on their device token. Please let me know if my question is not clear.

Please provide some ideas or sample code to handle this situation.

Thanks in advance.
Hi,

We have an app developed on iOS, and our customers will login to that app. the app is integrated with Salesforce. Now I want to send a push notification based on the real time changes to customer records in salesforce.

Steps I followed:
Integrated the mobile app with Salesforce.
Created a connected app, and enabled push notifications.
Saved the devike token in salesforce for each mobile user (non- Salesforce).

Tested the configuration with "Send test notification" option on connected app by providing the device token as recipient, it worked fine.
User-added image


I tried creating a trigged to send notification, here is the sample code:

Messaging.PushNotification msg =new Messaging.PushNotification();
        Map<String, Object> payload =Messaging.PushNotificationPayload.apple('data has been changed', ' ', 0 );
        msg.setPayload(payload);     
        set<string> receipient=new set<string>();
        receipient.add('005g00000057P5v');
        msg.send('appname', receipient);

In the msg.send method we have to provide connected app name and list of user(salesforce).
But, i want to send the push notification to non salesforce users based on their device token which is generated by APNC and its stored in Salesforce.

Is there any other method to send the push notification based on their device token. Please let me know if my question is not clear.

Please provide some ideas or sample code to handle this situation.

Thanks in advance.