snippets_js
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);