On this page

Timeline entries API: Send restricted visibility messages

In this tutorial, you'll learn how to send restricted visibility messages on the timeline of an object by using the timeline-entries-create API. These messages are only visible to the specific users you give access to.

The timeline entries API is used to create discussions (comments) on the timeline of an object such as a ticket or issue. These messages can be sent by users or by a bot. You can use this to send any information about a customer like their last logged in date and time, the last page they visited, or an error they encountered.

Send a restricted visibility message

To send a restricted visibility message, follow the steps listed below:

The payload to make a request would look like given below:

1 {
2 "object": "don:core:<partition>:devo/<dev-org-id>:<object-type>/<object-id>",
3 "body": "<private message to post on timeline>",
4 "visibility": "private",
5 "private_to": [<list of user IDs>],
6 "type": "timeline_comment"
7 }
  • object must be of type string and contains <partition>, <dev-org-id>, and <object-id>.
  • body is of type string and contains the actual message to be posted.
  • visibility is set to private in order for the message to be visible only to users, internal is visible with the Dev organization, external is visible to the Dev organzation and customers, and public is visible to all.
  • type should be timeline_comment.
  1. Get the object ID and object type where you want to send a message.

Example: In issue ISS-69, 69 is the object ID and ISS indicates the object type issue.

  1. Get the dev-org-id and partition by making a call to the dev-users.self API.

  2. Get the display IDs of the users you want to send the private message to. Add these display IDs in the private_to array.

Example: DEVU-1

  1. Make a POST request to ("https://api.devrev.ai/timeline-entries.create") and include the PAT created in the authorization header of the request along with the payload with replaced IDs.

In this example, you are using curl to make the requests but you can use any tool you prefer.

1 curl -X POST -H "Content-Type: application/json" -d
2 '{
3 "object": "don:core:<partition>:devo/<dev-org-id>:<object-type>/<object-id>",
4 "body": "message",
5 "visibility": "private",
6 "type": "timeline_comment"
7 }'
8 'https://api.devrev.ai/timeline-entries.create' \
9 --header 'Authorization: <PAT>'

You receive the following json response.

1 {
2 "timeline_entry": {
3 "type": "timeline_comment",
4 "body": "message",
5 "body_type": "text",
6 "created_by": {
7 "type": "dev_user",
8 "display_id": "DEVU-1",
9 "display_name": "John Doe",
10 "email": "karuna.tata@devrev.ai",
11 "full_name": "John Doe",
12 "id": "don:identity:dvrv-us-1:devo/<dev-org-id>:devu/1",
13 "state": "active"
14 },
15 "created_date": "2023-11-29T09:05:47.497205Z",
16 "id": "don:core:dvrv-us-1:devo/<dev-org-id>:conversation/172:comment/xqsvvdwvt6hjw",
17 "object": "don:core:dvrv-us-1:devo/<dev-org-id>:conversation/172",
18 "object_type": "conversation",
19 "visibility": "private"
20 }
21 }

You can check the object to which you sent a message in the UI. It's visible to the creator and the users you added in private_to.

private message