Core
IoT Platform v2.x
2

create #

Creates a new notification rule inside a tenant index.

Return an error if the rule already exists.


Query Syntax #

HTTP #

URL: http://kuzzle:7512/_/notification-rules/:index
Method: POST
Body:
{
  "name": "<rule name>",
  "description": "<rule description>",
  "disabled": false, // boolean, optional, default: false
  "filters": {
    // filters
  },
  "sendgridAction": {
    "enabled": false, // boolean
    "recipients": "<mail@kuzzle.io>",
    "subject": "<subject>",
    "message": "<message>",
  },
  "smtpAction": {
    "enabled": false, // boolean
    "recipients": "<mail@kuzzle.io>",
    "subject": "<subject>",
    "message": "<message>",
  },
  "twilioAction": {
    "enabled": false, // boolean
    "recipients": "<mail@kuzzle.io>",
    "subject": "<subject>",
    "message": "<message>",
  },
}

Javascript #

kuzzle.query({
  controller: 'notification-rules',
  action: 'create',
  index: '<index>',
  body: {
    name: '<rule name>',
    description: '<rule description>',
    disabled: false, // boolean, optional, default: false
    filters: {
      // filters
    },
    sendgridAction: {
      enabled: false, // boolean
      recipients: '<mail@kuzzle.io, othermail@kuzzle.io>',
      subject: '<subject>',
      message: '<message>',
    },
    smtpAction: {
      enabled: false, // boolean
      recipients: '<mail@kuzzle.io, othermail@kuzzle.io>',
      subject: '<subject>',
      message: '<message>',
    },
    twilioAction: {
      enabled: false, // boolean
      recipients: '<mail@kuzzle.io, othermail@kuzzle.io>',
      subject: '<subject>',
      message: '<message>',
    },
  },
});

Arguments #

  • name : rule name
  • description : rule description
  • disabled : rule status, while true, the rule is disabled and will not be executed
  • filters : filters to apply on the alerts that will trigger the rule
  • sendgridAction : sendgrid action configuration
  • smtpAction : smtp action configuration
  • twilioAction : twilio action configuration

Actions properties #

  • enabled : action status, while false, the action is disabled and will not be executed
  • recipients : recipients of the notification
  • subject : subject of the notification
  • message : message of the notification