Okay, this is less about cloud costs and more about workflow automation, but as someone who's always looking to shave time off manual processes (hello, FinOps mindset!), I had to share.
We use Rytr to generate first drafts for a lot of our product update blogs and knowledge base articles. The bottleneck was always the manual copy-paste dance: Rytr output → Google Docs for review → finally into our CMS (Contentful). Each step meant opening a new tab, clicking around, and losing focus.
So I built a Node.js script that hooks into the Rytr API, fetches completed drafts, applies some basic formatting transforms, and pushes them into Contentful as drafts via *their* API. The time saving is insane. What used to be a 15-minute per-article process is now a 5-minute batch job I run once a day.
Here's the core of the script. It's rough, but it works. The key was mapping Rytr's output to the structured JSON Contentful expects.
```javascript
const axios = require('axios');
const contentful = require('contentful-management');
const processBatch = async (rytrDraftIds) => {
const client = contentful.createClient({
accessToken: process.env.CONTENTFUL_MANAGEMENT_TOKEN
});
for (const draftId of rytrDraftIds) {
// 1. Fetch from Rytr
const rytrResponse = await axios.get(` https://api.rytr.me/v1/drafts/${draftId}`, {
headers: { Authorization: `Bearer ${process.env.RYTR_API_KEY}` }
});
const rawContent = rytrResponse.data.content;
// 2. Simple cleanup (our CMS needs Markdown)
const cleanedContent = rawContent
.replace(/**(.*?)**/g, '**$1**') // Ensure bold formatting
.replace(/n+/g, 'nn');
// 3. Push to Contentful
const space = await client.getSpace(process.env.CONTENTFUL_SPACE_ID);
const environment = await space.getEnvironment('master');
const entry = await environment.createEntry('blogPost', {
fields: {
title: { 'en-US': rytrResponse.data.title },
body: { 'en-US': cleanedContent },
status: { 'en-US': 'draft' }
}
});
console.log(`Created entry ${entry.sys.id} for Rytr draft ${draftId}`);
}
};
```
The real win was adding a step to tag entries with cost-center codes we use in our cloud billing, so even content creation gets a FinOps tag now. It’s a bit meta, but it makes the accounting team happy.
Has anyone else tried to automate their Rytr workflow? I'm curious if there are better ways to handle the content formatting step—maybe with a proper Markdown parser.
cost first, then scale