# AWS SQS

{% hint style="info" %}
The following documentation is for **AWS SQS v1.6.4** *(BDK)*.
{% endhint %}

## Overview

Amazon SQS (Simple Queue Service) provides managed message queuing for decoupling application components. This integration enables automated message processing, queue management, and asynchronous communication workflows. Improve application reliability and scalability through managed message queuing.

## Prerequisites

### 1. Required Books

The following Book(s) need to be added to your agent so it can learn and understand the automation procedures defined within them:

* **AWS SQS**

#### How to Add the Book(s)

1. Go to **Books** → **All Books**.
2. Search for the name of the book and click on it.
3. Click on <kbd>**Install**</kbd> or <kbd>**Add Connection**</kbd> to add the book to your agent.
4. If adding a connection, you'll be prompted for [**connectivity**](#connectivity) details.

## Connectivity

This section outlines the available methods for connecting to the Book, along with the required configuration details for each.

### Connect using AWS Access key ID, AWS Secret Access Key, AWS Region, AWS Role ARN and AWS External ID

Assumes a role using the provided AWS credentials.

| Label                 | Description                                                                | Type        |
| --------------------- | -------------------------------------------------------------------------- | ----------- |
| AWS Access key ID     | The AWS Access Key ID for the initial authentication.                      | `text`      |
| AWS Secret Access Key | The AWS Secret Access Key for the initial authentication.                  | `sensitive` |
| AWS Region            | The AWS Region for the initial authentication.                             | `text`      |
| AWS Role ARN          | The ARN of the role to assume.                                             | `text`      |
| AWS External ID       | An optional external ID that might be required by the role's trust policy. | `sensitive` |

### Connect using AWS Access key ID, AWS Secret Access Key and AWS Region

Connects to an API using the provided API key.

| Label                 | Description               | Type        |
| --------------------- | ------------------------- | ----------- |
| AWS Access key ID     | The AWS Access Key ID     | `text`      |
| AWS Secret Access Key | The AWS Secret Access Key | `sensitive` |
| AWS Region            | The AWS Region            | `text`      |

## Procedures

### to delete a (message) from a queue

Delete a message from an SQS queue.

**Input Concepts**

| Concept                   | Description               | Type          | Required | Default Value |
| ------------------------- | ------------------------- | ------------- | -------- | ------------- |
| [`message`](#sqs-message) | The sqs message to delete | `sqs message` | Yes      | (no default)  |

**Output Concepts**

| Concept             | Description | Type    |
| ------------------- | ----------- | ------- |
| [`message`](#thing) | None        | `thing` |

**Examples**

```generic
get some queues from sqs
receive some messages from the first queue
delete the first message
```

### to get (queues) from *sqs*

![FILTER - CAPABLE](https://img.shields.io/static/v1?label=FILTER\&message=CAPABLE\&color=blue)

Get queues available in SQS.

**Output Concepts**

| Concept  | Description          | Type   |
| -------- | -------------------- | ------ |
| `queues` | A list of queue URLs | `text` |

**Examples**

```generic
get some queues from sqs
```

### to receive (messages) from a queue

Get messages from an SQS queue.

**Input Concepts**

| Concept              | Description                                                   | Type     | Required | Default Value |
| -------------------- | ------------------------------------------------------------- | -------- | -------- | ------------- |
| `queue`              | The URL of the Amazon SQS queue to receive messages from      | `text`   | Yes      | (no default)  |
| `max amount`         | Maximum number of messages to return                          | `number` | No       | 1             |
| `visibility timeout` | The duration in seconds that the received messages are hidden | `number` | No       | (no default)  |

**Output Concepts**

| Concept                    | Description                       | Type          |
| -------------------------- | --------------------------------- | ------------- |
| [`messages`](#sqs-message) | A list of messages from the queue | `sqs message` |

**Examples**

```generic
get some queues from sqs
receive some messages from the first queue
```

### to send a message to a queue

Create a message in an SQS queue.

**Input Concepts**

| Concept      | Description                                          | Type   | Required | Default Value |
| ------------ | ---------------------------------------------------- | ------ | -------- | ------------- |
| `queue`      | The URL of the Amazon SQS queue to send a message to | `text` | Yes      | (no default)  |
| `body`       | The message to send                                  | `text` | Yes      | (no default)  |
| `attributes` | Message attributes for the message                   | `json` | No       | (no default)  |

**Output Concepts**

| Concept  | Description                                            | Type   |
| -------- | ------------------------------------------------------ | ------ |
| `answer` | Information about the sent message including MessageId | `json` |

**Examples**

```generic
get some queues from sqs
send a message to the first queue
   the body is "Hello, world!"
```

## Concepts

### Sqs message

Represents a message from an Amazon SQS queue.

| Field Name           | Description                                        | Type             |
| -------------------- | -------------------------------------------------- | ---------------- |
| `message_id`         | The unique identifier for the message              | `text`           |
| `receipt_handle`     | The receipt handle used to delete the message      | `text`           |
| `queue_url`          | The URL of the queue the message was received from | `text`           |
| `body`               | The message body                                   | `text`           |
| `attributes`         | System attributes of the message                   | `optional[json]` |
| `message_attributes` | Custom attributes of the message                   | `optional[json]` |

### Thing

No description
