AWS Simple Queue Service
With this integration you can publish and receive messages in Amazon Web Services Simple Queue Service.
Official Websitehttps://aws.amazon.com/sqs/
TagsQueueMessage BrokerSaas
- JavaScript
- Python
NodeJS packagehttps://www.npmjs.com/package/@aws-sdk/client-sqs
Version3.316.0
Credential configuration
To configure this credential, you need the Access Key ID
and the Secret Access Key
of the Programatic access
user you want to use. Make sure this user has the required permissions
to access Simple Queue Service to work properly. If you need to create the user,
follow the instructions provided here.
In the extra options field, you can include any of the parameters found here.
Here is an example of a filled credential configuration form in YepCode:
AWS Simple Queue Service snippets available in YepCode editor
note
The title is the triggering text for YepCode to autocomplete the script.
- JavaScript
- Python
Integration
New integration from credential
const awsSqsClient = yepcode.integration.awsSqs("credential-slug");
New integration from plain authentication data
const { SQSClient } = require("@aws-sdk/client-sqs");
const awsSqsClient = new SQSClient({
credentials: {
accessKeyId: "accessKeyId",
secretAccessKey: "secretAccessKey",
},
});
List Queues
List queues
const { ListQueuesCommand } = require("@aws-sdk/client-sqs");
const listQueuesCommand = new ListQueuesCommand({});
const listQueuesResponse = await awsSqsClient.send(listQueuesCommand);
console.log(listQueuesResponse.QueueUrls);
Send Message
Send message
const { SendMessageCommand } = require("@aws-sdk/client-sqs");
const sendMessageCommand = new SendMessageCommand({
QueueUrl: "the-queue-url",
MessageBody: "the-message-body"
});
const sendMessageResponse = await awsSqsClient.send(sendMessageCommand);
console.log(sendMessageResponse);
Receive Messages
Receive messages
const { ReceiveMessageCommand } = require("@aws-sdk/client-sqs");
const receiveMessageCommand = new ReceiveMessageCommand({
QueueUrl: "the-queue-url"
});
const receiveMessageResponse = await awsSqsClient.send(receiveMessageCommand);
console.log(receiveMessageResponse.Messages);
Integration
New integration from credential
aws_sqs_client = yepcode.integration.aws_sqs("credential-slug")
New integration from plain authentication data
import boto3
session = boto3.Session(
aws_access_key_id="accessKeyId",
aws_secret_access_key="secretAccessKey",
region_name="region"
)
aws_sqs_client = session.client("sqs")
List Queues
List queues
response = aws_sqs_client.list_queues()
for queue_url in response.get('QueueUrls', []):
print(queue_url)
Send Message
Send message
aws_sqs_client.send_message(
QueueUrl="the-queue-url",
MessageBody="the-message-body"
)
Receive Messages
Receive messages
aws_sqs_client.receive_message(
QueueUrl="the-queue-url",
MaxNumberOfMessages=10
)
for message in response.get('Messages', []):
print(message)