NotifyNow (レガシー) - グローバル

  • リリースバージョン: Washingtondc
  • 更新日 2024年02月01日
  • 読む27読むのに数分
  • 従来の NotifyNow API には、メールの送信、SMS メッセージの送信、および電話会議の設定を行う機能があります。

    システム上のアプリケーションで Notify 機能を使用する場合に、この API を使用します。
    注:
    この API はレガシー Notify 機能に含まれています。現在の Notify 機能に含まれる API については、NotifyNotifyActionNotifyPhoneNumber、および NotifyClient API を参照してください。

    NotifyNow - addConferenceCallParticipant(文字列 conferenceCall, 文字列 participant)

    アドホック ユーザーを進行中の電話会議に追加します。

    メソッドが参加者パラメーターのための電話番号で呼び出され、電話番号と一致する sys_user レコードが 1 つだけある場合、その sys_user レコードは参加者に関連付けられます。電話番号が sys_user レコード内にあるため、参加者の電話番号フィールドは空白のままになります。電話番号と一致する複数の sys_user レコードがある場合、または結果がない場合は、参加者の電話番号フィールドが入力され、ユーザーが不明であるため sys_user へ保存される参照はありません。

    表 : 1. パラメーター
    名前 タイプ 説明
    conferenceCall 文字列または GlideRecord アクティブな電話会議の sys_id または GlideRecord です。
    participant 文字列または GlideRecord E.164 準拠の電話番号、または E.164 準拠の電話番号を持つユーザーの sys_id または GlideRecord です。
    表 : 2. 返される内容
    タイプ 説明
    GlideRecord 電話会議に追加された新しい参加者の参加者レコードです。
    // add a new participant by conference call sys_id (string) and phone number (string) 
    var nn = new SNC.NotifyNow();
    gs.log(nn.addConferenceCallParticipant('d193b242eb020100a04d4910f206fe39', '+31612345678'));
    // add a new participant by conference call sys_id (string) and user record (GlideRecord)
    var user = new GlideRecord('sys_user');
    user.query('user_name', 'myUserName');
    if (user.hasNext() && user.next()) {
        var nn = new SNC.NotifyNow();
        gs.log(nn.addConferenceCallParticipant('d193b242eb020100a04d4910f206fe39', user));
     
        // you could have added the user by sys_id as well:
        // nn.addConferenceCallParticipant('d193b242eb020100a04d4910f206fe39', user.getValue('sys_id'));
    } else {
        gs.log('no such user');
    }
    // add a new participant by conference call record (GlideRecord) and phone number (string)
    var conferenceCall = new GlideRecord('notifynow_conference_call');
    conferenceCall.query('title', 'IA0001001');
    if (conferenceCall.hasNext() && conferenceCall.next()) {
        var nn = new SNC.NotifyNow();
        gs.log(nn.addConferenceCallParticipant(conferenceCall, '+31612345678'));
    } else {
        gs.log('no such conference call');
    }

    NotifyNow - getReadyState()

    Notify が正しく設定されているかどうかを示します。

    このメソッドにアクセスできるのは、notifynow_admin ロールを持つ管理者またはユーザーのみです。これ以外のロールを持つユーザーがスクリプトでこの関数を実行しようとすると、False というメッセージが送信されます。

    表 : 3. パラメーター
    名前 タイプ 説明
    なし
    表 : 4. 返される内容
    タイプ 説明
    ブーリアン Notify が正しく設定されている場合は True、それ以外の場合は False です。
    var nn = new SNC.NotifyNow();
    gs.log(((nn.getReadyState()) ? "OK" :  "NOT OK"));

    NotifyNow - getStatus()

    Notify 構成の現在のステータスを返します。

    このメソッドにアクセスできるのは、notifynow_admin ロールを持つ管理者またはユーザーのみです。これ以外のロールを持つユーザーがスクリプトでこの関数を実行しようとすると、未承認というメッセージが送信されます。

    表 : 5. パラメーター
    名前 タイプ 説明
    なし
    表 : 6. 返される内容
    タイプ 説明
    文字列 可能なステータスメッセージの 1 つ。
    ステータス 説明
    NO_NUMBER_MESSAGE アカウントに電話番号が設定されていません。アカウントの電話番号を設定してください。
    NO_ENDPOINTS_MESSAGE アカウントのエンドポイントが正しく設定されていません。アカウントのエンドポイントを設定してください。
    ACCOUNT_OK_MESSAGE アカウントは有効であり、使用可能です。
    ACCOUNT_NO_AUTH Twilio AuthToken が無効です。
    ACCOUNT_NOT_CONFIGURED Twilio AccountSID または AuthToken が無効です。
    var nn = new SNC.NotifyNow();
    gs.log(nn.getStatus());

    NotifyNow - initiateConferenceCall(文字列[] conferenceCallParticipants, 文字列 conferenceCallTitle)

    新しい電話会議を開始します。

    表 : 7. パラメーター
    名前 タイプ 説明
    conferenceCallParticipants 文字列 sys_user テーブルまたは E.164 準拠の電話番号から sys_ids によって識別される 1 人以上のユーザーである電話会議参加者です。
    conferenceCallTitle 文字列 電話会議のタイトルです。このパラメーターの最大長は 40 文字です。
    表 : 8. 返される内容
    タイプ 説明
    GlideRecord 電話会議レコード、またはエラーがあった場合は nullです。

    これにより、オプションのソースレコードパラメータを使用せずに参加者用の E.164 準拠の電話番号で電話会議が開始され、SMS またはメールでは電話会議の詳細が送信されません。

    var participants = ['+31205655548', '+31205655552', '+31652825393'];
    // set up conference call
    var nn = new SNC.NotifyNow();
    var conferenceCall = nn.initiateConferenceCall(participants, "testing12");
    gs.log('started conference call: ' + conferenceCall.getUniqueValue());

    NotifyNow - initiateConferenceCall(文字列[] conferenceCallParticipants, 文字列 conferenceCallTitle, GlideRecord sourceRecord, ブール private)

    新しい電話会議を開始します。

    表 : 9. パラメーター
    名前 タイプ 説明
    conferenceCallParticipants 文字列 sys_user テーブルまたは E.164 準拠の電話番号から sys_ids によって識別される 1 人以上のユーザーである電話会議参加者です。
    conferenceCallTitle 文字列 電話会議のタイトルです。このパラメーターの最大長は 40 文字です。
    sourceRecord GlideRecord インシデントまたは問題番号などの電話会議に関連付けるソースレコード。
    private ブーリアン 電話会議が非公開であるかどうかをコントロールする値。この値のデフォルトは False です。
    表 : 10. 返される内容
    タイプ 説明
    GlideRecord 電話会議レコード、またはエラーがあった場合は nullです。

    これにより、E.164 に準拠した電話番号を持つ参加者と sys_user テーブルの参加者による電話会議が開始され、SMS および電子メールで電話会議の詳細がすべての参加者に送信されます。

    // define phone number participants
    var participants = ['+31205655548', '+31205655552', '+31652825393'];
     
    // we also want to add two Dutch sys_user participants
    var user = new GlideRecord('sys_user');
    user.addNotNullQuery('mobile_phone');
    user.addQuery('mobile_phone', 'STARTSWITH', '+316');
    user.setLimit(2);
    user.query();
     
    // add users to the participant array
    while (user.hasNext() && user.next()) {
    	gs.log('adding user ' + user.getValue('name') + ' with phone number ' + 
                 user.getValue('mobile_phone') + ' to the participant array');
    	participants.push(user.getUniqueValue());
    }
     
    // define a source record to associate with the conference call
    var source = new GlideRecord("cmdb_ci");
    source.query("asset_tag", "P1000167");
    if (source.hasNext() && source.next()) {
    	// set up conference call
    	var nn = new SNC.NotifyNow();
    	var conferenceCall = nn.initiateConferenceCall(participants, "testing 1 2", source);
     
    	// check if the conference call was successfully created
    	if (conferenceCall != null) {
    		gs.log('started conference call: ' + conferenceCall.getUniqueValue());
    	} else {
    		gs.log('could not start the conference call :(');
    	}
    }

    NotifyNow - isCallable(文字列 participant)

    ユーザーがコール可能かどうかを決定します。

    ユーザーは、コール可能な有効な電話番号を持っている必要があります。すでにアクティブなセッションにいるユーザーは、コール可能ではありません。

    表 : 11. パラメーター
    名前 タイプ 説明
    participant 文字列または GlideRecord sys_user レコードまたは notifynow_participant レコード、または E.164 準拠の電話番号です。
    表 : 12. 返される内容
    タイプ 説明
    ブーリアン この参加者を呼び出すことができるかどうか。
    var nn = new SNC.NotifyNow();
    gs.log('by number: ' + nn.isCallable('+31612345678'));
     
    var user = GlideRecord('sys_user');
    user.query('sys_id', '13d39544eb5201003cf587b9d106fea9');
    if (user.hasNext() && user.next())
      gs.log('by user: ' + nn.isCallable(user));
     
    var participant = GlideRecord('notifynow_participant');
    participant.query('sys_id', '33b11430eb1201003cf587b9d106feb9');
    if (participant.hasNext() && participant.next())
      gs.log('by participant: ' + nn.isCallable(participant));

    NotifyNow - isSMSCapable()

    Twilio アカウントに関連付けられた電話番号で SMS メッセージを送信できるかどうかを確認します。

    表 : 13. パラメーター
    名前 タイプ 説明
    なし
    表 : 14. 返される内容
    タイプ 説明
    ブーリアン Twilio アカウントに関連付けられた電話番号で SMS メッセージを送信できるかどうか。
    gs.log('The twilio number is SMS capable: ' + ((new SNC.NotifyNow().isSMSCapable()) ? 'yes' : 'no'));

    NotifyNow - isSMSCapable(文字列 userID)

    ユーザーが SMS メッセージを送信できるかどうかを確認します。

    表 : 15. パラメーター
    名前 タイプ 説明
    userID 文字列 SMS 対応の電話番号を確認する対象となるユーザーの sys_id です。
    表 : 16. 返される内容
    タイプ 説明
    ブーリアン ユーザーが SMS メッセージを送信できるかどうか。
    gs.log('the user is able to send SMS messages (e.g. has a SMS device): ' + ((new SNC.NotifyNow().isSMSCapable('<user sys_id>')) ? 
         'yes' : 'no'));

    NotifyNow - isVoiceCapable()

    Twilio アカウントに関連付けられた電話番号が電話を設定できるかどうかを確認します。

    表 : 17. パラメーター
    名前 タイプ 説明
    なし
    表 : 18. 返される内容
    タイプ 説明
    ブーリアン Twilio アカウントに関連付けられた電話番号が電話を設定できるかどうか。
    gs.log('the Twilio number is Voice capable: ' + ((new SNC.NotifyNow().isVoiceCapable()) ? 'yes' : 'no'));

    NotifyNow - isVoiceCapable(文字列 userID)

    ユーザーが音声通話を行うことができるかどうかを確認します。

    表 : 19. パラメーター
    名前 タイプ 説明
    userID 文字列 音声通話対応の電話番号を確認する対象となるユーザーの sys_id です。
    表 : 20. 返される内容
    タイプ 説明
    ブーリアン ユーザーが音声通話対応の電話番号を持っているかどうか。
    gs.log('the user is able to send SMS messages (e.g. has a SMS device): ' + 
         ((new SNC.NotifyNow().isVoiceCapable('someuserid')) ? 'yes' : 'no'));

    NotifyNow - kick(GlideRecord participant)

    電話会議から参加者を削除します。

    表 : 21. パラメーター
    名前 タイプ 説明
    participant GlideRecord 通話から削除する電話会議参加者です。
    表 : 22. 返される内容
    タイプ 説明
    ブーリアン 参加者が削除された場合は True、それ以外の場合は False です。
    var participantId = "<participant sys_id>";
    var participant = new GlideRecord('notifynow_participant');
    participant.get(participantId);
    if (participant.isValid()) {
         // kick participant
         result = new SNC.NotifyNow().kick(participant);
         gs.log('participant kicked: ' + result);
    }

    NotifyNow - mute(GlideRecord participant)

    電話会議で参加者をミュート状態にします。

    表 : 23. パラメーター
    名前 タイプ 説明
    participant GlideRecord ミュート状態にする電話会議参加者です。
    表 : 24. 返される内容
    タイプ 説明
    ブーリアン 参加者がミュート状態になっていた場合は True、それ以外の場合は False です。
    var participantId = "<participant sys_id>";
    var participant = new GlideRecord('notifynow_participant');
    participant.get(participantId);
    if (participant.isValid()) {
         // mute participant
         result = new SNC.NotifyNow().mute(participant);
         gs.log('participant muted: ' + result);
    }

    NotifyNow - umute(GlideRecord participant)

    電話会議で参加者のミュート状態を解除します。

    表 : 25. パラメーター
    名前 タイプ 説明
    participant GlideRecord ミュート解除するミュート状態の電話会議参加者です。
    表 : 26. 返される内容
    タイプ 説明
    ブーリアン 参加者がミュート解除されている場合は true、それ以外の場合は false。
    var participantId = "<participant sys_id>";
    var participant = new GlideRecord('notifynow_participant');
    participant.get(participantId);
    if (participant.isValid()) {
         // unmute participant
         result = new SNC.NotifyNow().unmute(participant);
         gs.log('participant unmuted: ' + result);
    }

    NotifyNow - sendEmailQuestion(文字列 emailAddress, 文字列 question, GlideRecord sourceRecord, 文字列 emailSubject)

    メールの質問をメールアドレスに送信します。

    sendEmailQuestion メソッドは質問本文を作成し、ユーザーが選択肢を示すためにリンクをクリックする必要があります。

    表 : 27. パラメーター
    名前 タイプ 説明
    emailAddress 文字列 質問の送信先のメールアドレスです。
    question 文字列または GlideRecord 送信する質問レコードまたは質問レコードの sys_id です。
    sourceRecord GlideRecord インシデントなどの SMS 質問に関連付けるオプションのソースレコード。
    emailSubject 文字列 デフォルトのメールの件名を上書きするためのオプションのテキストです。
    表 : 28. 返される内容
    タイプ 説明
    文字列 会話の sys_id です。

    この例では、デフォルトのメールの件名を使用して実証しています。

    var user = GlideRecord("sys_user");
    user.get("email", "someone@somedomain.com");
     
    new SNC.NotifyNow().sendEmailQuestion(user.getValue('email'), "b6b34500bf3111003cf585ce2c0739ce", user);

    この例では、ドット連結を使用し、ソースレコードとメールの件名を指定します。

    new SNC.NotifyNow().sendEmailQuestion("someone@somedomain.com", "b6071733bf1111003cf585ce2c07390f", current, 
            "Please answer this question");

    この例では、ドット連結を使用し、メールの件名を指定しますが、ソース レコードは指定しません。

    new SNC.NotifyNow().sendEmailQuestion("someone@somedomain.com", "b6071733bf1111003cf585ce2c07390f", 
            "Please answer this question");

    NotifyNow - sendSMS(文字列 phoneNumber, 文字列 smsBody)

    SMS メッセージを E.164 に準拠した携帯電話番号に送信します。

    Notify は国際電話番号をサポートしています。SMS メッセージの送信をサポートしていない番号でこのメソッドを使用すると、エラーがログに記録されます。

    表 : 29. パラメーター
    名前 タイプ 説明
    phoneNumber 文字列 メッセージの送信先の E.164 に準拠した電話番号です。
    smsBody 文字列 送信するメッセージ、最大 1600 文字です。
    表 : 30. 返される内容
    タイプ 説明
    なし
    new SNC.NotifyNow().sendSMS("+31612345678", "This is a message without source record");

    NotifyNow - sendSMS(文字列 phoneNumber, 文字列 smsBody, GlideRecord source)

    SMS メッセージを E.164 に準拠した携帯電話番号に送信します。

    Notify は国際電話番号をサポートしています。SMS メッセージの送信をサポートしていない番号でこのメソッドを使用すると、エラーがログに記録されます。

    関連項目:SMS の詳細設定

    表 : 31. パラメーター
    名前 タイプ 説明
    phoneNumber 文字列 メッセージの送信先の E.164 に準拠した電話番号です。
    smsBody 文字列 送信するメッセージ、最大 1600 文字です。
    ソース GlideRecord この SMS メッセージに関連付けるソースレコード。
    表 : 32. 返される内容
    タイプ 説明
    なし
    var source = new GlideRecord("my_table");
    source.query("my_field", "my_value");
    
    if (source.hasNext() && source.next()) {
        // send a text message
        var nn = new SNC.NotifyNow();
        var message = "this is just a test";
        var number = "+31612345678";
        nn.sendSMS(number, message, source);
    }

    この例では、ドット連結と現在のレコードをソース レコードとして使用しています。

    new SNC.NotifyNow().sendSMS("+31612345678", "this is a test", current);

    NotifyNow - sendSMSQuestion(文字列 phoneNumber, 文字列 question, GlideRecord sourceRecord)

    SMS 質問を送信します。

    表 : 33. パラメーター
    名前 タイプ 説明
    phoneNumber メッセージの送信先の E.164 に準拠した電話番号です。
    question 文字列または GlideRecord 送信する質問レコードまたは質問レコードの sys_id です。
    sourceRecord インシデントなどの SMS 質問に関連付けるオプションのソースレコード。
    表 : 34. 返される内容
    タイプ 説明
    文字列 会話の sys_id。SMS が正常に送信されなかった場合は null です。
    var question = new GlideRecord("notifynow_question");
    question.query();
     
    // get the first question
    if (question.hasNext() && question.next()) {
    	// send the sms question
            var number = "+31612345678";
    	var nn = new SNC.NotifyNow();
    	nn.sendSMSQuestion(number, question.getUniqueValue(), current);
    }

    NotifyNow - convertLocalPhoneNumberToE164(文字列 userID, 文字列 phoneNumber)

    ユーザーの場所に基づいて、市内電話番号を E.164 準拠の電話番号に変換します。

    表 : 35. パラメーター
    名前 タイプ 説明
    userID 文字列 場所情報を取得する sys_user レコードの sys_id です。
    phoneNumber 文字列 電話番号です。
    表 : 36. 返される内容
    タイプ 説明
    文字列 E.164 準拠の電話番号です。
    var localPhoneNumber = '01784 221600';
    var userName = 'Heath Vanalphen';
     
    var user = new GlideRecord('sys_user');
    user.get('name',userName);
    var E164Number = new SNC.NotifyNow().convertLocalPhoneNumberToE164(user.getUniqueValue(), localPhoneNumber);
    gs.log('converted: ' + localPhoneNumber + ' to ' + E164Number + ' based on ' + user.getValue('name') + 
         '\'s location (' + user.getValue('location') + ')');

    NotifyNow - getConferenceCallParticipants(文字列 conferenceCallId, ブール isCallable)

    電話会議の参加者をすべて返します。

    表 : 37. パラメーター
    名前 タイプ 説明
    conferenceCallId 文字列 電話会議の ID です。
    isCallable ブーリアン 呼び出すことができるユーザー (True) または呼び出すことができないユーザー (False) のいずれかのみを返すためのオプションのフラグです。
    表 : 38. 返される内容
    タイプ 説明
    GlideRecord 参加者です。
    var nn = new SNC.NotifyNow();
    var user = nn.getConferenceCallParticipants('c2e91710eb120100f34087b9d106fe37');
     
    while (user.hasNext() && user.next()) {
        if (user.getValue('participant')) {
            gs.log('user: ' + user.getValue('sys_id'));
        } else {
            gs.log('phone number: ' + user.getValue('phone_number'));
        }
    }
    var nn = new SNC.NotifyNow();
    var user = nn.getConferenceCallParticipants('c2e91710eb120100f34087b9d106fe37', true);
     
    while (user.hasNext() && user.next()) {
        if (user.getValue('participant')) {
            gs.log('user: ' + user.getValue('sys_id'));
        } else {
            gs.log('phone number: ' + user.getValue('phone_number'));
        }
    }
    var conferenceCallId = '32b11430eb1201003cf587b9d106feb8';
     
    // get all participants
    gs.log('all conference call participants:');
    var nn = new SNC.NotifyNow();
    var user = nn.getConferenceCallParticipants(conferenceCallId);
    gs.log(user);
     
    // get all callable participants
    gs.log('all conference call participants we can call:');
    user = nn.getConferenceCallParticipants(conferenceCallId, true);
    gs.log(user);
     
    // get all un callable participants
    gs.log('all conference call participants that are already in an active session and whom we cannot call:');
    user = nn.getConferenceCallParticipants(conferenceCallId, false);
    gs.log(user);

    NotifyNow - getFrequentlyCalledUsers(Number limit)

    頻繁に呼び出される多数のユーザーを、制限パラメーターまでアルファベット順に返します。

    表 : 39. パラメーター
    名前 タイプ 説明
    limit 番号 結果の最大数です。
    表 : 40. 返される内容
    タイプ 説明
    GlideRecord アルファベット順に並べられた頻繁に呼び出されるユーザー。
    var nn = new SNC.NotifyNow();
    var fc = nn.getFrequentlyCalledUsers(10);
     
    while (fc.hasNext() && fc.next()) {
        gs.log("got user " + fc.getValue('name') + ' - ' + fc.getValue('sys_id'));
    }

    NotifyNow - getPreferredE164SMSNumber(GlideRecord ユーザー)

    ユーザーの優先する SMS メッセージの E.164 に準拠した電話番号を返します。

    表 : 41. パラメーター
    名前 タイプ 説明
    ユーザー GlideRecord または文字列 E.164 準拠の電話番号を取得するユーザーのユーザー レコードまたは sys_id。
    表 : 42. 返される内容
    タイプ 説明
    文字列 E.164 準拠の電話番号または null です。
    var userID = "<user sys_id>";
    var E164Number = new SNC.NotifyNow().getPreferredE164SMSNumber(userID);
    gs.log('the preferred phone number for sending SMS notifications is ' + E164Number + ' for user with id: ' + userID);

    NotifyNow - getPreferredE164VoiceNumber(GlideRecord ユーザー)

    ユーザーの優先する音声通話の E.164 に準拠した電話番号を返します。

    表 : 43. パラメーター
    名前 タイプ 説明
    ユーザー GlideRecord または文字列 E.164 準拠の電話番号を取得するユーザーのユーザー レコードまたは sys_id。
    表 : 44. 返される内容
    タイプ 説明
    文字列 E.164 準拠の電話番号または null です。
    var userID = "<user sys_id>";
    var E164Number = new SNC.NotifyNow().getPreferredE164VoiceNumber(userID);
    gs.log('the preferred phone number for setting up voice calls is ' + E164Number + ' for user with id: ' + userID);

    NotifyNow - getPreferredEmailAddress(GlideRecord user)

    ユーザーの優先メールアドレスを返します。

    表 : 45. パラメーター
    名前 タイプ 説明
    ユーザー GlideRecord または文字列 メールアドレスを取得するユーザーのユーザー レコードまたは sys_id。
    表 : 46. 返される内容
    タイプ 説明
    文字列 メールアドレスまたは null です。
    var userID = "some user sys id";
    var email = new SNC.NotifyNow().getPreferredEmailAddress(userID);
    gs.log('the preferred email address for sending email notifications is ' + email + ' for user with id: ' + userID);