Perform an external screen pop with Amazon Connect
One of the most commonly asked questions we get when people begin using Amazon Connect is, “How can I pop my existing web-based application using data gathered in a contact flow?”
This post provides a comprehensive example that grabs the incoming data and uses it to pop an external web-based application a new window. It can be used as the foundation for more complex and customer-specific use cases. To accomplish this, we use:
That’s it! After you follow the steps in this post, you’ll have a functioning screen pop wrapper for Amazon Connect.
To complete the steps in this post, you need the following:
- An active AWS account.
- An Amazon Connect instance that has been configured for internal identity management and inbound calls (this simple example is not designed for SAML or Directory based authentication instances). After you create your instance, claim a phone number for it. For more information, see Getting Started with Amazon Connect.
Download and modify the wrapper sample
To simplify this example, here is a ZIP file that has everything required to make an external webpage open on call arrival. The ZIP file includes:
- An HTML wrapper for the Contact Control Panel (updated for CCP V2).
- A sample contact flow that provides the data used for the screen pop.
To download and modify the sample:
- Download the ZIP file from Amazon S3.
- Extract the contents of the ZIP file. It contains the three files that are used for this blog post.
- Find the newly extracted file named simple_screen_template.html. You must modify the HTML file to reference your connect instance.
- Open simple_screen_template.html with a text editor.
- At line 25, find the section marked:
/*************** Begin Mod Area ***************/
- Below that, on line 28, find the declaration for the variable instanceBase:
var instanceBase = "REPLACEME";
- Replace REPLACEME with your Amazon Connect access URL base, excluding anything after the base domain, for example:
var instanceBase = "https://myinstance.my.connect.aws";
- Lines 25 through 30 should now look similar to the following example:
- Save and close the file.
That’s the only modification you need to do. Next, upload two of these files to Amazon S3.
Upload to Amazon S3
Note: Make sure to log into the AWS Management Console using an account that has the appropriate IAM permissions to create Amazon S3 buckets, such as an IAM account, which belongs to the AdministratorAccess group.
To upload to Amazon S3:
- Open the Amazon S3 management console.
- Choose Create Bucket.
- Provide a unique name for your new bucket. Keep the other default settings, then at the bottom of the page, choose Create.
NOTE: You can change the default Region for this bucket; however, because the bucket is globally addressable, it is not required.
- The bucket is created almost immediately. After you return to the list of buckets, choose the name of the new bucket that you created.
- Choose Upload, then add your modified simple_screen_template.html file and the amazon-connect.min.js file. Choose Upload.
- Verify that the upload is successful, then Close the status page.
Creating an Amazon CloudFront distribution
Now that you have your custom screen pop page in S3, you will need to provide web access to that page so that you can log in as an Amazon Connect agent. Keeping with best practices, you will use Amazon CloudFront to securely deliver the page to your browser while protecting your S3 objects from public access.
To create a CloudFront distribution for your modified web page:
- Open the Amazon CloudFront console.
- Select Create distribution
- For the Origin domain, choose the S3 bucket that you created in the previous section.
- In the S3 bucket access section, select Yes use OAI (bucket can restrict access to only CloudFront).
- Choose Create new OAI, then select Create.
- Select the Bucket policy option Yes, update the bucket policy.
- Leave all other options as their default, and select Create distribution.
- On the Distribution detail page, note the Distribution domain name.
The distribution will take a few minutes to deploy. While it does, continue the process to integrate the distribution with your Amazon Connect Instance.
Integrating the CloudFront distribution with your Amazon Connect Instance
In this post, I use Amazon CloudFront to deliver the webpage that embeds the Amazon Connect Contact Control Panel (CCP) by using the Amazon Connect Streams API library. Because the embedded CCP must load within the webpage hosted on Amazon S3 and delivered by CloudFront, I must explicitly allow the domain for CloudFront to display the CCP. This protects customer data from being loaded in an unauthorized page, where the data could be exposed.
To allow embedded CCP in webpages delivered by CloudFront:
- Open the Amazon Connect console.
- Choose the name of the instance that you are using.
- On the left side of the console, choose the Approved origins
- Choose Add domain.
- In the Enter domain URL box, enter the URL of the CloudFront distribution that you created, prefixed with
https://. For example: https://mycloudfrontdistro.cloudfront.net
- Choose Add domain.
Import the Contact Flow and Assign it to a Phone Number
The wrapper is now set up and the CloydFront domain is allow-listed. The last step is to configure Amazon Connect to send the parameters required for the screenpop to happen. This is accomplished by setting parameters in a contact flow, and assigning that contact flow to an inbound phone number.
To import a contact flow
- Log in to your Amazon Connect instance. The account must be assigned a security profile that includes edit permissions for contact flows.
- Choose Routing, Contact flows.
- Choose the Create contact flow button in the upper right
- Choose the dropdown arrow next to Save, Import flow (beta).
- Select the contact flow that was extracted from the zip file, SimpleScreenPopExample, and choose Import.
- Select Publish, and confirm by again selecting Publish to make the contact flow available for use.Note: There may be a warning indicator on the Set Working Queue block in the contact flow. This is because I used an imported contact flow. The block references a queue by ARN, but ARNs are globally unique. When I import the contact flow, no queue with the ARN specified in the exported flow is found in your instance. Amazon Connect automatically resolves to the queue in your instance with the same name. If you renamed the default BasicQueue in Amazon Connect, you must select the appropriate queue.
The contact flow assigned to a phone number is the contact flow that executes when a call comes in to that number. So I’ll use the contact flow I just saved as the flow for this phone number. You can either claim a new number and assign the contact flow to it, or you can associate an existing number to the contact flow. If you associate an existing number, you disconnect it from the currently assigned contact flow, so don’t do this for a production environment where customers are placing calls to that number.
Note: If you claim an additional phone number, additional charges may be incurred for Amazon Connect. As part of the Free Tier, you can claim one DID number free of charge. For more information, reference the Amazon Connect Pricing page.
To claim a number for your contact center:
- Choose Routing, Phone numbers.
- Choose Claim a number in the top-right corner of the screen. You can choose a Toll free or a DID (Direct Inward Dialing) number.
- Enter a description for the number and in the Contact flow/IVR dropdown, choose SimpleScreenPopExample.
- Choose Save.
To associate a phone number with a contact flow:
- Choose Routing, Phone numbers.
- Select the number to edit, expand Contact flow/IVR, and choose SimpleScreenPopExample.
- Choose Save.
After you save the phone number, wait a couple of minutes before the change has propagated. Make a note of the phone number, because you need it to send calls to your agent.
Log in and take a call
Now that you have everything set up, the last step is to log in and take a call using your modified Contact Control Panel. Use the domain you saved earlier from your CloudFront distribution.
To log in and take a call:
- Open Chrome or Firefox.
- In the URL field, paste the full domain (with https://) of your CloudFrond distribution and add
/simple_screen_template.htmlto complete the URL. It should be similar to:
- When the page is loading, it displays a second tab to authenticate your agent.
NOTE: If the authentication window does not display, your browser’s pop-up blocker may be preventing it. For information about enabling pop-ups, check your browser.
- After the authentication completes, you are asked to allow notifications and microphone access. Grant both.
- Close the new tab.
- Make sure you (the agent) are in the Available state. If you are not set to Available, select the status dropdown menu and choose Available.
- Call into the number that you associated with your new contact flow.
- As the call is delivered, a new tab or browser window (depending on your browser settings) should open and display a search result.
You have successfully popped an external URL based on data within Amazon Connect.
How this screen pop works
You can easily modify these values in the contact flow by editing them in the Set contact attributes block. You could even use dynamic values from an AWS Lambda function call.
This post provided you with a working sample webpage that has an embedded Contact Control Panel that retrieves data from an incoming call using the streams API and builds a URL that opens in a new tab or window. This is the foundation for a screen pop function that can be modified to work in any number of use cases.