開発者向け機能:サーバスクリプト:notification.Send
## 概要
生成、設置情報を取得した通知のオブジェクトを用いて、任意のタイミングで通知を送信します。
## 前提条件
「[Notification.json](/manual/notification-json)」の対象の通知種別(Mail等)を true に設定することが必要です。
## 構文
```
notification.Send()
```
## 戻り値
通知を送信できた場合は true、送信できなかった場合は false を返却します。
## 使用例
#### メール
以下の例では、xxxxx@example.com へタイトルが "通知テスト"、内容が "サーバスクリプトから通知しています" の通知を行います。
##### JavaScript
```
let notification = notifications.New();
notification.Address = 'xxxxx@example.com';
notification.Title = '通知テスト';
notification.Body = 'サーバスクリプトから通知しています。';
notification.Send();
```
#### Teams
以下の例ではTeamsへ通知を送信します。(Teamsへの通知には事前に設定が必要です。下例の"notification.Address"についてはマニュアル「[Microsoft Teamsに通知できるように設定する](/manual/teams)」の"アドレス"欄の設定を参照ください。)
##### JavaScript
```
let notification = notifications.New();
notification.Type = 6; //通知先Teamsの指定
notification.Address = 'https://***/***'; //通知先Teamsのwebhook urlを指定
notification.Title = '通知テスト';
notification.Body = 'サーバスクリプトから通知しています。';
notification.Send();
```
#### Slack
以下の例ではSlackへ通知を送信します。(Slackへの通知には事前に設定が必要です。下例の"notification.Address"についてはマニュアル「[Slackに通知できるように設定する](/manual/slack)」の"アドレス"欄の設定を参照ください。)
##### JavaScript
```
let notification = notifications.New();
notification.Type = 2; //通知先Slackの指定
notification.Address = 'https://hooks.slack.com/***';
notification.Title = '通知テスト';
notification.Body = 'サーバスクリプトから通知しています。';
notification.Send();
```
#### Chatwork
以下の例ではChatworkへ通知を送信します。(Chatworkへの通知には事前に設定が必要です。下例の"notification.Address"、"notification.Token"についてはマニュアル「[Chatworkに通知できるように設定する](/manual/chatwork)」の"アドレス"欄、"トークン"欄の設定を参照ください。)
##### JavaScript
```
let notification = notifications.New();
notification.Type = 3 //通知先Chatworkの指定
notification.Token = '***';
notification.Address = 'https://api.chatwork.com/***';
notification.Title = '通知テスト';
notification.Body = 'サーバスクリプトから通知しています。';
notification.Send();
```
## 注意事項
こちらは「[サーバスクリプト](/manual/table-management-server-script)」で使用するメソッドです。「[スクリプト](/manual/table-management-script)」では使用できません。
## 関連情報
・[テーブルの管理:サーバスクリプト](/manual/table-management-server-script)
・[オブジェクトごとの実行タイミング](/manual/server-script-conditions)
・[notificationsオブジェクト](/manual/server-script-notifications)
・[notificationオブジェクト](/manual/server-script-notification)
・[notifications.Newメソッド](/manual/server-script-notifications-new)
・[notifications.Getメソッド](/manual/server-script-notifications-get)