Skip to content

SQS Triggers

Once available, Orvanta will be able to connect to an SQS queue and trigger a script or flow in response to messages received, using an AWS or AWS OIDC connection to authenticate and a configurable queue URL and message-attribute selection — the same shape as the other queue-backed triggers (Kafka, NATS, MQTT).

For reference, an SQS-triggered preprocessor would receive an event shaped like this:

export async function preprocessor(
event: {
kind: "sqs",
msg: string,
queue_url: string,
message_id?: string,
receipt_handle?: string,
attributes: Record<string, string>,
message_attributes?: Record<string, {
string_value?: string,
data_type: string
}>
}
) {
if (event.kind !== "sqs") {
throw new Error(`Expected a SQS event`);
}
// assuming the message is a JSON object
const data = JSON.parse(event.msg);
return {
content: data.content,
metadata: {
sentAt: event.attributes.SentTimestamp,
messageId: event.message_id
}
};
}
  • queue_url: The URL of the SQS queue that received the message.
  • message_id: A unique identifier assigned to each message by SQS.
  • receipt_handle: A token used to delete the message after processing.
  • attributes: Metadata attributes set by SQS, such as SentTimestamp.
  • message_attributes: User-defined attributes attached to the message (string_value, data_type).

See Preprocessors for how a preprocessor’s return value maps onto a script’s main() parameters.