# Notifications

Notification objects are created either automatically as a result of connection invitations or manually in the Custom Notifications section of the administrator portal.

Through the administration interface at **<https://app.dev.medable.com/\\[your\\_org\\_name]/settings/notifications>**, notifications can be enabled, disabled, or based on organization members’ preferences.

In conjunction with the scripting application programming interface (API), custom notifications can be configured for multiple endpoints and sent via scripts, for example, require("notifications").send("c\_my\_notif");.

An organization can set up an app for Apple Push Notification Service (APNs) and Google's  Firebase Cloud Messaging (FCM), and users can set preferences for how to receive notifications: through APNs, via email, or through SMS for custom notifications.

{% hint style="info" %}
**Note:** For customers who cannot use APNs or FCM, Medable incorporates the Tencent notification system.&#x20;

For more information contact your Medable representative for more information.
{% endhint %}

Notifications are automatically cleared for connection invitations when they are retrieved using the API. Otherwise, clients should manually clear them using the notifications API.

| Name                  | Description                                                                                                                                                   |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **\_id** ObjectId     | The notification identifier.                                                                                                                                  |
| **context** Reference | The context for which the notification was created.                                                                                                           |
| **created** Date      | The date the notification was created. Notifications that are not acknowledged expire after 30 days.                                                          |
| **meta** Any          | An object containing notification metadata. For post updates, for example, it contains the postId and postType. For comments, it also contains the commentId. |
| **object** String     | The object name (notification).                                                                                                                               |
| **type** ObjectId     | The notification type. See [Consts](/cortex-api/scripting/modules-1/consts-module.md) for the standard notification type \_ids.                               |

```javascript
{
  "_id": "55238637b9b285167a241439",
  "context": {
    "_id": "5519c01aae2fd2b02915c81f",
    "object": "c_example",
    "path": "/c_examples/5519c01aae2fd2b02915c81f"
  },
  "meta": {
    "postId": "55238637a033479c18311c6e",
    "type": "c_post"
  },
  "object": "notification",
  "type": "4e66204665656473506f7374"
}
```

## List

<mark style="color:blue;">`GET`</mark> `https://api.dev.medable.com/your_org_name/v2/notifications`

#### Path Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| your\_org\_name | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
  "data": [
    {
      "_id": "55238637b9b285167a241439",
      "context": {
        "_id": "5519c01aae2fd2b02915c81f",
        "object": "c_example",
        "path": "/c_examples/5519c01aae2fd2b02915c81f"
      },
      "meta": {
        "postId": "55238637a033479c18311c6e",
        "type": "c_post"
      },
      "object": "notification",
      "type": "4e66204665656473506f7374"
    },
    {
      "_id": "5523860eb9b285167a241431",
      "context": {
        "_id": "5519c01aae2fd2b02915c81f",
        "object": "c_example",
        "path": "/c_examples/5519c01aae2fd2b02915c81f"
      },
      "meta": {
        "commentId": "5523860ea033479c18311c65",
        "postId": "55238235bb12a3841950d37e",
        "type": "c_post"
      },
      "object": "notification",
      "type": "4e66204665656473436d6e74"
    }
  ],
  "hasMore": false,
  "object": "list"
}
```

{% endtab %}

{% tab title="400 " %}

```
{}
```

{% endtab %}
{% endtabs %}

```javascript
$.ajax({
    url: "https://api.dev.medable.com/example/v2/notifications",
    method: "GET",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    }
}).done(function(data) {
    // ...
});
```

## Read

<mark style="color:blue;">`GET`</mark> `https://api.dev.medable.com/your_org_name/v2/notifications/notification_id`

#### Path Parameters

| Name             | Type   | Description |
| ---------------- | ------ | ----------- |
| notification\_id | string |             |
| your\_org\_name  | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
  "_id": "55238637b9b285167a241439",
  "context": {
    "_id": "5519c01aae2fd2b02915c81f",
    "object": "c_example",
    "path": "/c_examples/5519c01aae2fd2b02915c81f"
  },
  "meta": {
    "postId": "55238637a033479c18311c6e",
    "type": "c_post"
  },
  "object": "notification",
  "type": "4e66204665656473506f7374"
}
```

{% endtab %}

{% tab title="400 " %}

```
```

{% endtab %}
{% endtabs %}

```javascript
$.ajax({
    url: "https://api.dev.medable.com/example/v2/notifications/55238637b9b285167a241439",
    method: "GET",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    }
}).done(function(data) {
    // ...
});
```

## Clear (one)

<mark style="color:purple;">`PATCH`</mark> `https://api.dev.medable.com/your_org_name/v2/notifications/notification_id`

#### Path Parameters

| Name             | Type   | Description |
| ---------------- | ------ | ----------- |
| your\_org\_name  | string |             |
| notification\_id | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
    "object": "result",
    "data": 1
}
```

{% endtab %}

{% tab title="400 " %}

```
{}
```

{% endtab %}
{% endtabs %}

```javascript
$.ajax({
    url: "https://api.dev.medable.com/example/v2/notifications/55238af0b9b285167a2414c8",
    method: "DELETE",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    }
}).done(function(data) {
    // ...
});
```

## Clear (many)

<mark style="color:purple;">`PATCH`</mark> `https://api.dev.medable.com/your_org_name/v2/notifications/object_name/object_id`

#### Path Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| your\_org\_name | string |             |
| object\_name    | string |             |
| object\_id      | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
    "object": "result",
    "data": 1
}
```

{% endtab %}

{% tab title="400 " %}

```
{}
```

{% endtab %}
{% endtabs %}

```javascript
$.ajax({
    url: "https://api.dev.medable.com/example/v2/notifications/c_examples/5519c01aae2fd2b02915c81f?type=4e6620436e6e637443727464",
    method: "DELETE",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    }
}).done(function(data) {
    // ...
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.medable.com/cortex-api/objects/notifications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
