How to Target Mobile Push Notifications by Tag in SFMC?

Spread the love

Question

I have a mobile application where users can set preferences for the types of push notifications they receive per device. Each device can have different preferences, and we are using mobile push tags to organize these preferences.

The architecture of the SFMC mobile push is structured such that these preferences and tags are applied at the device level. For example, if a user has multiple devices (e.g., Device 1 and Device 2), they can have different preferences on each device. This setup works fine and aligns with our needs.

The issue arises when we segment based on a specific tag. SFMC selects all contacts that have this tag on any of their devices. It then sends the push notification to all devices associated with that contact, regardless of whether each device has the tag. For example, if a contact has Tag A on Device 1 but not on Device 2, and I create a target group for devices with Tag A, SFMC identifies the contact as a match based on Device 1 but sends the push notification to both Device 1 and Device 2. This behavior is not aligned with my needs because I only want to send the push notification to the device(s) that have the relevant tag.

Is it possible to restrict mobile push notifications in SFMC so they are only sent to the specific device(s) that have the desired tag? I want to ensure that messages are only sent to devices that meet the tag criteria.

Answer

To send SFMC Mobile Push notifications only to devices that have a specific tag, the process involves querying the relevant device tokens using the _PushTag Data View and then using these tokens to send notifications through the messageContact API.

Here’s a more detailed breakdown:

1. Query the _PushTag Data View: You need to retrieve the device tokens associated with the specific tag. To do this, you can run the following SQL query against the _PushTag and _PushAddress Data Views. This query filters for devices that have a particular tag and returns their device tokens.

SELECT 
    pa.SystemToken as 'DeviceToken'
FROM 
    _PushAddress pa
WHERE 
    EXISTS (
        SELECT 1
        FROM _PushTag pt
        WHERE pt.DeviceID = pa.DeviceID
          AND pt._Value = 'specific_tag_value'
    )

In this query:

  • _PushAddress contains the system tokens for each device.
  • _PushTag holds the tags applied to devices.
  • The query checks for the existence of a specific tag ('specific_tag_value') on the devices and retrieves their device tokens.

2. Use the messageContact API to Send Notifications: Once you have the list of device tokens, you can use a Script Activity to batch the tokens (usually in groups of 5000) and call the messageContact API to send the push notification.

The messageContact API allows you to target specific devices by their tokens, ensuring that only devices with the desired tag will receive the push notification. This is crucial as SFMC by default may send notifications to all devices linked to a contact, regardless of whether each individual device has the tag.

3. Batching Tokens: To ensure efficient delivery, it’s a good practice to batch the device tokens into smaller groups (e.g., 5000 tokens per batch) to avoid exceeding API limits. You can loop through the tokens in batches and send each batch separately.

By following this process, you’ll be able to send notifications only to those devices that have the specified tag, resolving the issue of sending notifications to all devices associated with a contact.

This solution ensures that only the devices matching the tag criteria will receive the push notification, which aligns with your requirement to target specific devices within SFMC’s Mobile Push architecture.

Note: While this solution should work, it hasn’t been personally tested, but it should provide a solid starting point.

Real-Time Project-Based Salesforce Training to Kick Start Your Career

Our Salesforce Course is specifically structured to provide a comprehensive understanding of the Salesforce platform, equipping you with the critical skills needed to excel in the CRM sector. The curriculum covers key modules such as Salesforce Admin, Developer, and AI, combining foundational concepts with practical, hands-on learning. By engaging in real-world projects and assignments, you’ll build the expertise to solve complex business problems using Salesforce solutions. Our expert trainers ensure you gain both technical proficiency and valuable industry knowledge to succeed in the Salesforce ecosystem.

In addition to technical training, our Salesforce Training institutes in Ameerpet includes tailored mentorship, certification exam preparation, and interview guidance to boost your career prospects. You’ll benefit from extensive study resources, practical project exposure, and continuous support throughout your journey. By the end of the course, you’ll be fully prepared for certifications and equipped with the practical skills that employers value. Take the first step in your Salesforce journey with us and explore endless career possibilities. Join our Free Demo today!

Open Chat
1
Dear Sir/Madam
How can I help you?