Send a topic to your Telegram chat and get back a drafted social post for the platform you choose, with a picture to go with it.
Uses
ImgBB
OpenAI
Stability AI
Telegram
Message a topic, get post copy and a picture back
Whenever you send a topic to your Telegram chat, a finished post for the platform you chose comes back, with a picture drawn to go with it. The picture arrives first, then the copy as its own message, so you can copy it straight out. Nothing is published anywhere by the workflow.
The copy is held to what you gave it: everything the post claims about the business has to come from your one-line description or the topic you sent, and the AI is forbidden from inventing a statistic, a price, a discount, a rating, an award or a named partner, or from promising a result or a guarantee. The picture is drawn from a description the copy itself ends with, with real people, logos and readable text ruled out. If drawing or hosting it fails, the copy is still sent with a note that no picture could be made.
You need a Telegram bot in your chat, your brand name, one line about what you sell, and the platform and picture style you want.
incomingMessage.When a new message is received. Save it as incomingMessage.brandName to blank.Set brandName to blank.whatYouDo to blank.Set whatYouDo to blank.postPlatform to LinkedIn.Set postPlatform to LinkedIn.pictureStyle to photographic.Set pictureStyle to photographic.postPlatform and save it as platformChoice.Trim postPlatform and save it as platformChoice.knownPlatforms to:Set knownPlatforms to:linkedin
x
instagram
facebook
threadsknownPlatforms doesn't contain platformChoice in lowercaseIf knownPlatforms doesn't contain platformChoice in lowercasepictureStyle lowercase and save it as styleChoice.Make pictureStyle lowercase and save it as styleChoice.knownStyles to:Set knownStyles to:3d-model
analog-film
anime
cinematic
comic-book
digital-art
enhance
fantasy-art
isometric
line-art
low-poly
modeling-compound
neon-punk
origami
photographic
pixel-art
...knownStyles doesn't contain styleChoiceIf knownStyles doesn't contain styleChoicechatId to incomingMessage.chat_id.Set chatId to incomingMessage.chat_id.chatId is emptyIf chatId is emptytopicText to blank.Set topicText to blank.messageErrorIf a step below fails, save the error as messageErrorincomingMessage.text and save it as topicText.Trim incomingMessage.text and save it as topicText.isOwnReply to topicText starts with Here is your draft or topicText starts with Picture for your or topicText starts with I could not write that post or topicText starts with Tell me what the post is about.Set isOwnReply to topicText starts with Here is your draft or topicText starts with Picture for your or topicText starts with I could not write that post or topicText starts with Tell me what the post is about.isOwnReply is yesIf isOwnReply is yestopicText is less than 3If the length of topicText is less than 3chatId.Send a message to chat chatId.Tell me what the post is about - 'we now ship on Saturdays', 'our new opening hours', anything you want written up.topicText to 300 characters (keeping words whole) and save it as cappedTopic.Shorten topicText to 300 characters (keeping words whole) and save it as cappedTopic.brandLine to brandName - whatYouDo.Set brandLine to brandName - whatYouDo.factRules to Everything the post claims about the business must come from the line above or from the topic below. Invent nothing else.Set factRules to Everything the post claims about the business must come from the line above or from the topic below. Invent nothing else.
Never write a statistic, a percentage, a price, a discount, a customer count, a rating, an award, a date or a named partner that you were not given. Never promise a result, a saving, a delivery time or a guarantee.
If the post would need a number you were not given, write it without the number.
Do not name, quote or imply an endorsement from any real person, customer or company.
No medical, legal or financial advice.styleRules to Write in plain language. Short sentences. No hype words, no exclamation marks, no emoji unless the platform is Instagram or Threads, and no more than three hashtags.Set styleRules to Write in plain language. Short sentences. No hype words, no exclamation marks, no emoji unless the platform is Instagram or Threads, and no more than three hashtags.
Open with the point rather than a question. End with one clear thing the reader can do.formatRules to Reply with the post itself and nothing else - no heading, no explanation, no quotation marks around it.Set formatRules to Reply with the post itself and nothing else - no heading, no explanation, no quotation marks around it.
Then, on the very last line, write IMAGE: followed by one sentence describing a picture to run alongside the post. Describe a scene, an object or a setting. Do not describe any real, named or identifiable person, and do not ask for a logo, a brand mark, a chart or any readable text in the picture.postPrompt to Write one social media post for platformChoice.Set postPrompt to Write one social media post for platformChoice.
The business: brandLine
factRules@styleRules@formatRulesThe topic: cappedTopic
.modelResult to nothing.Set modelResult to nothing.modelCallErrorIf a step below fails, save the error as modelCallErrorpostPrompt. Save it as modelResult.Ask OpenAI: postPrompt. Save it as modelResult.modelResult to nothing.Change modelResult to nothing.copyRaw to blank.Set copyRaw to blank.copyErrorIf a step below fails, save the error as copyErrormodelResult.response_text and save it as copyRaw.Trim modelResult.response_text and save it as copyRaw.copyRaw to blank.Change copyRaw to blank.copyRaw is emptyIf copyRaw is emptychatId.Send a message to chat chatId.I could not write that post just now. Send the topic again and I will try once more.postText to copyRaw.Set postText to copyRaw.imageBrief to cappedTopic.Set imageBrief to cappedTopic.copyRaw contains IMAGE:If copyRaw contains IMAGE:copyRaw by "Split copyRaw by
IMAGE: and save it as copyParts.copyParts and save it as postText.Trim the first item of copyParts and save it as postText.copyParts and save it as briefPart.Trim the last item of copyParts and save it as briefPart.briefPart isn't emptyIf briefPart isn't emptyimageBrief to briefPart.Change imageBrief to briefPart.postText is emptyIf postText is emptypostText to copyRaw.Change postText to copyRaw.illustrationPrompt to A picture to run alongside a social media post, with no text or lettering anywhere in it and no real, named person in it. The picture: imageBrief truncated to 500 characters using ... as the ellipsis (keeping words whole).Set illustrationPrompt to A picture to run alongside a social media post, with no text or lettering anywhere in it and no real, named person in it. The picture: imageBrief truncated to 500 characters using ... as the ellipsis (keeping words whole).pictureRef to blank.Set pictureRef to blank.drawingErrorIf a step below fails, save the error as drawingErrorillustrationPrompt. Save it as generated.Generate an image of illustrationPrompt. Save it as generated.text, letters, words, captions, watermark, signature, logo, brand mark, real person, celebrity, chart, infographicgenerated.document_ref and save it as pictureRef.Trim generated.document_ref and save it as pictureRef.pictureRef to blank.Change pictureRef to blank.pictureUrl to blank.Set pictureUrl to blank.pictureRef isn't emptyIf pictureRef isn't emptyhostingErrorIf a step below fails, save the error as hostingErrorhosted.Upload an image. Save it as hosted.hosted.url and save it as pictureUrl.Trim hosted.url and save it as pictureUrl.pictureUrl to blank.Change pictureUrl to blank.pictureUrl doesn't start with https://If pictureUrl doesn't start with https://pictureUrl to blank.Change pictureUrl to blank.headerNote to:Set headerNote to::pictureUrl isn't emptyIf pictureUrl isn't emptychatId.Send a photo to chat chatId.
Photo URL: pictureUrlPicture for your platformChoice post: cappedTopic truncated to 900 characters using "..." as the ellipsis (keeping words whole)headerNote to:Change headerNote to:. No picture could be made for this one.postHeader to Here is your draft platformChoice post for brandName@headerNote.Set postHeader to Here is your draft platformChoice post for brandName@headerNote.postHeader plus postText to 3800 characters (keeping words whole) and save it as postMessage.Shorten postHeader plus postText to 3800 characters (keeping words whole) and save it as postMessage.chatId.Send a message to chat chatId.postMessagepictureUrl isn't emptyIf pictureUrl isn't empty