with CoinCatch and Twilio SendGrid?
Allows you to add one or more email addresses to the global suppressions group. See the docs here
Adds or updates a contact. See the docs here
Allows you to create a new contact list. See the docs here
Create a single send. See the docs here
Allows you to delete all email addresses on your blocks list. See the docs here
import { axios } from "@pipedream/platform";
import crypto from 'crypto';
export default defineComponent({
props: {
coincatch: {
type: "app",
app: "coincatch",
}
},
async run({ steps, $ }) {
const accessKey = this.coincatch.$auth.access_key;
const secretKey = this.coincatch.$auth.secret_key;
const passphrase = this.coincatch.$auth.passphrase;
// Helper function to generate signed headers
const createSignedHeaders = ({
method,
requestPath,
queryString = "",
body = "",
}) => {
const timestamp = Date.now().toString();
const upperMethod = method.toUpperCase();
// Build content to sign
let contentToSign = timestamp + upperMethod + requestPath;
if (queryString) {
contentToSign += "?" + queryString;
}
if (body) {
contentToSign += body;
}
// Generate signature
const hmac = crypto.createHmac("sha256", secretKey);
hmac.update(contentToSign);
const signature = hmac.digest("base64");
return {
timestamp,
method: upperMethod,
requestPath,
queryString,
body,
contentToSign,
signature,
headers: {
"ACCESS-KEY": accessKey,
"ACCESS-SIGN": signature,
"ACCESS-TIMESTAMP": timestamp,
"ACCESS-PASSPHRASE": passphrase,
},
};
};
// Call helper to get signed headers + metadata
const resp = createSignedHeaders({
method: "GET",
requestPath: "/api/mix/v1/account/accounts",
queryString: "productType=umcbl"
});
const url = `https://api.coincatch.com${resp.requestPath}${resp.queryString ? "?" + resp.queryString : ""
}`;
// Make the API request
return await axios($, {
method: resp.method,
url,
headers: resp.headers,
data: resp.body || undefined,
});
},
})
The Twilio SendGrid API opens up a world of possibilities for email automation, enabling you to send emails efficiently and track their performance. With this API, you can programmatically create and send personalized email campaigns, manage contacts, and parse inbound emails for data extraction. When you harness the power of Pipedream, you can connect SendGrid to 3,000+ other apps to automate workflows, such as triggering email notifications based on specific actions, syncing email stats with your analytics, or handling incoming emails to create tasks or tickets.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
sendgrid: {
type: "app",
app: "sendgrid",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api.sendgrid.com/v3/user/account`,
headers: {
Authorization: `Bearer ${this.sendgrid.$auth.api_key}`,
},
})
},
})