Giter VIP home page Giter VIP logo

aws-connect-client's Introduction

Amazon Connect Client

This is an attempt at simplifying the interface between the Amazon Connect & Amazon ConnectParticipant services so that consumer applications can be fairly straightforward.

Problem

  • Amazon Connect requires different authentication tokens to be passed around in order to actually communicate with the service. To grab these authentication credentials, it requires interacting with two AWS services: Amazon Connect & Amazon ConnectParticipant.
  • Amazon have a client they have developed themselves (ChatJS) which seemingly doesn't handle the initial call required to be made with Amazon Connect in order to fetch the ParticipantToken.
  • ChatJS also has an extremely large bundle size (~1.7MB).

How to use

Initial setup of controller:

import { initialize, createController, ConnectParticipantController } from 'aws-connect-client';

const controller = async (): ConnectParticipantController => {
    const { client, connectionDetails } = await initialize();

    return createController(client, connectionDetails);
};

Usage (some form of callback for sending a message):

const handleSendMessage = async (): string => {
    try {
        const controller = controller(); // Store this in state to avoid re-creating the controller instance

        const response = await controller.sendMessage('Hello world!', 'text/plain');
        return response.AbsoluteTime;
    } catch (error) {
        console.error(error.message);
    }
};

aws-connect-client's People

Contributors

pmc-a avatar

Stargazers

Matt Tortolani avatar  avatar Benjamin Maisano avatar Indrajit Chakrabarty avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.