with Twilio SendGrid and Selling Partner API (SP-API)?
Emit new event when a new inbound shipment to FBA is created. See the documentation
Emit new event when a new order is created in Amazon Seller Central. See the documentation
Emit new event when any of the specified SendGrid events is received
Allows you to add one or more email addresses to the global suppressions group. See the docs here
Retrieves inventory summaries from Amazon fulfillment centers to monitor stock availability. See the documentation
Retrieves a list of orders based on a specified date range, buyer email, or order ID. See the documentation
Allows you to create a new contact list. See the docs here
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}`,
},
})
},
})
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
amazon_selling_partner: {
type: "app",
app: "amazon_selling_partner",
}
},
async run({steps, $}) {
// Define the mapping between Seller Central URLs (from your App Config) and SP-API Endpoints
const getEndpoint = (sellerCentralUrl) => {
const na = "https://sellingpartnerapi-na.amazon.com";
const eu = "https://sellingpartnerapi-eu.amazon.com";
const fe = "https://sellingpartnerapi-fe.amazon.com";
const map = {
// North America
"https://sellercentral.amazon.com": na,
"https://sellercentral.amazon.ca": na,
"https://sellercentral.amazon.com.mx": na,
"https://sellercentral.amazon.com.br": na,
// Europe (The Big 5 often share one URL, but newer ones have specific URLs)
"https://sellercentral-europe.amazon.com": eu,
"https://sellercentral.amazon.com.be": eu,
"https://sellercentral.amazon.nl": eu,
"https://sellercentral.amazon.pl": eu,
"https://sellercentral.amazon.se": eu,
"https://sellercentral.amazon.com.tr": eu,
// India (Uses EU endpoint)
"https://sellercentral.amazon.in": eu,
// Far East
"https://sellercentral.amazon.sg": fe,
"https://sellercentral.amazon.com.au": fe,
"https://sellercentral.amazon.co.jp": fe,
};
return map[sellerCentralUrl];
};
// 1. Get the Marketplace URL selected by the user in the App Connection
const marketplaceUrl = this.amazon_selling_partner.$auth.marketplace;
// 2. Resolve the correct SP-API Endpoint
const apiEndpoint = getEndpoint(marketplaceUrl);
if (!apiEndpoint) {
throw new Error(`Could not map Seller Central URL (${marketplaceUrl}) to an SP-API Endpoint.`);
}
// 3. Make the request
return await axios($, {
url: `${apiEndpoint}/inbound/fba/2024-03-20/inboundPlans`,
headers: {
"x-amz-access-token": `${this.amazon_selling_partner.$auth.oauth_access_token}`,
},
});
},
})
