How to Automatically Feature a Post When Creating on <|>?

This topic was automatically generated from Slack. You can find the original thread here.

any way to feature this post automately when create a post? any suggestion will be appreciate, many thanks

Hi ,

feature this post automately
Feature the post on which platform?

i try to use pipedream to publish post to website, but i don’t know how to feature the post in pipedream ? any ideas ? many thanks.

Hi , I see that the current Ghost Admin API - create post action doesn’t allow you to set the post as featured, I’ve created a ticket here to improve that: [FEATURE] Ghost Admin API - Create Post: Add `Featured` prop to allow user to add featured opst · Issue #8821 · PipedreamHQ/pipedream · GitHub

For now you can use a Node.js code step as a workaround, our bot can help with that

Sure, I can help you with a Node.js code step to create and feature a post on Ghost. First, you’ll need to have your Ghost Admin API key. Then, you can use the following code snippet as a starting point: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { apiKey: { type: "string", label: "Ghost Admin API Key", secret: true, }, title: { type: "string", label: "Post Title", }, content: { type: "string", label: "Post Content", }, }, async run({ $ }) { const apiUrl = ""; const headers = { Authorization: `Ghost ${this.apiKey}`, "Content-Type": "application/json", }; const postData = { posts: [ { title: this.title, html: this.content, featured: true, }, ], }; try { const response = await axios($, { method: "POST", url: apiUrl, headers: headers, data: JSON.stringify(postData), }); return response; } catch (error) { console.error("Error creating featured post:", error); throw error; } }, }); Replace []( with your Ghost site’s URL. This code will create a new post with the provided title and content, and set it as featured. Make sure to input your Ghost Admin API key and other required information in the component’s props.