Send your Telegram bot a description and it draws that picture and sends it back to the same chat.

UsesImgBBOpenAIStability AITelegram

Message a description, get a picture back in Telegram

Whenever a message arrives in the chat your Telegram bot watches, the description in it is checked for safety, drawn as a picture in the style and shape you have chosen, and sent back to the same chat as a photo captioned with what was asked for.

The picture goes back only to the chat that asked for it. Every request passes a safety check first: the AI is asked whether the description is one the bot should draw, and a picture is only made on a clear yes. Real or identifiable people, sexual, violent or hateful content, anything meant to pass as a real document or brand, and instructions for making a weapon or a drug are refused, and the chat is told why. If the check does not come back, or the picture cannot be made or hosted, you get a plain message rather than silence. The bot's own replies are recognised and left alone.

Before the first run you need a Telegram bot in the chat, an image generator and an image host, which keeps a public copy for a week so Telegram can fetch it.

TelegramTelegramWhen a new message is received. Save it as incomingMessage.When a new message is received. Save it as incomingMessage.
ValuesSet pictureStyle to blank.Set pictureStyle to blank.
ValuesSet pictureShape to 1:1.Set pictureShape to 1:1.
TextMake pictureStyle lowercase and save it as styleChoice.Make pictureStyle lowercase and save it as styleChoice.
ValuesSet 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 ...
Decisions & LoopsIf knownStyles doesn't contain styleChoiceIf knownStyles doesn't contain styleChoice
Yes
Decisions & LoopsStop and report a problem: The 'pictureStyle' step is not a style the image generator knows. Use one of: 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 or tile-texture.Stop and report a problem: The 'pictureStyle' step is not a style the image generator knows. Use one of: 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 or tile-texture.
No
No steps
TextTrim pictureShape and save it as shapeChoice.Trim pictureShape and save it as shapeChoice.
ValuesSet knownShapes to:Set knownShapes to:1:1 16:9 9:16 3:2 2:3 5:4 4:5 21:9 9:21
Decisions & LoopsIf knownShapes doesn't contain shapeChoiceIf knownShapes doesn't contain shapeChoice
Yes
Decisions & LoopsStop and report a problem: The 'pictureShape' step is not a shape the image generator knows. Use one of: 1:1, 16:9, 9:16, 3:2, 2:3, 5:4, 4:5, 21:9 or 9:21.Stop and report a problem: The 'pictureShape' step is not a shape the image generator knows. Use one of: 1:1, 16:9, 9:16, 3:2, 2:3, 5:4, 4:5, 21:9 or 9:21.
No
No steps
ValuesSet chatId to incomingMessage.chat_id.Set chatId to incomingMessage.chat_id.
Decisions & LoopsIf chatId is emptyIf chatId is empty
Yes
Decisions & LoopsStop and report a problem: That message did not say which chat it came from, so there was nowhere to send a picture back to.Stop and report a problem: That message did not say which chat it came from, so there was nowhere to send a picture back to.
No
No steps
ValuesSet requestText to blank.Set requestText to blank.
Decisions & LoopsIf a step below fails, save the error as messageErrorIf a step below fails, save the error as messageError
Try
TextTrim incomingMessage.text and save it as requestText.Trim incomingMessage.text and save it as requestText.
On error
Decisions & LoopsFinish the run: That message had no text in it, so there was nothing to draw.Finish the run: That message had no text in it, so there was nothing to draw.
ValuesSet isOwnReply to requestText starts with Here is your picture or requestText starts with I could not draw that or requestText starts with Tell me what to draw.Set isOwnReply to requestText starts with Here is your picture or requestText starts with I could not draw that or requestText starts with Tell me what to draw.
Decisions & LoopsIf isOwnReply is yesIf isOwnReply is yes
Yes
Decisions & LoopsFinish the run: That message was one this workflow sent, so it was left alone.Finish the run: That message was one this workflow sent, so it was left alone.
No
No steps
Decisions & LoopsIf the length of requestText is less than 3If the length of requestText is less than 3
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.Tell me what to draw - a red bicycle leaning on a wall at sunset, a fox reading a map, anything you can describe.
Decisions & LoopsFinish the run: The message did not describe a picture, so nothing was drawn.Finish the run: The message did not describe a picture, so nothing was drawn.
No
No steps
TextShorten requestText to 400 characters (keeping words whole) and save it as cappedRequest.Shorten requestText to 400 characters (keeping words whole) and save it as cappedRequest.
ValuesSet screenRules to You are the safety check for a picture bot. Someone has sent a description and a picture will be drawn from it. Decide whether it should be drawn.Set screenRules to You are the safety check for a picture bot. Someone has sent a description and a picture will be drawn from it. Decide whether it should be drawn. Refuse if the description asks for: - any real, named or otherwise identifiable person, living or dead, including public figures, politicians, celebrities, and anyone the sender says they know - sexual or suggestive content of anyone, or any depiction of a child that is not ordinary and fully clothed - violence, gore, injury, self-harm, or a weapon being used on someone - hateful, demeaning or harassing content about a person or a group - anything meant to pass as real: an identity document, currency, an official paper, a signature, or the logo or packaging of a real company or product - a diagram or instructions for making a weapon, an explosive or a drug Anything else is fine, including invented characters, animals, places, food, objects, patterns, abstract art and fictional scenes.
ValuesSet screenPrompt to screenRulesAnswer on one line. Either the single word ALLOW, or REFUSE: followed by one short sentence, beginning with a capital letter, that a person can read and that says what the problem was without repeating the request.Set screenPrompt to screenRulesAnswer on one line. Either the single word ALLOW, or REFUSE: followed by one short sentence, beginning with a capital letter, that a person can read and that says what the problem was without repeating the request. The description: cappedRequest .
ValuesSet screenResult to nothing.Set screenResult to nothing.
Decisions & LoopsIf a step below fails, save the error as screenCallErrorIf a step below fails, save the error as screenCallError
Try
OpenAIOpenAIAsk OpenAI: screenPrompt. Save it as screenResult.Ask OpenAI: screenPrompt. Save it as screenResult.
On error
ValuesChange screenResult to nothing.Change screenResult to nothing.
ValuesSet verdict to blank.Set verdict to blank.
Decisions & LoopsIf a step below fails, save the error as verdictErrorIf a step below fails, save the error as verdictError
Try
TextTrim screenResult.response_text and save it as verdict.Trim screenResult.response_text and save it as verdict.
On error
ValuesChange verdict to blank.Change verdict to blank.
Decisions & LoopsIf verdict doesn't start with ALLOWIf verdict doesn't start with ALLOW
Yes
ValuesSet refusalText to I could not draw that. The safety check did not come back, so nothing was drawn. Send the description again in a moment..Set refusalText to I could not draw that. The safety check did not come back, so nothing was drawn. Send the description again in a moment..
Decisions & LoopsIf verdict starts with REFUSEIf verdict starts with REFUSE
Yes
TextTrim verdict with REFUSE: replaced by with REFUSE replaced by and save it as refusalReason.Trim verdict with REFUSE: replaced by with REFUSE replaced by and save it as refusalReason.
ValuesChange refusalText to I could not draw that. It is outside what this bot will draw..Change refusalText to I could not draw that. It is outside what this bot will draw..
Decisions & LoopsIf refusalReason isn't emptyIf refusalReason isn't empty
Yes
ValuesChange refusalText to I could not draw that. refusalReason truncated to 300 characters using ... as the ellipsis (keeping words whole).Change refusalText to I could not draw that. refusalReason truncated to 300 characters using ... as the ellipsis (keeping words whole).
No
No steps
No
No steps
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.refusalText
Decisions & LoopsFinish the run: The request was not cleared by the safety check, so no picture was drawn.Finish the run: The request was not cleared by the safety check, so no picture was drawn.
No
No steps
ValuesSet pictureRef to blank.Set pictureRef to blank.
Decisions & LoopsIf a step below fails, save the error as drawingErrorIf a step below fails, save the error as drawingError
Try
Stability AIStability AIGenerate an image of cappedRequest. Save it as generated.Generate an image of cappedRequest. Save it as generated.text, letters, words, watermark, signature, logo, brand mark, real person, celebrity, nudity, gore
TextTrim generated.document_ref and save it as pictureRef.Trim generated.document_ref and save it as pictureRef.
On error
ValuesChange pictureRef to blank.Change pictureRef to blank.
ValuesSet pictureUrl to blank.Set pictureUrl to blank.
Decisions & LoopsIf pictureRef isn't emptyIf pictureRef isn't empty
Yes
Decisions & LoopsIf a step below fails, save the error as hostingErrorIf a step below fails, save the error as hostingError
Try
ImgBBImgBBUpload an image. Save it as hosted.Upload an image. Save it as hosted.
TextTrim hosted.url and save it as pictureUrl.Trim hosted.url and save it as pictureUrl.
On error
ValuesChange pictureUrl to blank.Change pictureUrl to blank.
No
No steps
Decisions & LoopsIf pictureUrl doesn't start with https://If pictureUrl doesn't start with https://
Yes
ValuesChange pictureUrl to blank.Change pictureUrl to blank.
No
No steps
Decisions & LoopsIf pictureUrl isn't emptyIf pictureUrl isn't empty
Yes
TelegramTelegramSend a photo to chat chatId.Send a photo to chat chatId. Photo URL: pictureUrlHere is your picture: cappedRequest truncated to 900 characters using "..." as the ellipsis (keeping words whole)
Decisions & LoopsFinish the run: The picture was drawn and sent back to the chat it was asked for in.Finish the run: The picture was drawn and sent back to the chat it was asked for in.
No
No steps
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.I could not draw that right now - the picture could not be made. Send the description again in a moment.
Decisions & LoopsFinish the run: No picture could be made, so the chat was told instead.Finish the run: No picture could be made, so the chat was told instead.