1. Locations
  2. Manage Notification Rules

Locations

Manage Notification Rules

This endpoint enables management of notification rules for a specific location, supporting additions, removals, and complete replacement of rule configurations.

Request Parameters

URL Parameters

  • location_id (required): The unique identifier of the location, prefixed with loc_

Request Body

The endpoint supports three operation modes:

  1. Add and Remove Operations:
js
        {
  "add": [
    {
      "notification_template_id": "tmpl_ntf_xxx",
      "methods": {
        "email": true,
        "sms": false
      }
    }
  ],
  "remove": [
    {
      "notification_template_id": "tmpl_ntf_yyy"
    }
  ]
}

      
  1. Set Operation (Replace All):
js
        {
  "set": [
    {
      "notification_template_id": "tmpl_ntf_xxx",
      "methods": {
        "email": true,
        "sms": false
      }
    }
  ]
}

      
  1. Direct Array Assignment:
js
        [
  {
    "notification_template_id": "tmpl_ntf_xxx",
    "methods": {
      "email": true,
      "sms": true
    }
  }
]

      

Validations

The endpoint enforces several validation rules:

  1. Template Configuration:
    • Each notification template ID must be unique within an operation.
    • Templates must support the requested notification methods.
    • At least one notification method must be enabled per rule.
    • Duplicate template IDs result in a 400 error.
  2. Organization Rule Compliance:
    • Prevents removal of organization-level rules through location endpoints.
    • Returns appropriate error messages with status code 400 for any compliance violations.

Error Responses

The endpoint may return these errors:

  1. Invalid Template Configuration
js
        {
  "error": "Email method not available for selected template",
  "status": 400
}

      
  1. Organization Rule Conflict
js
        {
  "error": "Location is configured to use Organization Rules for notification type 'TYPE'. Cannot assign rules to location",
  "status": 400
}

      
  1. Duplicate Events
js
        {
  "error": "Rules are being assigned to the location which have duplicate events.",
  "code": "notifications.duplicate_events_in_rules",
  "errors": ["status:inbound"],
  "status": 400
}

      
  1. Template Validation Errors
js
        {
  "error": "Invalid 'notification_template_id' in 'set'",
  "code": "location.invalid_template",
  "errors": ["notification_templates"],
  "status": 400
}

      
  1. Notification Method Configuration Errors
js
        {
  "error": "At least one method must be enabled for a notification rule",
  "code": "location.invalid_notification_rule_method",
  "status": 400
}

      
  1. Operation Mode Conflicts
js
        {
  "error": "'add' and 'remove' cannot contain elements when 'set' is specified",
  "code": "param.validation",
  "status": 400
}