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

TelegramTelegramWhen a new message is received. Save it as incomingMessage.When a new message is received. Save it as incomingMessage.
ValuesSet alternativesToList to 5.Set alternativesToList to 5.
MathSet listLimit to alternativesToList multiplied by 1.Set listLimit to alternativesToList multiplied by 1.
Decisions & LoopsIf listLimit is less than 1If listLimit is less than 1
Yes
Decisions & LoopsStop 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
Decisions & LoopsIf listLimit is greater than 20If listLimit is greater than 20
Yes
Decisions & LoopsStop 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
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 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
ValuesSet queryText to blank.Set queryText 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 queryText.Trim incomingMessage.text and save it as queryText.
On error
Decisions & LoopsFinish 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.
ValuesSet 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.
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 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'.
Decisions & LoopsFinish 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
Decisions & LoopsIf 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.
Decisions & LoopsFinish 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
ValuesSet lookupFailed to false.Set lookupFailed to false.
ValuesSet nameMatches to an empty list.Set nameMatches to an empty list.
Decisions & LoopsIf 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.
ValuesChange nameMatches to searchResult.drinks.Change nameMatches to searchResult.drinks.
On error
ValuesChange lookupFailed to true.Change lookupFailed to true.
ValuesChange nameMatches to an empty list.Change nameMatches to an empty list.
ValuesSet matchCount to 0.Set matchCount to 0.
Decisions & LoopsIf a step below fails, save the error as countErrorIf a step below fails, save the error as countError
Try
ListsCount the items in nameMatches and save it as matchCount.Count the items in nameMatches and save it as matchCount.
On error
ValuesChange matchCount to 0.Change matchCount to 0.
ValuesSet drink to nothing.Set drink to nothing.
ValuesSet alternativePool to an empty list.Set alternativePool to an empty list.
Decisions & LoopsIf matchCount is greater than 0If matchCount is greater than 0
Yes
ListsGet the first item of nameMatches and save it as drink.Get the first item of nameMatches and save it as drink.
ValuesChange alternativePool to nameMatches.Change alternativePool to nameMatches.
No
No steps
Decisions & LoopsIf drink is emptyIf drink is empty
Yes
ValuesSet ingredientMatches to an empty list.Set ingredientMatches to an empty list.
Decisions & LoopsIf 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.
ValuesChange ingredientMatches to filterResult.drinks.Change ingredientMatches to filterResult.drinks.
On error
ValuesChange ingredientMatches to an empty list.Change ingredientMatches to an empty list.
ValuesSet ingredientCount to 0.Set ingredientCount to 0.
Decisions & LoopsIf a step below fails, save the error as ingredientCountErrorIf a step below fails, save the error as ingredientCountError
Try
ListsCount the items in ingredientMatches and save it as ingredientCount.Count the items in ingredientMatches and save it as ingredientCount.
On error
ValuesChange ingredientCount to 0.Change ingredientCount to 0.
Decisions & LoopsIf ingredientCount is greater than 0If ingredientCount is greater than 0
Yes
ValuesChange alternativePool to ingredientMatches.Change alternativePool to ingredientMatches.
ListsGet the first item of ingredientMatches and save it as firstMatch.Get the first item of ingredientMatches and save it as firstMatch.
ValuesSet firstId to blank.Set firstId to blank.
Decisions & LoopsIf a step below fails, save the error as idErrorIf a step below fails, save the error as idError
Try
TextTrim firstMatch.id and save it as firstId.Trim firstMatch.id and save it as firstId.
On error
ValuesChange firstId to blank.Change firstId to blank.
Decisions & LoopsIf firstId isn't emptyIf firstId isn't empty
Yes
Decisions & LoopsIf 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
ValuesChange drink to nothing.Change drink to nothing.
No
No steps
No
No steps
No
No steps
Decisions & LoopsIf drink is emptyIf drink is empty
Yes
ValuesSet 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.
Decisions & LoopsIf lookupFailed is yesIf lookupFailed is yes
Yes
ValuesChange 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
Decisions & LoopsFinish the run: Nothing matched, so the chat was told that.Finish the run: Nothing matched, so the chat was told that.
No
No steps
ValuesSet drinkName to blank.Set drinkName to blank.
Decisions & LoopsIf a step below fails, save the error as nameErrorIf a step below fails, save the error as nameError
Try
TextTrim drink.name and save it as drinkName.Trim drink.name and save it as drinkName.
On error
ValuesChange drinkName to blank.Change drinkName to blank.
Decisions & LoopsIf 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.
Decisions & LoopsFinish 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
ValuesSet factLines to an empty list.Set factLines to an empty list.
ValuesSet categoryText to blank.Set categoryText to blank.
Decisions & LoopsIf a step below fails, save the error as categoryErrorIf a step below fails, save the error as categoryError
Try
TextTrim drink.category and save it as categoryText.Trim drink.category and save it as categoryText.
On error
ValuesChange categoryText to blank.Change categoryText to blank.
Decisions & LoopsIf categoryText isn't emptyIf categoryText isn't empty
Yes
ListsAdd 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
ValuesSet glassText to blank.Set glassText to blank.
Decisions & LoopsIf a step below fails, save the error as glassErrorIf a step below fails, save the error as glassError
Try
TextTrim drink.glass and save it as glassText.Trim drink.glass and save it as glassText.
On error
ValuesChange glassText to blank.Change glassText to blank.
Decisions & LoopsIf glassText isn't emptyIf glassText isn't empty
Yes
ListsAdd 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
ValuesSet alcoholicText to blank.Set alcoholicText to blank.
Decisions & LoopsIf a step below fails, save the error as alcoholicErrorIf a step below fails, save the error as alcoholicError
Try
TextTrim drink.alcoholic and save it as alcoholicText.Trim drink.alcoholic and save it as alcoholicText.
On error
ValuesChange alcoholicText to blank.Change alcoholicText to blank.
Decisions & LoopsIf alcoholicText isn't emptyIf alcoholicText isn't empty
Yes
ListsAdd 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
ListsCount the items in factLines and save it as factCount.Count the items in factLines and save it as factCount.
ValuesSet factsPart to blank.Set factsPart to blank.
Decisions & LoopsIf factCount is greater than 0If factCount is greater than 0
Yes
ValuesChange factsPart to Change factsPart to factLines joined by a new line.
No
No steps
ValuesSet ingredientLines to an empty list.Set ingredientLines to an empty list.
Decisions & LoopsFor each ingredientRow in drink.ingredients:For each ingredientRow in drink.ingredients:
ValuesSet ingredientName to blank.Set ingredientName to blank.
Decisions & LoopsIf a step below fails, save the error as ingredientNameErrorIf a step below fails, save the error as ingredientNameError
Try
TextTrim ingredientRow.name and save it as ingredientName.Trim ingredientRow.name and save it as ingredientName.
On error
ValuesChange ingredientName to blank.Change ingredientName to blank.
Decisions & LoopsIf ingredientName isn't emptyIf ingredientName isn't empty
Yes
ValuesSet ingredientMeasure to blank.Set ingredientMeasure to blank.
Decisions & LoopsIf a step below fails, save the error as measureErrorIf a step below fails, save the error as measureError
Try
TextTrim ingredientRow.measure and save it as ingredientMeasure.Trim ingredientRow.measure and save it as ingredientMeasure.
On error
ValuesChange ingredientMeasure to blank.Change ingredientMeasure to blank.
ValuesSet ingredientLine to - ingredientName.Set ingredientLine to - ingredientName.
Decisions & LoopsIf ingredientMeasure isn't emptyIf ingredientMeasure isn't empty
Yes
ValuesChange ingredientLine to - ingredientMeasure ingredientName.Change ingredientLine to - ingredientMeasure ingredientName.
No
No steps
ListsAdd 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
ListsCount the items in ingredientLines and save it as ingredientLineCount.Count the items in ingredientLines and save it as ingredientLineCount.
ValuesSet ingredientsPart to blank.Set ingredientsPart to blank.
Decisions & LoopsIf ingredientLineCount is greater than 0If ingredientLineCount is greater than 0
Yes
ValuesChange ingredientsPart to Change ingredientsPart to Ingredients ingredientLines joined by a new line.
No
No steps
ValuesSet methodText to blank.Set methodText to blank.
Decisions & LoopsIf a step below fails, save the error as methodErrorIf a step below fails, save the error as methodError
Try
TextTrim drink.instructions and save it as methodText.Trim drink.instructions and save it as methodText.
On error
ValuesChange methodText to blank.Change methodText to blank.
ValuesSet methodPart to blank.Set methodPart to blank.
Decisions & LoopsIf methodText isn't emptyIf methodText isn't empty
Yes
ValuesChange methodPart to Change methodPart to How to make it methodText truncated to 1200 characters using ... as the ellipsis (keeping words whole).
No
No steps
ValuesSet otherNames to an empty list.Set otherNames to an empty list.
ValuesSet listedCount to 0.Set listedCount to 0.
Decisions & LoopsFor each candidate in alternativePool:For each candidate in alternativePool:
Decisions & LoopsIf listedCount is greater than or equal to listLimitIf listedCount is greater than or equal to listLimit
Yes
Decisions & LoopsStop repeating.Stop repeating.
No
No steps
ValuesSet candidateName to blank.Set candidateName to blank.
Decisions & LoopsIf a step below fails, save the error as candidateErrorIf a step below fails, save the error as candidateError
Try
TextTrim candidate.name and save it as candidateName.Trim candidate.name and save it as candidateName.
On error
ValuesChange candidateName to blank.Change candidateName to blank.
Decisions & LoopsIf candidateName isn't emptyIf candidateName isn't empty
Yes
Decisions & LoopsIf candidateName is not drinkNameIf candidateName is not drinkName
Yes
ListsAdd candidateName to the end of otherNames and save it as otherNames.Add candidateName to the end of otherNames and save it as otherNames.
ValuesAdd 1 to listedCount.Add 1 to listedCount.
No
No steps
No
No steps
ListsCount the items in otherNames and save it as otherCount.Count the items in otherNames and save it as otherCount.
ValuesSet alternativesPart to blank.Set alternativesPart to blank.
Decisions & LoopsIf otherCount is greater than 0If otherCount is greater than 0
Yes
ValuesChange alternativesPart to Change alternativesPart to Also matching '@queryText': otherNames joined by , .
No
No steps
ValuesSet drinkUrl to blank.Set drinkUrl to blank.
Decisions & LoopsIf a step below fails, save the error as urlErrorIf a step below fails, save the error as urlError
Try
TextTrim drink.url and save it as drinkUrl.Trim drink.url and save it as drinkUrl.
On error
ValuesChange drinkUrl to blank.Change drinkUrl to blank.
ValuesSet creditPart to:Set creditPart to:Recipe and photo from TheCocktailDB.
Decisions & LoopsIf drinkUrl starts with https://If drinkUrl starts with https://
Yes
ValuesChange creditPart to Change creditPart to Recipe and photo from TheCocktailDB: drinkUrl.
No
No steps
ValuesSet replyTop to Here is the recipe for drinkName.@factsPart.Set replyTop to Here is the recipe for drinkName.@factsPart.
MathSet replyBody to ingredientsPart plus methodPart.Set replyBody to ingredientsPart plus methodPart.
MathSet replyTail to alternativesPart plus creditPart.Set replyTail to alternativesPart plus creditPart.
TextShorten 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.
ValuesSet photoUrl to blank.Set photoUrl to blank.
Decisions & LoopsIf a step below fails, save the error as photoErrorIf a step below fails, save the error as photoError
Try
TextTrim drink.thumbnail and save it as photoUrl.Trim drink.thumbnail and save it as photoUrl.
On error
ValuesChange photoUrl to blank.Change photoUrl to blank.
Decisions & LoopsIf photoUrl doesn't start with https://If photoUrl doesn't start with https://
Yes
ValuesChange photoUrl to blank.Change photoUrl to blank.
No
No steps
Decisions & LoopsIf photoUrl isn't emptyIf photoUrl isn't empty
Yes
Decisions & LoopsIf 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
ValuesShow 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
Decisions & LoopsIf photoUrl isn't emptyIf photoUrl isn't empty
Yes
Decisions & LoopsFinish 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
Decisions & LoopsFinish 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.