# Notifications Module

Import

```
import notifications from 'notifications';
```

### Methods

[send(name, variables, options)](https://docs.medable.com/reference#section-send-name-variables-options-)

### send(name, variables, options)

Sends a custom notification to a single recipient.

**Arguments**

* `name` (String) the api name of the notification template.
* `variables` (Object) an object matching the variables in the matching notification handlebars template(s).
* `options`
  * `context` (Object) optional. If specified, a [notification object](https://docs.medable.com/reference#notification-object) will be persisted and associated with the context object. If omitted, a notification object is not persisted and it will not be possible to retrieve information about the notification via the notifications endpoint, nor will it be necessary to clear the notification manually.
    * `_id` (ObjectId)
    * `object` (String)
  * `locale` (String:en\_US)
  * `recipient` (ObjectId|Email:script.principal.\_id) A custom recipient. Defaults to the script's calling principal.
  * `apiKey` (String) An optional app key (eg. K0yscrO53AZqpisMmf0Nco), used to pin APNs/GCM push notifications to a single app.
  * `number` (String) a custom sending phone number for sms notifications. The phone number must be pre-configured in the administration interface under Settings -> Notifications.

### Examples

Notifications Example

```
// example 'after sign-in' script that notifies a list of account holders of all logins.
import notifications from 'notifications'

['admin@myorg.com', 'developer@myorg.com'].forEach((recipient) => {
   notifications.send('c_login_notify', { message: "hello there!" }, {recipient: recipient})
})
```


---

# 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/scripting/modules-1/notifications-module.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.
