Home / All Integrations / Amazon SQS

free

Connect Amazon SQS to your chatbot

Send messages to an Amazon SQS queue


Send messages to an Amazon SQS queue.

Please refer to Amazon's documentation regarding the capabilities and limitations of Amazon SQS!
You will need valid AWS credentials as well as an existing Amazon SQS queue.

The IAM user for this App must have the following permissions:

{
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "sqs:SendMessage",
      "Resource": "*"
    }
  ]
}

You can also refer to this page for more information on IAM permissions regarding Amazon SQS.

You can configure the queue URL as a global environment variable or override this setting for each call.

Example

Send one message to a queue:

Sending individual messages is quite simple:

do App(
  "aws/sqs",
  message="I am a message",
  delay=60, // optional delay before the message becomes visible in the queue
  queue_url="https://sqs.eu-west-1.amazonaws.com/ACCOUNT_ID/my-queue-name", // optional, can also be set as an environment variable if you always use the same queue
)

Send multiple messages in batch to a queue:

To send multiple messages at once, you can also use the advanced Batch mode where batch_messages contains an array of properly formatted Entries as defined here.

Note that only 10 entries can normally be sent in one batch, but this App will automatically split messages in multiple batches of 10 if you provide more than 10 entries! NB: if one of the message batches fails to send to SQS, previously sent batches will still have been sent to the queue.

do App(
  "aws/sqs",
  batch_messages=[{ "MessageBody": "message 1" }, { "MessageBody": "message 2" }],
)

Join the Community
on Slack Slack

Come and learn all about CSML with other chatbot enthusiasts on the CSML Community Slack! 🤗