VocalDocscontracts 1.65.0

Create a notification rule

POST /v1/notification-rules

PropertyValue
Operationcreate_notification_rule
GroupNotification rules
Scopemessages:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditAudited channels.notification_rule.create (mutation)
Released in1.60.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Creates a rule at revision 1 (1.60.0): the record event types it delivers, a filter, a Connection and one of its notify tools, every argument but the text fixed, and the template over the event envelope. Every issue is a detail of validation_failed (MessagingIssueCode); a revoked Connection is connection_revoked.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the messages:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl -X POST "$VOCAL_API/v1/notification-rules" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "<name>",
    "event_types": [
      "<event_types>"
    ],
    "connection_id": "con_...",
    "tool": "<tool>",
    "template": "<template>"
  }'

Parameters

NameInTypeRequiredDescription
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: NotificationRuleCreateRequest.

FieldTypeRequiredDescription
connection_idConnectionIdyes
enabledbooleannoTrue when omitted.
event_typesarray of NotificationEventTypeyes
filterstringno
fixed_argumentsNotificationArgumentsInputno
namestringyes
templatestringyes
toolUpstreamToolNameyes

Responses

StatusContent typeShapeError codes
201application/jsonNotificationRule
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
409application/jsonErrorEnvelopeconnection_revoked, idempotency_in_progress, idempotency_key_reused
422application/jsonErrorEnvelopevalidation_failed
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 201 answer

The shape is NotificationRule.

FieldTypeRequiredDescription
connection_idConnectionIdyes
created_atTimestampyes
enabledbooleanyes
event_typesarray of NotificationEventTypeyesThe record event types it delivers (RECORD_EVENT_TYPES).
filterstring or nullyesA ZEN expression over the event envelope; null delivers every event.
fixed_argumentsNotificationArgumentsyesEvery argument but the text, fixed at save, such as the destination channel.
idNotificationRuleIdyes
namestringyes
object"notification_rule"yes
organization_idOrganizationIdyes
revisionintegeryes
templatestringyesThe text in the closed template language of prompt-manager.md section 3, over the event envelope's fields; in PHI mode the envelope carries identifiers only.
toolUpstreamToolNameyesA notify tool of the Connection's Connector.
updated_atTimestampyes