Skip to main content
Version: 24.05

/i/push/message/pop

Overview​

Removes notifications from a message with an API trigger, for the users that match a filter. It is the counterpart of Send, which adds notifications to such a message. Only works for messages with an API trigger.

Endpoint​

/i/push/message/pop

Authentication​

  • Required Permission: Delete access to push feature
  • HTTP Method: POST
  • Content-Type: application/x-www-form-urlencoded or JSON

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYesAPI authentication key
app_idStringYesApplication ID
_idObjectIDYesMessage ID (message with API trigger)
filterObjectYesUser filter that selects the users whose notifications are removed. Must not be empty.
filter.userStringNoJSON with a filter on the app users collection
filter.drillStringNoDrill plugin filter in JSON format
filter.geosArrayNoArray of geo IDs
filter.cohortsArrayNoArray of cohort IDs

Parameter Constraints:

  • _id: The message must exist in the app and have an API trigger.
  • filter: Filters that contain disallowed query operators are rejected.

Examples​

Example 1: Remove notifications for one user​

Request (POST):

curl -X POST "https://your-server.com/i/push/message/pop" \
-H "Content-Type: application/json" \
-d '{
"api_key": "YOUR_API_KEY",
"app_id": "507f1f77bcf86cd799439012",
"_id": "507f1f77bcf86cd799439011",
"filter": {
"user": "{\"uid\": {\"$eq\": \"12345\"}}"
}
}'

Response (200):

{
"removed": 1
}

Response​

Success Response​

Status Code: 200 OK

{
"removed": 1
}

Response Fields​

FieldTypeDescription
removedNumberNumber of notifications removed.

Error Responses​

Status Code: 400 Bad Request

{
"errors": ["No such message or it doesn't have API trigger"]
}
{
"errors": ["Message is not api"]
}

Request validation problems (for example a missing _id or filter) are returned as {"kind": "ValidationError", "errors": [...]}.

Permissions​

  • Required Permission: Delete access to push feature
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
messagesPush/message recordsReads the message to check its API trigger.