Skip to main content
Version: 25.03

Push - Message Pop

Endpoint​

/i/push/message/pop

Overview​

Removes users' pending notifications from a push message that uses an API trigger. It is the counterpart of Message Push: the filter selects the users whose queued notifications are removed.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

Requires push Delete permission.

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.
app_idStringYesApp ID.
_idString (ObjectID)YesID of the message. It must have an API trigger.
filterObjectYesSelects the users whose notifications are removed.
filter.userStringNoJSON filter on the app users collection.
filter.drillStringNoDrill filter in JSON format.
filter.geosArrayNoArray of geo IDs.
filter.cohortsArrayNoArray of cohort IDs.

Examples​

Remove notifications for a group of users​

/i/push/message/pop?
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2&
_id=67a3d2f5c1a23b0f4d6c0101&
filter={"cohorts":["67a3d2f5c1a23b0f4d6c0202"]}

Response​

Success Response​

{
"removed": 12
}

Response Fields​

FieldTypeDescription
removedNumberNumber of notifications removed.

Error Responses​

  • 400
{
"kind": "ValidationError",
"errors": [
"_id is required"
]
}
  • 400
{
"kind": "PushError",
"errors": [
"No such message or it doesn't have API trigger"
]
}
  • 400
{
"kind": "PushError",
"errors": [
"Message is not api"
]
}
  • 500
{
"kind": "ServerError",
"errors": [
"Server error"
]
}

Standard authentication/authorization errors can also be returned.

Behavior​

  • Validates app_id, _id and filter.
  • Loads the message and checks that it belongs to the app in the request.
  • Checks that the message has an API trigger.
  • Removes the notifications of the users matched by filter and returns how many were removed.