Skip to main content

Push Approver - Approve or Reject Message

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/i/push/approve

Overview

Approves or rejects a push message that is waiting for approver action.

Authentication

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

Permissions

  • Push Approver: Update permission on the Push feature.
  • Caller must also be an approver (member.approver = true).

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
_idString (ObjectID)YesPush message ID
approveBoolean StringYestrue to approve, false to reject

Examples

/i/push/approve?api_key=YOUR_API_KEY&_id=67b9c2e2f67aab0012cd3456&approve=true
/i/push/approve?api_key=YOUR_API_KEY&_id=67b9c2e2f67aab0012cd3456&approve=false

Response

Success Response

{
"_id": "67b9c2e2f67aab0012cd3456",
"app": "6991c75b024cb89cdc04efd2",
"status": "active",
"info": {
"createdBy": "67b9c1a8f67aab0012cd1234",
"approved": "2026-02-15T14:20:12.151Z",
"approvedBy": "67b9c1fdf67aab0012cd2345",
"approvedByName": "Approver User"
}
}

Response Fields

FieldTypeDescription
_idStringPush message ID
appStringApp ID attached to the message
statusStringactive when approved, rejected when rejected
infoObjectMessage metadata including approver/rejector details

Error Responses

  • HTTP 400 - Validation failure or permission issue:
{
"errors": [
"You're not an approver"
]
}
  • HTTP 400 - Already approved:
{
"errors": [
"The message has been already approved"
]
}
  • HTTP 404 - Message not found:
{
"errors": [
"No such message"
]
}

Behavior

  • Validates _id and approve with common.validateArgs(...).
  • Rejects self-approval/rejection attempts by message creator.
  • On approve: updates message status to active, writes approver metadata, then schedules eligible message sending.
  • On reject: updates message status to rejected, writes rejector metadata, and notifies creator by email.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.messagesPush/message recordsStores message lifecycle and approval/scheduling state used by this endpoint.
countly.membersMember/account enrichmentStores member profile fields (for example names/IDs) used to resolve actor metadata.