Update General Notification Settings

Updates the General Notification settings of the App. For information on notifications, refer to the following article:
General Notifications (External link)

This API updates the pre-live settings.
After using this API, use the following API to deploy the settings to the live App:
Deploy App Settings

MethodPUT
URLhttps://{subdomain}.kintone.com/k/v1/preview/app/notifications/general.json
URL(guest space)https://{subdomain}.kintone.com/k/guest/{SpaceID}/v1/preview/app/notifications/general.json
Authentication Password Authentication , API Token Authentication , Session Authentication
Content-Typeapplication/json

Contents

Permissions

  • App Management Permissions are needed.
  • The entity must be granted the view records permission in order for the entity to receive the notification.

Request Parameters

Parameter Value Required Description
app Integer or String Yes The App ID.
notifications Array An array of objects consisting of "Recipients and Conditions" options.
If an empty array is sent, all the recipients will be removed.
If this parameter is ignored, no changes will be made to the "Recipients and Conditions" options.
notifications[].entity Object Conditional An object containing data of the entity the General Notification settings are configured to.
Required when specifying the notifications parameter.
notifications[].entity.type String Conditional The type of the entity the General Notification settings are configured to.
  • USER: User
  • GROUP: Group
  • ORGANIZATION: Department
  • FIELD_ENTITY: Created By, Updated By, User Selection, Group Selection, and Department Selection Fields
Required when specifying the entity parameter.
notifications[].entity.code String Conditional The code of the entity the General Notification settings are configured to.
Specify the field code if the notifications[].entity.type parameter is specified as FIELD_ENTITY.
For guest users, add guest/ before the login name.
Required when specifying the entity parameter.
notifications[].includeSubs Boolean or String The "Include affiliated departments" setting of the Department. This parameter is available if notifications[].entity.type parameter is specified to ORGANIZATION or FIELD_ENTITY.
  • true: Affiliated departments do inherit the General Notification settings
  • false: Affiliated departments do not inherit the General Notification settings
If ignored, this value is false.
notifications[].recordAdded Boolean or String Option to notify the entity when a record is added.
  • true: Notify when a record is added
  • false: Do not notify when a record is added
If ignored, this value is false.
notifications[].recordEdited Boolean or String Option to notify the entity when a record is edited.
  • true: Notify when a record is edited
  • false: Do not notify when a record is edited
If ignored, this value is false.
notifications[].commentAdded Boolean or String Option to notify the entity when a comment is posted.
  • true: Notify when a comment is posted
  • false: Do not notify when a comment is posted
If ignored, this value is false.
notifications[].statusChanged Boolean or String Option to notify the entity when a status is changed.
  • true: Notify when a status is changed
  • false: Do not notify when a status is changed
If ignored, this value is false.
notifications[].fileImported Boolean or String Option to notify the entity when a file is imported.
  • true: Notify when a file is imported
  • false: Do not notify when a file is imported
If ignored, this value is false.
notifyToCommenter Boolean or String Option to notify all commenters of a record when a comment is posted on that record. This reflects the "Send updated comment notifications to all commenters" checkbox.
  • true: Notify all commenters of the record when a comment is posted
  • false: Do not notify all commenters of the record when a comment is posted
If ignored, this setting will not be changed.
revision Integer or String Specify the revision number of the settings that will be deployed.
The request will fail if the revision number is not the latest revision.
The revision will not be checked if this parameter is ignored or -1 is specified.

Sample Request

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var body = {
  'app': kintone.app.getId(),
  'notifications': [{
    'entity': {
      'type': 'USER',
      'code': 'user1'
    },
    'includeSubs': false,
    'recordAdded': true,
    'recordEdited': true,
    'commentAdded': false,
    'statusChanged': false,
    'fileImported': true
  }],
  'notifyToCommenter': true,
  'revision': '2'
};

kintone.api(kintone.api.url('/k/v1/preview/app/notifications/general.json', true), 'PUT', body, function(resp) {
  // success
  console.log(resp);
}, function(error) {
  // error
  console.log(error);
});

XMLHttpRequest

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var body = {
  'app': kintone.app.getId(),
  'notifications': [{
    'entity': {
      'type': 'USER',
      'code': 'user1'
    },
    'includeSubs': false,
    'recordAdded': true,
    'recordEdited': true,
    'commentAdded': false,
    'statusChanged': false,
    'fileImported': true
  }],
  'notifyToCommenter': true,
  'revision': '2',
  // CSRF TOKEN: used for all APIs that have an HTTP method of POST, PUT, and DELETE on Kintone.
  '__REQUEST_TOKEN__': kintone.getRequestToken()
};

var url = 'https://{subdomain}.kintone.com/k/v1/preview/app/notifications/general.json';
var xhr = new XMLHttpRequest();
xhr.open('PUT', url);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = function() {
  if (xhr.status === 200) {
    // success
    console.log(JSON.parse(xhr.responseText));
  } else {
    // error
    console.log(JSON.parse(xhr.responseText));
  }
};
xhr.send(JSON.stringify(body));

Response Parameters

Parameter Type Description
revision String The revision number of the App settings.

Sample Response

1
2
3
{
  "revision": "2"
}