Feature Announcement: Amazon SQS Support for Chat Events

Matheus C.
Matheus C.
Published January 21, 2021

A chat app generates many events throughout the day. Messages are sent and deleted, channels are created, users join them, and so on. Sometimes, it's essential to respond to these events automatically, for example, by triggering a bot message, billing a credit card, or calling a cab. Responding to these events through webhooks is one of the ways you can use Stream Chat to power a unique experience for your users that goes beyond text-based communication.

To make responding to chat events even better, we've introduced support for Amazon SQS as an alternative to webhooks. By using Amazon SQS instead of webhooks, you'll have more flexibility and reliability in the way you handle these events. It will be possible to access the queue of events from multiple services, and the events won't get lost due to a dead or struggling webhook endpoint.

Configuration

Configuring your Stream Chat app to send events to your SQS queue is simple. You need to update the SQS_url, SQS_key, and SQS_secret settings:

// set your SQS queue details
await client.updateAppSettings({
	SQS_url: 'https://SQS.us-east-1.amazonaws.com/123456789012/MyQueue',
	SQS_key: 'yourkey',
	SQS_secret: 'yoursecret',
});

//send a test message
await client.testSQSSettings();

Permissions

You'll also need to make sure the right permissions are in place in your SQS queue. If you're not receiving events in your queue, make sure you add the following permission policy:

{
    "Version": "2012-10-17",
    "Statement": [
      {
        "Sid": "Stmt1459523779000",
        "Effect": "Allow",
        "Action": [
          "sqs:GetQueueUrl",
          "sqs:SendMessage",
         "sqs:SendMessageBatch",
         "sqs:GetQueueAttributes"
       ],
       "Resource": [
         "arn:aws:sqs:region:acc_id:queue_name"
       ]
     }
   ]
}

We're excited to bring yet another feature to help you make your app stand out from the rest. For more information about this new feature, see the documentation on SQS.

If you need help or have specific feedback about this feature, please leave a comment on the documentation page.

Integrating Video with your App?
We've built a Video and Audio solution just for you. Check out our APIs and SDKs.
Learn more ->