Sinch MessageMedia: Business SMS & Messaging Platform
Create a HTML or a plain text email template. See the docs
Send an email using Amazon SES. Supports simple email messaging. See the docs
Send an email replacing the template tags with values using Amazon SES. See the docs
import axios from "axios";
import crypto from 'crypto';
export default defineComponent({
props: {
sinch_messagemedia: {
type: "app",
app: "sinch_messagemedia",
}
},
async run({ steps, $ }) {
// Date header in RFC7231 format
const date = new Date().toUTCString();
// Signing string (No Content-MD5 needed as this is a GET request with no body)
const requestLine = 'GET /v1/messaging/numbers/sender_address/addresses/ HTTP/1.1';
const signingString = `Date: ${date}\n${requestLine}`;
// Creating HMAC-SHA1 hash
const hmac = crypto.createHmac('sha1', this.sinch_messagemedia.$auth.api_secret);
hmac.update(signingString);
// Base64 encode the hash
const signature = hmac.digest('base64');
// Prepare authentication header and make the request
const authHeader = `hmac username="${this.sinch_messagemedia.$auth.api_key}", algorithm="hmac-sha1", headers="Date request-line", signature="${signature}"`;
const response = await axios({
method: 'get',
url: `${this.sinch_messagemedia.$auth.api_url}/v1/messaging/numbers/sender_address/addresses/`,
headers: {
'Date': date,
'Authorization': authHeader,
'Accept': 'application/json'
}
});
return response.data;
},
})
Amazon Simple Email Service (SES) is a powerful cloud-based email sending service designed to help digital marketers and application developers send marketing, notification, and transactional emails. With the SES API, you can reliably send emails at scale, manage sender reputations, view email sending statistics, and maintain a high deliverability rate. Leveraging Pipedream's capabilities, you can integrate SES seamlessly into serverless workflows, automate email responses based on triggers from other apps, and analyze the effectiveness of your email campaigns by connecting to data analytics platforms.
module.exports = defineComponent({
props: {
amazon_ses: {
type: "app",
app: "amazon_ses",
}
},
async run({steps, $}) {
const AWS = require("aws-sdk")
const { accessKeyId, secretAccessKey } = this.amazon_ses.$auth
const ses = new AWS.SES({
accessKeyId,
secretAccessKey,
region: 'us-east-1',
})
const sesParams = {
Destination: {
ToAddresses: ["<your email here>"],
},
Message: {
Body: {
Html: {
Charset: "UTF-8",
Data: "<h1>This is a test</h1>",
},
Text: {
Charset: "UTF-8",
Data: "This is a test",
}
},
Subject: {
Charset: "UTF-8",
Data: "Test email",
}
},
Source: "<your from address here",
};
this.resp = await ses.sendEmail(sesParams).promise()
},
})