Skip to content

Amazon SQS and EventBridge configuration

This article explains how to send the call events of Genesys Cloud to an Amazon SQS queue in your AWS account, and how to let MiaRec read that queue.

The events take the following path:

Genesys Cloud → EventBridge partner event source → EventBridge event bus → rule → SQS queue → MiaRec

Before you begin:

  • Use one AWS region for the Genesys Cloud integration, the event bus, and the queue.
  • Create a queue for MiaRec only. Each message is delivered to one reader. If another application reads the same queue, each of the two misses events. To send the same events to another application, add a second target to the rule.

Step 1. Create the SQS queue

  1. In the Amazon SQS console, select Create queue.
  2. Set the following values:

    • Type: Standard.
    • Name: for example, genesys-cloud-events-miarec. Use letters, digits, hyphens, and underscores.
    • Visibility timeout: keep the default, 30 seconds.
    • Message retention period: 14 days. The default is 4 days. Events that MiaRec can't read for longer than this period, for example during an outage, are lost.
    • Encryption: see the following note.
  3. Select Create queue.

  4. Note the AWS region, the AWS account ID (12 digits), and the name of the queue. All three are in the ARN of the queue: arn:aws:sqs:<region>:<account ID>:<queue name>.

Encryption of the queue

The events contain phone numbers and agent IDs. To encrypt the queue, select AWS KMS key (SSE-KMS) with a customer managed key. AWS documents that EventBridge needs a customer managed key, and that it can't send events to a queue that is encrypted with an AWS owned key. See Troubleshooting Amazon EventBridge and Amazon EventBridge targets.

Add this statement to the policy of the key:

{
  "Sid": "AllowEventBridgeToUseTheKey",
  "Effect": "Allow",
  "Principal": { "Service": "events.amazonaws.com" },
  "Action": ["kms:Decrypt", "kms:GenerateDataKey"],
  "Resource": "*"
}

Step 2. Add the EventBridge integration in Genesys Cloud

You need all permissions under Integrations > Integration, which the Master Admin role includes.

  1. In Genesys Cloud, go to Menu > IT and Integrations > Integrations and select Add Integration.
  2. Search for EventBridge, and select Install on the Amazon EventBridge Source card.
  3. On the Details tab, enter a name, for example MiaRec events.
  4. On the Configuration tab, enter the following values:

    • AWS account ID: the 12 digits of your AWS account.
    • Region: the AWS region of the queue, for example eu-central-1.
    • Event Source Suffix: for example, miarec. Up to 64 letters, digits, periods, hyphens, and underscores.
    • Topic Filtering: select the following topics.
    Topic MiaRec needs it to Required
    v2.detail.events.conversation.{id}.customer.end Learn that the customer left Yes
    v2.detail.events.conversation.{id}.user.end Learn that an agent left Yes
    v2.detail.events.conversation.{id}.customer.start Show calls while they are in progress Optional
    v2.detail.events.conversation.{id}.user.start Show calls while they are in progress Optional
    v2.detail.events.conversation.{id}.acw Complete a call when the agent finishes the after-call work Recommended
  5. Select Save.

  6. On the Details tab, turn the integration to Active, and confirm with Yes.

Within about five minutes, Genesys Cloud creates a partner event source in your AWS account.

The topics apply to the whole organization. You can add topics later without deactivating the integration. MiaRec uses any event that names a conversation, but each event costs a request to Genesys Cloud.

The start topics send more requests to Genesys Cloud

With the start topics, MiaRec asks Genesys Cloud about each call while it's in progress. With a high volume of calls, the requests can reach the rate limits of Genesys Cloud. Leave them out if you don't need to see calls while they are in progress. See Rate limits.

See Configure the Amazon EventBridge integration.

Step 3. Associate the partner event source with an event bus

  1. In the Amazon EventBridge console, in the same region, go to Partner event sources.
  2. Select the source aws.partner/genesys.com/cloud/<organization ID>/<suffix>. Its status is Pending.
  3. Select Associate with event bus, and confirm. The status changes to Active.

AWS creates an event bus with the same name as the source.

Warning

Until the source is associated with an event bus, AWS drops the events. They can't be recovered from AWS. The pull calls job can load those calls by polling. See Load the calls of the last 30 days.

See Receiving events from a SaaS partner with Amazon EventBridge.

Step 4. Create the rule

  1. In the Amazon EventBridge console, go to Rules, select the event bus of Genesys Cloud, and select Create rule.
  2. Enter a name, for example genesys-cloud-to-miarec.
  3. As the event pattern, enter:

    {
      "source": [{ "prefix": "aws.partner/genesys.com/cloud/" }]
    }
    
  4. As the target, select SQS queue and the queue from Step 1. Don't configure an input transformation: MiaRec expects the original event.

  5. Create the rule, and check that it's enabled.

Step 5. Let EventBridge write to the queue

The access policy of the queue must allow EventBridge to send messages. The EventBridge console usually adds the permission when you select the queue as a target.

Open the queue in the Amazon SQS console, and check that the Access policy has the following statement. If not, add it. Replace the region, account ID, queue name, organization ID, suffix, and rule name with your own.

{
  "Sid": "AllowEventBridgeToSendGenesysEvents",
  "Effect": "Allow",
  "Principal": { "Service": "events.amazonaws.com" },
  "Action": "sqs:SendMessage",
  "Resource": "arn:aws:sqs:eu-central-1:111122223333:genesys-cloud-events-miarec",
  "Condition": {
    "ArnEquals": {
      "aws:SourceArn": "arn:aws:events:eu-central-1:111122223333:rule/aws.partner/genesys.com/cloud/<organization ID>/<suffix>/genesys-cloud-to-miarec"
    }
  }
}

See Using resource-based policies for Amazon EventBridge.

Step 6. Create an access key for MiaRec

MiaRec reads the queue with the access key of an IAM user.

  1. In the IAM console, create a user for MiaRec, for example miarec-genesys-events, without console access.
  2. Attach the following policy to the user. Replace the ARN with the ARN of your queue.

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "sqs:ReceiveMessage",
            "sqs:DeleteMessage",
            "sqs:GetQueueAttributes"
          ],
          "Resource": "arn:aws:sqs:eu-central-1:111122223333:genesys-cloud-events-miarec"
        }
      ]
    }
    
  3. If the queue is encrypted with a customer managed key, also allow kms:Decrypt on that key.

  4. Create an access key for the user, and store the access key ID and the secret access key in a safe place.

On-premises deployments in AWS

If your MiaRec server runs in the same AWS account as the queue, the system operator can set up the integration to use the IAM role of the server (IAM Instance Profile). Grant the permissions to that role instead. You then don't need an access key, and MiaRec doesn't ask for one.

Step 7. Check that events arrive

Make a call in Genesys Cloud, and hang up. In the Amazon SQS console, Messages available of the queue increases within seconds.

Don't poll the queue for messages in the console after MiaRec is connected: a received message is hidden from MiaRec until the visibility timeout ends.

If no message arrives, see Troubleshooting.

Values for the next step

Value Example
AWS region eu-central-1
AWS account ID 111122223333
SQS queue name genesys-cloud-events-miarec
AWS access key ID AKIAIOSFODNN7EXAMPLE
AWS secret access key

Next step

Continue with Connect MiaRec to Genesys Cloud.