Skip to content

Instantly share code, notes, and snippets.

View phm200's full-sized avatar

Peter Miller phm200

View GitHub Profile
@phm200
phm200 / index.js
Created September 11, 2018 21:16
Connect User API Epress App - index.js
const express = require("express");
const app = express();
const AWS = require("aws-sdk");
require("express-async-errors");
const connectInstanceId = "7f03...";
var connectClient = new AWS.Connect({
apiVersion: "2017-08-08",
region: "us-east-1"
@phm200
phm200 / index.pug
Created September 11, 2018 21:17
Connect User API Express App - index pug view
html
head
title= title
link(rel="stylesheet" href="css/base.css")
body
h2= "Users in my Connect Instance (" + dataList.length + ")"
ul
each val in dataList
li
a(href="user/" + val.Id) #{val.Username}
@phm200
phm200 / user.pug
Created September 11, 2018 21:18
Connect User API Express App - user pug view
html
head
title= title
link(rel="stylesheet" href="../css/base.css")
body
h2= "Details for " + user.Username
ul
li= "ARN: " + user.Arn
li= "First Name: " + user.IdentityInfo.FirstName
li= "Last Name: " + user.IdentityInfo.LastName
@phm200
phm200 / index.js
Created October 1, 2018 19:32
Connect Contact Attributes API
app.post("/submit-updateAttributes", async (req, res) => {
const contactId = req.body.contactId;
const flagForFollowUpRaw = req.body.flagForFollowUp; // will equal "on" if checked, undefined if false
const flagForFollowUp = flagForFollowUpRaw && flagForFollowUpRaw === "on";
var updateContactAttributesParams = {
InstanceId: connectInstanceId,
InitialContactId: contactId,
Attributes: {
FlaggedForFollowUp: flagForFollowUp.toString()
@phm200
phm200 / index.js
Last active October 1, 2018 19:49
Connect Current Metrics API
const qArns = [
"arn:aws:connect:...",
"arn:aws:connect:..."
];
const metricsList = [
{
Name: "AGENTS_AVAILABLE",
Unit: "COUNT"
},