Skip to content

Instantly share code, notes, and snippets.

@onlybakam
Last active May 11, 2023 16:24
Show Gist options
  • Save onlybakam/d5cca042f49282a0db68ed2cebfa08b1 to your computer and use it in GitHub Desktop.
Save onlybakam/d5cca042f49282a0db68ed2cebfa08b1 to your computer and use it in GitHub Desktop.
export function sqsSendMessage(queueUrl: string, msg: unknown, groupId: string, dedupId: string) {
const bodyJson = {
Action: 'SendMessage',
MessageBody: JSON.stringify(msg),
QueueUrl: queueUrl,
MessageDeduplicationId: dedupId,
MessageGroupId: groupId,
}
const req: HTTPRequest = {
method: 'POST',
resourcePath: '/',
params: {
body: JSON.stringify(bodyJson),
headers: {
'X-Amz-Target': 'AmazonSQS.SendMessage',
'Content-Type': 'application/x-amz-json-1.0',
},
},
}
log('sending to sqs:', req)
return req
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment