[
{
"id": "structure_with_title_and_cta"
},
{
"id": "structure_empty_3_containers",
"content": [
{
"id": "blog_teaser",
"values": {
"url": "https://gamma.app/doc-1",
"title": "Doc 1 title",
"excerpt": "1-2 sentence synopsis from Gamma.",
"image": "https://cdn.example.com/doc1.jpg",
"tag": "AI Docs",
"read_time": "5 min read"
}
},
{
"id": "blog_teaser",
"values": {
"url": "https://gamma.app/doc-2",
"title": "Doc 2 title",
"excerpt": "Short synopsis from second doc.",
"image": "https://cdn.example.com/doc2.jpg"
}
}
]
}
]{
"dataSources": [
{
"name": "API_canonical",
"type": "RAW",
"value": [
{
"id": "structure_with_title_and_cta"
},
{
"id": "structure_empty_3_containers",
"content": [
{
"id": "blog_teaser",
"values": {
"url": "https://gamma.app/doc-1",
"title": "Doc 1 title",
"excerpt": "Short synopsis from Gamma.",
"image": "https://cdn.example.com/doc1.jpg",
"tag": "AI Docs",
"read_time": "5 min read"
}
}
]
}
]
}
],
"transformers": [],
"composers": [
{
"type": "canonical",
"source": "API_canonical",
"templateArea": "newsletter-main"
}
],
"templateId": YOUR_TEMPLATE_ID,
"emailId": 0,
"emailName": "Gamma_Newsletter",
"title": "What's new this week",
"preheader": "Highlights from Gamma"
}curl -X POST https://my.stripo.email/emailgeneration/v1/email \
-H "Content-Type: application/json" \
-H "Stripo-Api-Auth: YOUR_JWT_TOKEN" \
-d @body.jsonconst token = process.env.STRIPO_JWT;
const res = await fetch(
"https://my.stripo.email/emailgeneration/v1/email",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"Stripo-Api-Auth": token
},
body: JSON.stringify({
/* your JSON body */
})
}
);
if (!res.ok) {
throw new Error(`Stripo HTTP ${res.status}`);
}
const generated = await res.json();
console.log("Email generated:", generated);// Example serverless function
export default async function handler(req, res) {
try {
// Fetch from your Gamma API or database
const gammaItems = await fetchLatestGammaContent();
// Transform to Stripo canonical format
const stripoData = [
{ "id": "structure_with_title_and_cta" },
{
"id": "structure_empty_3_containers",
"content": gammaItems.map(item => ({
"id": "blog_teaser",
"values": {
"url": item.url,
"title": item.title,
"excerpt": item.summary,
"image": item.thumbnail,
"tag": item.category,
"read_time": item.readTime
}
}))
}
];
// Return with proper caching headers
res.setHeader('Cache-Control', 's-maxage=900');
res.status(200).json(stripoData);
} catch (error) {
res.status(500).json({ error: 'Failed to fetch content' });
}
}