Skip to content

Send a notification as a test

POST
/notification-rules/test
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/notification-rules/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "scope": { "id": "example", "type": "WORKSPACE" }, "source": "PM_DIGEST" }'

Posts the notification’s real content as of now to the channels its saved rule names: a scheduled report as it would be sent now, an event notification from the most recent event of its kind (a commission problem, which is never stored, from a sample). The post is marked as a test and pings nobody: mentions show on Discord but notify no one, and are left out elsewhere. Nothing else happens: no in-app notification, email or audit entry, and the scheduled send of the day is unaffected. Requires the settings.manage permission.

Media typeapplication/json
object
scope

The record the rule is narrowed to. Leave out for the workspace.

object
id

The team, company or project id; leave out for the workspace.

Any of:
string
>= 1 characters
type
required

What a rule is narrowed to: the whole workspace, or one team, company (CLIENT) or project.

string
Allowed values: WORKSPACE TEAM CLIENT PROJECT
source
required

Which notification a rule configures. GET /notification-rules/sources lists what each one accepts.

string
Allowed values: PM_DIGEST COMPLIANCE_DIGEST COMPLIANCE_VIOLATION TIME_OFF_DIGEST TIME_OFF_EVENT TEAM_TIMESHEET_REPORT TEAM_MISSING_HOURS ASANA_ALERT TICKET_CREATED TICKET_SLA_BREACHED COMMISSION_ISSUE

What the test did.

Media typeapplication/json
object
data
required

SENT: the notification was posted as a test to the rule’s channels. EMPTY: it has no content right now (nothing to report, or no event of its kind yet), so nothing was posted.

One of:
object
channelCount
required
integer
>= -9007199254740991 <= 9007199254740991
messageCount
required
integer
>= -9007199254740991 <= 9007199254740991
status
required
string
Allowed value: SENT

Example

{
"data": {
"status": "SENT"
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Invalid input, with field-level messages.

Media typeapplication/json

Error envelope with field-level messages.

object
error
required
object
code
required

Stable machine-readable error code.

string
fieldErrors
required

Message per offending field; a list item is keyed <field>.<index>.<key>.

object
key
additional properties
string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.