Notifications
Personas in this Story: Default, member.
First, we'll check default settings for our notifications filter:
Response:
1 2 3 4
{ "notification_new_note": true, "notification_note_name_body_update": false }
Lets create a new note:
Payload:
1 2 3 4 5 6 7
{ "name": "Etiam Sit Sem Nullam Consectetur", "body": "Donec sed odio dui.", "subscribers": [ 1 ] }
Response:
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 36
{ "single": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Etiam Sit Sem Nullam Consectetur", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Donec sed odio dui.", "body_formatted": "Donec sed odio dui.", "body_plain_text": "Donec sed odio dui.", "created_on": 1430164206, "created_by_id": 2, "updated_on": 1430164206, "updated_by_id": 2, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 2 ] }, "subscribers": [ 1, 2 ], "comments": [], "subnotes": [] }
and we'll see this notification in our notifications stream:
Response:
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 36 37 38 39 40 41 42 43 44 45
{ "notifications": [ { "id": 2, "class": "NewNoteNotification", "url_path": "\/notifications\/2", "parent_type": "Note", "parent_id": 1, "created_on": 1430164206, "sender_id": 2 } ], "related": { "Note": { "1": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Etiam Sit Sem Nullam Consectetur", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Donec sed odio dui.", "body_formatted": "Donec sed odio dui.", "body_plain_text": "Donec sed odio dui.", "created_on": 1430164206, "created_by_id": 2, "updated_on": 1430164206, "updated_by_id": 2, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 2 ] } } } }
As things work by default, when member updates the note it will not notify the owner because owner has this type of notification turned off:
Payload:
1 2 3 4
{ "name": "Lorem Euismod Commodo Condimentum", "body": "Donec ullamcorper nulla non metus auctor fringilla. Donec id elit non mi porta gravida at eget metus." }
Response:
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 36
{ "single": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Lorem Euismod Commodo Condimentum", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Donec ullamcorper nulla non metus auctor fringilla. Donec id elit non mi porta gravida at eget metus.", "body_formatted": "Donec ullamcorper nulla non metus auctor fringilla. Donec id elit non mi porta gravida at eget metus.", "body_plain_text": "Donec ullamcorper nulla non metus auctor fringilla. Donec id elit non mi porta gravida at eget metus.", "created_on": 1430164206, "created_by_id": 2, "updated_on": 1430164207, "updated_by_id": 2, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 2 ] }, "subscribers": [ 1, 2 ], "comments": [], "subnotes": [] }
Response:
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 36 37 38 39 40 41 42 43 44 45
{ "notifications": [ { "id": 2, "class": "NewNoteNotification", "url_path": "\/notifications\/2", "parent_type": "Note", "parent_id": 1, "created_on": 1430164206, "sender_id": 2 } ], "related": { "Note": { "1": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Lorem Euismod Commodo Condimentum", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Donec ullamcorper nulla non metus auctor fringilla. Donec id elit non mi porta gravida at eget metus.", "body_formatted": "Donec ullamcorper nulla non metus auctor fringilla. Donec id elit non mi porta gravida at eget metus.", "body_plain_text": "Donec ullamcorper nulla non metus auctor fringilla. Donec id elit non mi porta gravida at eget metus.", "created_on": 1430164206, "created_by_id": 2, "updated_on": 1430164207, "updated_by_id": 2, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 2 ] } } } }
Users can change this setting at any time:
Payload:
1 2 3
{ "notification_note_name_body_update": true }
Response:
1 2 3
{ "notification_note_name_body_update": true }
Now, when the note gets updated, owner will recieve a notification about this change:
Payload:
1 2 3 4
{ "name": "Cras Consectetur Pellentesque Quam Inceptos", "body": "Nullam id dolor id nibh ultricies vehicula ut id elit." }
Response:
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 36
{ "single": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Cras Consectetur Pellentesque Quam Inceptos", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "body_formatted": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "body_plain_text": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "created_on": 1430164206, "created_by_id": 2, "updated_on": 1430164208, "updated_by_id": 2, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 2 ] }, "subscribers": [ 1, 2 ], "comments": [], "subnotes": [] }
Now we received the notification:
Response:
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 36 37 38 39 40 41 42 43 44 45
{ "notifications": [ { "id": 2, "class": "NewNoteNotification", "url_path": "\/notifications\/2", "parent_type": "Note", "parent_id": 1, "created_on": 1430164206, "sender_id": 2 } ], "related": { "Note": { "1": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Cras Consectetur Pellentesque Quam Inceptos", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "body_formatted": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "body_plain_text": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "created_on": 1430164206, "created_by_id": 2, "updated_on": 1430164208, "updated_by_id": 2, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 2 ] } } } }
Note that update notification is sent only if note name
or body
are changed:
Payload:
1 2 3
{ "is_hidden_from_clients": true }
Response:
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 36
{ "single": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Cras Consectetur Pellentesque Quam Inceptos", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": true, "body": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "body_formatted": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "body_plain_text": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "created_on": 1430164206, "created_by_id": 2, "updated_on": 1430164208, "updated_by_id": 2, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 2 ] }, "subscribers": [ 1, 2 ], "comments": [], "subnotes": [] }
Response:
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 36 37 38 39 40 41 42 43 44 45
{ "notifications": [ { "id": 2, "class": "NewNoteNotification", "url_path": "\/notifications\/2", "parent_type": "Note", "parent_id": 1, "created_on": 1430164206, "sender_id": 2 } ], "related": { "Note": { "1": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Cras Consectetur Pellentesque Quam Inceptos", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": true, "body": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "body_formatted": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "body_plain_text": "Nullam id dolor id nibh ultricies vehicula ut id elit.", "created_on": 1430164206, "created_by_id": 2, "updated_on": 1430164208, "updated_by_id": 2, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 2 ] } } } }