getRealtimeMetrics.js - AWS Code Sample


getRealtimeMetrics.js demonstrates how to .

/** * Copyright 2010-2019, Inc. or its affiliates. All Rights Reserved. * * This file is licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. A copy of * the License is located at * * * * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ /* This code uses callbacks to handle asynchronous function responses. It currently demonstrates using an async-await pattern. AWS supports both the async-await and promises patterns. For more information, see the following: */ const aws = require('aws-sdk') const connect = new aws.Connect({ apiVersion: '2017-08-08' }) const params = { CurrentMetrics: [{ Name: 'AGENTS_AVAILABLE', Unit: 'COUNT' }], Filters: { Channels: ['VOICE'], Queues: ['yourQueueID'] // replace 'yourQueueID' with your Queue ID }, InstanceId: 'yourInstanceID' // replace 'yourInstanceID' with your Instance ID } exports.handler = async (event) => { const data = await connect.getCurrentMetricData(params).promise() console.log(data) var str = JSON.stringify(data, null, 2) console.log(str) }

Sample Details

Service: connect

Last tested: 2019-10-17

Author: Doug-AWS

Type: full-example