Business Productivity

Multi-Meeting Management with the Amazon Chime SDK

The paradigm shift in broader adoption of virtual events has been an exciting journey in technology. Schools, fitness studios, and non-profit groups are now able to host simultaneous classes with attendees joining from home. Event planners can host conference booths for speakers leading small group sessions all over the world.

Yet, effectively managing multiple meetings to host virtual conferences, affinity groups, and break-out sessions remains a challenge. Many existing platforms are not built for these types of engagements and cannot be customized for each organizations’ specific needs. These organizations have had to adapt and, inevitably, compromise on the experience they provide their clients through virtual sessions.

Effectively managing multiple meetings doesn’t need to be challenging. For example, an organization’s application could support a workflow where:

  1. An administrator schedules meeting “rooms” for their attendees
  2. Attendees join meeting rooms from a central landing page
  3. Attendees can come and go from different rooms as needed

With the Amazon Chime SDK, users can transform in-person events into virtually immersive customized experiences. In this blog, we extend the Amazon Chime SDK and integrate with other AWS services to show you how to schedule multiple, simultaneous meeting rooms for attendees to join. We will also show you how to deploy a demo application as a quick way to try out the features of the Amazon Chime SDK on your own.

Prerequisites

Demo Application Architecture

The demo described in this blog consists of a web portal for admins to schedule the rooms, as well as a portal for attendees to join the rooms scheduled by the admins.

The figure below depicts the high level architecture diagram:

  1. Users (admins and attendees) navigate to the application home page, a React web application hosted on Amazon Simple Storage Service (S3) fronted by Amazon CloudFront.
  2. Upon sign in, the application directs the user to a custom Amazon Cognito sign in/sign up component. Once the user is authenticated, Amazon Cognito returns the user profile to the application. The application then uses the Amazon Cognito User Group within the user profile to determine which level of access to provide the user.
  3. Based on the user’s level of access, the user can interact with back-end resources via Amazon API Gateway. Amazon API Gateway will trigger the AWS Lambda function that corresponds with the RESTful API request.
  4. The triggered AWS Lambda function will make calls to the Amazon Chime SDK APIs and/or the Amazon DynamoDB APIs to perform the corresponding CRUD operations.
    • The Amazon Chime SDK is used to perform key tasks for the group of people gathered in a room, such as starting a room, adding an attendee to a room, listing attendees in a room, etc. To read more about the APIs available for the Amazon Chime SDK, click here.
    • The Amazon Chime SDK does not include any functionality for scheduling meetings in advance on its own. When you create a meeting, you have to use it immediately. This demo uses a series of AWS Lambda functions in conjunction with two Amazon DynamoDB tables to allow admins to store meeting data such as time, date, and name, so the meeting room can be created at its scheduled start time.

Deploying the Demo

The code shown in this blog can be found here. Follow the README for more instructions. The demo uses Amazon Cognito Groups to differentiate between attendee and administrator access; you may want to integrate your application’s identity model in a production application.

  1. Follow the steps outlined in the prerequisites
  2. Download/clone the GitHub repository
  3. Deploy the demo by running the ./deploy.sh script

Note that deploying this demo can incur AWS charges.

Exploring the Demo Application

The following sections cover key steps to using and understanding the deployed sample.

Scheduling Meeting Rooms

Using Google Chrome as your browser, navigate to the URL for your application outputted from the command line upon deployment. Create an admin user through the login/signup page, and confirm the user with the verification code you receive over email. In the AWS console, add the user to the “admin” group following these instructions.

Admin users can access the Admin page to schedule meeting rooms.

The screenshot above shows the “Schedule Room” form on the Admin Page. When you click on submit, a REST API call invokes an AWS Lambda function to put the form values in an Amazon DynamoDB table. After the scheduled start time, attendees can view and join the active rooms on the home page.

The code snippet below shows a function that schedules a room using the information from the above form. The start time and duration of the scheduled room create an Amazon DynamoDB Time-To-Live (TTL) that will automatically expire the item in the table at the room’s end time.

scheduleMeeting = async (title, startTime, duration, topic, region) => {
   try {
      //Use start time and duration to find epoch end time
      const endTime = parseInt(startTime) + (duration * 60); 
      
      //Use outside function to generate a unique ID that is used as a primary key
      const id = exports.uuid(); 
      
      await ddb.putItem({ 
        TableName: scheduleTableName,
        Item: {
            'uuid': { 'S': id },
            'meetingName' : { 'S': title },
            'startTime' : { 'N': '' + startTime },
            'duration' : { 'N': '' + duration },
            'topic' : { 'S': topic },
            'region' : { 'S': region },
            'TTL' : {
                N: '' + endTime
            } 
        }
      }).promise();
    }
    catch (error) {
      console.log(error);
      response.body = JSON.stringify(error);
    }
  }

Within the form, the admin sees the start time displayed in their local time zone; however the startTime variable above represents the UNIX epoch conversion. We handle this conversion on the front-end as follows:

let startTime = Math.round(Date.parse(startTime)/1000);

The JavaScript Date function returns the number of milliseconds since January 1, 1970, UTC. We divide this value by 1000 to store the time in seconds, consistent with both UNIX epoch and Amazon DynamoDB Time-To-Live.

Joining a Room

Amazon Chime SDK meetings automatically delete themselves after a period of inactivity, which presents a challenge for scheduling meetings over a period of time. Therefore, the demo only creates an Amazon Chime SDK meeting for a scheduled room when the first attendee joins. If the meeting is deleted, it is recreated via an API call to the Amazon Chime SDK when the next attendee goes to join the room. The below code snippet demonstrates the process of either finding an existing meeting or creating a new one.

//Use outside function to call chime.listMeetings()
let data = await utils.getMeetings();
  
  let meetingInfo = null;
  if (data !== null && data !== undefined ) {
    for (let meeting of data['Meetings']) {
      if (title == meeting['ExternalMeetingId']) {
        meetingInfo = meeting;
      }
    }
  }
  
 if (!meetingInfo || meetingInfo == null) {
    const request = {
      ExternalMeetingId: title,
      ClientRequestToken: utils.uuid(),
      MediaRegion: region,
    };
    
    console.info('Creating new meeting before joining: ' + JSON.stringify(request));
    meetingInfo = await chime.createMeeting(request).promise();
    meetingInfo = await meetingInfo.Meeting;
    await utils.putMeeting(title, meetingInfo);
 }

The snippet uses a function in the Utils Lambda Layer (utils.getMeetings) that calls chime.listMeetings to return a list of active meetings in your AWS account. Note that if an AWS account has dozens of active meetings at once, this API call may throttle.

Once the list of active meetings is returned, the function checks if any match the external meeting ID/room title. If there is a match, the attendee will automatically join that meeting. If not, a new meeting is created and the attendee added.

Cleanup

If you no longer want to keep the demo active in your AWS account and wish to avoid incurring AWS charges, you can remove the demo with the following commands:

export CDK_DEPLOY_REGION=<deployment-region>
cdk destroy MeetingBackEnd
cdk destroy MeetingFrontEnd

Conclusion

This blog is a guide for developers describing how to build scheduled room experiences with the Amazon Chime SDK. You can find the demo application described in this blog on GitHub. To learn more about adding audio, video, and screen sharing to your own applications with Amazon Chime SDK, read the developer guide or find the Amazon Chime SDK React Component Library on GitHub.

Maggie Krummel

Maggie Krummel

Maggie is a Solutions Architect at Amazon Web Services (AWS) working with nonprofit organizations (NPOs). Her areas of interest are analytics, artificial intelligence (AI), and call centers. She is based out of Austin, TX where she enjoys paddle boarding and live music.

Angela Wieber

Angela Wieber

Angela Wieber is a Solutions Architect supporting State & Local Government and K-12 organizations as they solve day-to-day problems and innovate using AWS. She is based in Austin, TX, where she enjoys live music and eating BBQ. Angela has a Bachelors degree in Math and Computer Science from Temple University. She has been at AWS just over two years, and specializes in call centers and other communication-based services.