Although I have not been updating this blog, or my Github as I intended, that does not mean I have not been learning. I have always been better at organizing other people’s stuff than my own!
For example, at work I hooked up OpenAI’s API to our contact form to automatically catch spam before it hits our inbox—now we actually see the real customer messages instead of drowning in junk.
Even better than that, I am using the API to create blog posts using a super prompt. Below, I am just going to show an example of what I did, not the exact code (don’t want to potentially get in trouble for sharing work product!)
First thing I did was use ChatGPT to scan the website to generate an SEO based summary. We will call that website_SEO_summary.md
. (creative, right?!?!) Next thing was to get a list of valid urls on the website from sitemap.xm
l. Can’t forget the overall instruction file! We’ll call it instructions.md
. Inside of the instruction file, I inserted placeholders for the content from the additional files.
For a little flair, I added a file of high ranking competitor keywords, to be used in the post if appropriate (It worked for them, why not…) One thing I have not mentioned yet, is this article creation system is designed to be derived from a blog post or news story, preferably from a trusted source for SEO benefits. The existing post link is provided and evaluated. If it is inline with the work site’s purpose, a post is created. If not, the web is searched for recent articles that do correspond to the site, and “TADA”, SEO magic! (One of the newly found articles could be a good basis for our own post)
Essentially, I used prompt engineering from the Openai Cookbook. (slight complaint -> Openai/Chatgpt seems to be woefully unaware of its own documentation…) To point out one of my own shortcomings. I am not good at sitting down and reading documentation from “cover to cover”, especially in the world of AI. There are so many platform options, and things are changing so fast, by the time you are done reading the documentation, you are 2 versions behind!
Now, when I send the instructions to the responses API, it contains all the data that is referenced, and the files are not hard coded so changes can be made with having to do code commits. The examples are truncated for brevity.
Instructions example showing placeholders…
# ROLE
You are a world-class SEO content writer. You must follow all instructions precisely and completely. Do not skip or ignore any part.
# ARTICLE TYPE
blog post
# GOAL
You will go online and review the webpage given ({post_source_url}), and use it as a reference to write an engaging blog post for the website. The blog post will reference content that will connect to the purpose of the website. See the site_SEO_summary ({website_SEO_summary}) for SEO details.
# TARGET AUDIENCE
People who need these services
# REQUIREMENTS
- Blog post must include at least one internal link to myautoloan.com using a relative path from one of it's existing pages. See {website_urls} for list of existing urls. If needed, go online and review the pages to find one that is appropriate to the article.
- Use a conversational, engaging tone
- If 'competitor_keywords' are relevant, these are allowed for use: {competitor_keywords}
And here is the python function… (API call fails if `input` is blank, variables initiated off prior to function)
client = OpenAI(api_key=OPENAI_API_KEY)
response = client.responses.create(
model="gpt-4.1",
input=post_source_url,
instructions=api_instructions.format(
post_source_url=post_source_url,
website_urls=website_urls,
website_SEO_summary=website_SEO_summary,
competitor_keywords=competitor_keywords
)
I am not claiming to be an AI pro, but I am not afraid of learning something new!