Recently, I worked on a requirement to display and update a contact’s Mobile Push Notification status from Salesforce Service Cloud, using data from Marketing Cloud (SFMC). The goal was to show the status as a toggle in Service Cloud: if the status is active, the toggle is on, and vice versa. When the user toggles the button, the new status should be sent back to Marketing Cloud via API.
I faced several challenges in understanding and implementing this integration, so I’m sharing my solution here for anyone facing a similar scenario.
1. Fetching Mobile Push Notification Status from SFMC
To get the push notification status, you need to send an HTTP POST request to:
https://.rest.marketingcloudapis.com/contacts/v1/attributes/search
Request Body
{
"request": {
"attributes": [
{
"key": "MobilePush Demographics.Device Id"
},
{
"key": "MobilePush Demographics.Application"
},
{
"key": "MobilePush Demographics.System token"
},
{
"key": "MobilePush Demographics.Status"
},
{
"key": "MobilePush Demographics.Opt In Status"
},
{
"key": "Contact.Contact ID"
},
{
"key": "Contact.Contact Key"
}
]
},
"conditionSet": {
"operator": "And",
"conditionSets": [],
"conditions": [
{
"attribute": {
"key": "Contact.Contact Key"
},
"operator": "Is",
"value": {
"items":[""]
}
}]
}
}
Example Response
Here is a sample response you might receive:
{
"page": 1,
"pageSize": 50,
"count": 2,
"items": [
{
"values": [
{
"id": "some id",
"key": "Contact.Contact ID",
"name": "Contact ID",
"value": "11111"
},
{
"id": "some id",
"key": "Contact.Contact Key",
"name": "Contact Key",
"value": ""
},
{
"id": "some id",
"key": "MobilePush Demographics.Device ID",
"name": "Device ID",
"value": "****"
},
{
"id": "some id",
"key": "MobilePush Demographics.System Token",
"name": "System Token",
"value": ""
},
{
"id": "some id",
"key": "**MobilePush Demographics.Status**",
"name": "Status",
"value": "2"
},
{
"id": "some id",
"key": "MobilePush Demographics.Opt In Status",
"name": "Opt In Status",
"value": "0"
},
{
"id": "some id",
"key": "MobilePush Demographics.Application",
"name": "Application",
"value": "****"
}
]
},
{
"values": [
{
"id": "some id",
"key": "Contact.Contact ID",
"name": "Contact ID",
"value": ""
},
{
"id": "some id",
"key": "Contact.Contact Key",
"name": "Contact Key",
"value": ""
},
{
"id": "some id",
"key": "MobilePush Demographics.Device ID",
"name": "Device ID",
"value": "****"
},
{
"id": "some id",
"key": "MobilePush Demographics.System Token",
"name": "System Token",
"value": ""
},
{
"id": "some id",
"key": "**MobilePush Demographics.Status**",
"name": "Status",
"value": "1"
},
{
"id": "some id",
"key": "MobilePush Demographics.Opt In Status",
"name": "Opt In Status",
"value": "2"
},
{
"id": "some id",
"key": "MobilePush Demographics.Application",
"name": "Application",
"value": "****"
}
]
}
],
"links": {},
"requestServiceMessageID": "",
"responseDateTime": "2025-05-29T11:25:17.3326733-06:00",
"resultMessages": [],
"serviceMessageID": ""
}
There might be multiple devices attached to a single contact. In the example above there are 2 devices. The value you’re looking for is under “MobilePush Demographics.Status”. Also note the Device ID and the Application values. These are needed to uniquely identify and update the Push Notification status.
2. Updating the Status in SFMC
Updating the status in Marketing Cloud is done via a HTTP PATCH request to:
https://.rest.marketingcloudapis.com/contacts/v1/contacts/
In the example below, I am updating the Push Notification status for one device.
Request Body
{
"contactKey": "****",
"attributeSets": [
{
"name": "MobilePush Demographics",
"items": [
{
"values": [
{
"name": "Device ID",
"value": "****"
},
{
"name": "Application",
"value": "****"
},
{
"name": "Status",
"value": "1"
}
]
}
]
}
]
}
Set “Status” to “1” for active, “2” for inactive. Use the correct Device ID and Application values from the earlier fetch.
Example Response
{
"operationStatus": "OK",
"rowsAffected": 1,
"contactKey": "",
"contactID": ContactID,
"contactTypeID": 0,
"isNewContactKey": false,
"requestServiceMessageID": "some id",
"responseDateTime": "2025-05-29T11:28:18.937469-06:00",
"hasErrors": false,
"resultMessages": [],
"serviceMessageID": "some id"
}
3. Verifying the Update
To verify, go to Contact Builder > All Contacts in Marketing Cloud, search for the contact, and check the Attributes tab under Mobile Push Demographics. The Status attribute should reflect the new value.
