Text a drink name or an ingredient to your Telegram chat and get the recipe back, with the drink's photo.

UsesTelegramTheCocktailDB

Look up a drink from Telegram

Text a drink name or an ingredient to your Telegram chat and the recipe comes straight back. Whenever a new message arrives, the word is looked up on TheCocktailDB as a drink name, and if nothing is called that it is tried as an ingredient, so a word like gin still gets you a drink made with gin.

You get the category, the glass, whether it is alcoholic, the ingredients with their measures, how to make it and the drink's photo, followed by the other drinks that matched and a link to the source page. Every line comes from the record itself: nothing is written by AI, so no ingredient, measure or method is ever invented, and a detail the record lacks is left out. A message too short or too long to be a name gets a prompt asking for a drink or an ingredient, and the bot ignores its own replies.

You need a Telegram bot added to the chat you want answered and TheCocktailDB connected. Instructions come back in English.

TelegramTelegramWhen a new message is received. Save it as incomingMessage.When a new message is received. Save it as incomingMessage.
Set alternativesToList to “5”.Set alternativesToList to “5”.
Set listLimit to alternativesToList multiplied by 1.Set listLimit to alternativesToList multiplied by 1.
If listLimit is less than 1If listLimit is less than 1
Yes
Stop and report a problem: Set the 'alternativesToList' step to a whole number from 1 to 20.Stop and report a problem: Set the 'alternativesToList' step to a whole number from 1 to 20.
No
No steps
If listLimit is greater than 20If listLimit is greater than 20
Yes
Stop and report a problem: Set the 'alternativesToList' step to a whole number from 1 to 20.Stop and report a problem: Set the 'alternativesToList' step to a whole number from 1 to 20.
No
No steps
Set chatId to incomingMessage.chat_id.Set chatId to incomingMessage.chat_id.
If chatId is emptyIf chatId is empty
Yes
Stop and report a problem: That message did not say which chat it came from, so there was nowhere to send the recipe back to.Stop and report a problem: That message did not say which chat it came from, so there was nowhere to send the recipe back to.
No
No steps
Set queryText to blank.Set queryText to blank.
If a step below fails, save the error as messageErrorIf a step below fails, save the error as messageError
Try
Trim incomingMessage.text and save it as queryText.Trim incomingMessage.text and save it as queryText.
On error
Finish the run: That message had no text in it, so there was nothing to look up.Finish the run: That message had no text in it, so there was nothing to look up.
Set isOwnReply to queryText starts with “Here is the recipe for” or queryText starts with “I could not” or queryText starts with “Tell me a drink name”.Set isOwnReply to queryText starts with “Here is the recipe for” or queryText starts with “I could not” or queryText starts with “Tell me a drink name”.
If isOwnReply is yesIf isOwnReply is yes
Yes
Finish 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
If the length of queryText is less than 2If the length of queryText is less than 2
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.Tell me a drink name or an ingredient - 'margarita', or 'gin'.
Finish the run: The message did not name a drink or an ingredient, so nothing was looked up.Finish the run: The message did not name a drink or an ingredient, so nothing was looked up.
No
No steps
If the length of queryText is greater than 60If the length of queryText is greater than 60
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.Tell me a drink name or an ingredient - that message was too long to be either one.
Finish the run: The message was too long to be a drink name, so nothing was looked up.Finish the run: The message was too long to be a drink name, so nothing was looked up.
No
No steps
Set lookupFailed to false.Set lookupFailed to false.
Set nameMatches to an empty list.Set nameMatches to an empty list.
If a step below fails, save the error as searchErrorIf a step below fails, save the error as searchError
Try
TheCocktailDBTheCocktailDBSearch for queryText. Save it as searchResult.Search for queryText. Save it as searchResult.
Change nameMatches to searchResult.drinks.Change nameMatches to searchResult.drinks.
On error
Change lookupFailed to true.Change lookupFailed to true.
Change nameMatches to an empty list.Change nameMatches to an empty list.
Set matchCount to 0.Set matchCount to 0.
If a step below fails, save the error as countErrorIf a step below fails, save the error as countError
Try
Count the items in nameMatches and save it as matchCount.Count the items in nameMatches and save it as matchCount.
On error
Change matchCount to 0.Change matchCount to 0.
Set drink to nothing.Set drink to nothing.
Set alternativePool to an empty list.Set alternativePool to an empty list.
If matchCount is greater than 0If matchCount is greater than 0
Yes
Get the first item of nameMatches and save it as drink.Get the first item of nameMatches and save it as drink.
Change alternativePool to nameMatches.Change alternativePool to nameMatches.
No
No steps
If drink is emptyIf drink is empty
Yes
Set ingredientMatches to an empty list.Set ingredientMatches to an empty list.
If a step below fails, save the error as filterErrorIf a step below fails, save the error as filterError
Try
TheCocktailDBTheCocktailDBList cocktails made with queryText. Save it as filterResult.List cocktails made with queryText. Save it as filterResult.
Change ingredientMatches to filterResult.drinks.Change ingredientMatches to filterResult.drinks.
On error
Change ingredientMatches to an empty list.Change ingredientMatches to an empty list.
Set ingredientCount to 0.Set ingredientCount to 0.
If a step below fails, save the error as ingredientCountErrorIf a step below fails, save the error as ingredientCountError
Try
Count the items in ingredientMatches and save it as ingredientCount.Count the items in ingredientMatches and save it as ingredientCount.
On error
Change ingredientCount to 0.Change ingredientCount to 0.
If ingredientCount is greater than 0If ingredientCount is greater than 0
Yes
Change alternativePool to ingredientMatches.Change alternativePool to ingredientMatches.
Get the first item of ingredientMatches and save it as firstMatch.Get the first item of ingredientMatches and save it as firstMatch.
Set firstId to blank.Set firstId to blank.
If a step below fails, save the error as idErrorIf a step below fails, save the error as idError
Try
Trim firstMatch.id and save it as firstId.Trim firstMatch.id and save it as firstId.
On error
Change firstId to blank.Change firstId to blank.
If firstId isn't emptyIf firstId isn't empty
Yes
If a step below fails, save the error as lookupErrorIf a step below fails, save the error as lookupError
Try
TheCocktailDBTheCocktailDBGet cocktail firstId. Save it as drink.Get cocktail firstId. Save it as drink.
On error
Change drink to nothing.Change drink to nothing.
No
No steps
No
No steps
No
No steps
If drink is emptyIf drink is empty
Yes
Set missText to “I could not find a drink called '@queryText', or anything made with it.”.Set missText to “I could not find a drink called '@queryText', or anything made with it.”.
If lookupFailed is yesIf lookupFailed is yes
Yes
Change missText to “I could not look that up just now - TheCocktailDB did not answer. Send it again in a moment.”.Change missText to “I could not look that up just now - TheCocktailDB did not answer. Send it again in a moment.”.
No
No steps
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.missText
Finish the run: Nothing matched, so the chat was told that.Finish the run: Nothing matched, so the chat was told that.
No
No steps
Set drinkName to blank.Set drinkName to blank.
If a step below fails, save the error as nameErrorIf a step below fails, save the error as nameError
Try
Trim drink.name and save it as drinkName.Trim drink.name and save it as drinkName.
On error
Change drinkName to blank.Change drinkName to blank.
If drinkName is emptyIf drinkName is empty
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.I could not read that record - it came back without a drink name.
Finish the run: The record had no drink name, so nothing was reported.Finish the run: The record had no drink name, so nothing was reported.
No
No steps
Set factLines to an empty list.Set factLines to an empty list.
Set categoryText to blank.Set categoryText to blank.
If a step below fails, save the error as categoryErrorIf a step below fails, save the error as categoryError
Try
Trim drink.category and save it as categoryText.Trim drink.category and save it as categoryText.
On error
Change categoryText to blank.Change categoryText to blank.
If categoryText isn't emptyIf categoryText isn't empty
Yes
Add Category: categoryText to the end of factLines and save it as factLines.Add Category: categoryText to the end of factLines and save it as factLines.
No
No steps
Set glassText to blank.Set glassText to blank.
If a step below fails, save the error as glassErrorIf a step below fails, save the error as glassError
Try
Trim drink.glass and save it as glassText.Trim drink.glass and save it as glassText.
On error
Change glassText to blank.Change glassText to blank.
If glassText isn't emptyIf glassText isn't empty
Yes
Add Served in: glassText to the end of factLines and save it as factLines.Add Served in: glassText to the end of factLines and save it as factLines.
No
No steps
Set alcoholicText to blank.Set alcoholicText to blank.
If a step below fails, save the error as alcoholicErrorIf a step below fails, save the error as alcoholicError
Try
Trim drink.alcoholic and save it as alcoholicText.Trim drink.alcoholic and save it as alcoholicText.
On error
Change alcoholicText to blank.Change alcoholicText to blank.
If alcoholicText isn't emptyIf alcoholicText isn't empty
Yes
Add Classification: alcoholicText to the end of factLines and save it as factLines.Add Classification: alcoholicText to the end of factLines and save it as factLines.
No
No steps
Count the items in factLines and save it as factCount.Count the items in factLines and save it as factCount.
Set factsPart to blank.Set factsPart to blank.
If factCount is greater than 0If factCount is greater than 0
Yes
Change factsPart to Change factsPart to factLines joined by a new line.
No
No steps
Set ingredientLines to an empty list.Set ingredientLines to an empty list.
For each ingredientRow in drink.ingredients:For each ingredientRow in drink.ingredients:
Set ingredientName to blank.Set ingredientName to blank.
If a step below fails, save the error as ingredientNameErrorIf a step below fails, save the error as ingredientNameError
Try
Trim ingredientRow.name and save it as ingredientName.Trim ingredientRow.name and save it as ingredientName.
On error
Change ingredientName to blank.Change ingredientName to blank.
If ingredientName isn't emptyIf ingredientName isn't empty
Yes
Set ingredientMeasure to blank.Set ingredientMeasure to blank.
If a step below fails, save the error as measureErrorIf a step below fails, save the error as measureError
Try
Trim ingredientRow.measure and save it as ingredientMeasure.Trim ingredientRow.measure and save it as ingredientMeasure.
On error
Change ingredientMeasure to blank.Change ingredientMeasure to blank.
Set ingredientLine to “- ingredientName”.Set ingredientLine to “- ingredientName”.
If ingredientMeasure isn't emptyIf ingredientMeasure isn't empty
Yes
Change ingredientLine to “- ingredientMeasure ingredientName”.Change ingredientLine to “- ingredientMeasure ingredientName”.
No
No steps
Add ingredientLine to the end of ingredientLines and save it as ingredientLines.Add ingredientLine to the end of ingredientLines and save it as ingredientLines.
No
No steps
Count the items in ingredientLines and save it as ingredientLineCount.Count the items in ingredientLines and save it as ingredientLineCount.
Set ingredientsPart to blank.Set ingredientsPart to blank.
If ingredientLineCount is greater than 0If ingredientLineCount is greater than 0
Yes
Change ingredientsPart to Change ingredientsPart to Ingredients ingredientLines joined by a new line.
No
No steps
Set methodText to blank.Set methodText to blank.
If a step below fails, save the error as methodErrorIf a step below fails, save the error as methodError
Try
Trim drink.instructions and save it as methodText.Trim drink.instructions and save it as methodText.
On error
Change methodText to blank.Change methodText to blank.
Set methodPart to blank.Set methodPart to blank.
If methodText isn't emptyIf methodText isn't empty
Yes
Change methodPart to Change methodPart to How to make it methodText truncated to 1200 characters using “...” as the ellipsis (keeping words whole).
No
No steps
Set otherNames to an empty list.Set otherNames to an empty list.
Set listedCount to 0.Set listedCount to 0.
For each candidate in alternativePool:For each candidate in alternativePool:
If listedCount is greater than or equal to listLimitIf listedCount is greater than or equal to listLimit
Yes
Stop repeating.Stop repeating.
No
No steps
Set candidateName to blank.Set candidateName to blank.
If a step below fails, save the error as candidateErrorIf a step below fails, save the error as candidateError
Try
Trim candidate.name and save it as candidateName.Trim candidate.name and save it as candidateName.
On error
Change candidateName to blank.Change candidateName to blank.
If candidateName isn't emptyIf candidateName isn't empty
Yes
If candidateName is not drinkNameIf candidateName is not drinkName
Yes
Add candidateName to the end of otherNames and save it as otherNames.Add candidateName to the end of otherNames and save it as otherNames.
Add 1 to listedCount.Add 1 to listedCount.
No
No steps
No
No steps
Count the items in otherNames and save it as otherCount.Count the items in otherNames and save it as otherCount.
Set alternativesPart to blank.Set alternativesPart to blank.
If otherCount is greater than 0If otherCount is greater than 0
Yes
Change alternativesPart to Change alternativesPart to Also matching '@queryText': otherNames joined by “, ”.
No
No steps
Set drinkUrl to blank.Set drinkUrl to blank.
If a step below fails, save the error as urlErrorIf a step below fails, save the error as urlError
Try
Trim drink.url and save it as drinkUrl.Trim drink.url and save it as drinkUrl.
On error
Change drinkUrl to blank.Change drinkUrl to blank.
Set creditPart to:Set creditPart to:Recipe and photo from TheCocktailDB.
If drinkUrl starts with “https://”If drinkUrl starts with “https://”
Yes
Change creditPart to Change creditPart to Recipe and photo from TheCocktailDB: drinkUrl.
No
No steps
Set replyTop to “Here is the recipe for drinkName.@factsPart”.Set replyTop to “Here is the recipe for drinkName.@factsPart”.
Set replyBody to ingredientsPart plus methodPart.Set replyBody to ingredientsPart plus methodPart.
Set replyTail to alternativesPart plus creditPart.Set replyTail to alternativesPart plus creditPart.
Shorten replyTop plus replyBody plus replyTail to 3800 characters (keeping words whole) and save it as replyText.Shorten replyTop plus replyBody plus replyTail to 3800 characters (keeping words whole) and save it as replyText.
Set photoUrl to blank.Set photoUrl to blank.
If a step below fails, save the error as photoErrorIf a step below fails, save the error as photoError
Try
Trim drink.thumbnail and save it as photoUrl.Trim drink.thumbnail and save it as photoUrl.
On error
Change photoUrl to blank.Change photoUrl to blank.
If photoUrl doesn't start with “https://”If photoUrl doesn't start with “https://”
Yes
Change photoUrl to blank.Change photoUrl to blank.
No
No steps
If photoUrl isn't emptyIf photoUrl isn't empty
Yes
If a step below fails, save the error as photoErrorIf a step below fails, save the error as photoError
Try
TelegramTelegramSend a photo to chat chatId.Send a photo to chat chatId. Photo URL: photoUrldrinkName - photo from TheCocktailDB truncated to 900 characters using "..." as the ellipsis (keeping words whole)
On error
Show in the output: Could not send the photo, so only the recipe went out: photoError.Show in the output: Could not send the photo, so only the recipe went out: photoError.
No
No steps
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.replyText
If photoUrl isn't emptyIf photoUrl isn't empty
Yes
Finish the run: The recipe and the drink's photo were sent back to the chat they were asked for in.Finish the run: The recipe and the drink's photo were sent back to the chat they were asked for in.
No
Finish the run: The recipe was sent back to the chat it was asked for in; TheCocktailDB had no photo for that drink.Finish the run: The recipe was sent back to the chat it was asked for in; TheCocktailDB had no photo for that drink.