When someone asks a question in Slack, finds the Notion FAQ pages that match and drafts an answer from them for you to approve.
Uses
ClaudeNotion
Slack
Answer Slack questions from your Notion FAQ
When someone asks a question in the Slack channel you choose, AI first checks it really is a question; greetings, thanks and chat are left alone and nothing is posted. For a real question it picks up to three search words, finds the Notion pages whose titles match, reads each page's title, link and property values, and drafts a short answer built only from what those pages say, naming the page each point came from. Lodol cannot read the body text of a Notion page, so it works best on an FAQ kept as a Notion database with the answer in a property.
The draft comes for approval, in full with its sources, before anything reaches the channel; anyone in your Lodol workspace can approve unless you name approvers. Approve it and the answer goes into the thread with the page links; reject it, or leave it for three days, and only the links are shared, with a line saying which happened. If no page title matches, or the pages found do not cover the question, the thread is told so and no answer is invented to fill the gap.
You need a Slack connection, a Notion connection with your FAQ pages shared with Lodol, and an Anthropic connection; the Slack channel where questions arrive; and a few sentences about your team.
request.When someone posts in a channel. Save it as request.teamContext to blank.Set teamContext to blank.maxPages to 5.Set maxPages to 5.questionText to blank.Set questionText to blank.readErrorIf a step below fails, save the error as readErrorrequest.text and save it as questionText.Trim request.text and save it as questionText.The Slack message carried no text to read, so it was skipped..Show in the output: The Slack message carried no text to read, so it was skipped..questionText is emptyIf questionText is emptyquestionText and save it as screening.Run an AI agent: The message posted in the channel: questionText and save it as screening.screening.output.is_question is noIf screening.output.is_question is no@screening.output.is_question), so nothing was searched or posted. The message was: questionText.Stop and report a problem: The AI could not tell whether this message is a question (it answered @screening.output.is_question), so nothing was searched or posted. The message was: questionText.screening.output.search_words and save it as searchWords.Take the first 3 items of screening.output.search_words and save it as searchWords.searchWords is emptyIf searchWords is emptysearchWords to [questionText].Change searchWords to [questionText].foundPages to an empty list.Set foundPages to an empty list.searchWord in searchWords:For each searchWord in searchWords:searchWord. Save it as found.Search pages for searchWord. Save it as found.foundPages and found.pages into one list and save it as foundPages.Combine foundPages and found.pages into one list and save it as foundPages.id from foundPages and save it as uniquePages.Remove duplicates of id from foundPages and save it as uniquePages.maxPages items of uniquePages and save it as pagesToRead.Take the first maxPages items of uniquePages and save it as pagesToRead.searchWords with , and save it as searchedFor.Join searchWords with , and save it as searchedFor.sourceBlocks to an empty list.Set sourceBlocks to an empty list.sourceLinks to an empty list.Set sourceLinks to an empty list.page in pagesToRead:For each page in pagesToRead:pageTitle to blank.Set pageTitle to blank.titleErrorIf a step below fails, save the error as titleErrorpage.title and save it as pageTitle.Trim page.title and save it as pageTitle.Skipped a search result that had no title..Show in the output: Skipped a search result that had no title..pageTitle isn't emptyIf pageTitle isn't emptypageLink to blank.Set pageLink to blank.linkErrorIf a step below fails, save the error as linkErrorpage.url and save it as pageLink.Trim page.url and save it as pageLink.pageTitle.Show in the output: No link came back for the page pageTitle.pageDetails to (only the title and link are available).Set pageDetails to (only the title and link are available).detailErrorIf a step below fails, save the error as detailErrorpage.id. Save it as fullPage.Get page.id. Save it as fullPage.fullPage.properties to a bulleted list and save it as readable.Convert fullPage.properties to a bulleted list and save it as readable.readable isn't emptyIf readable isn't emptypageDetails to readable.Change pageDetails to readable.pageTitle, so only its title and link were used: detailError as text.Show in the output: Could not read the details of the page pageTitle, so only its title and link were used: detailError as text.pageTitleAdd PAGE: pageTitle
LINK: pageLink
DETAILS: pageDetails to the end of sourceBlocks and save it as sourceBlocks.pageTitle pageLink to the end of sourceLinks and save it as sourceLinks.Add - pageTitle pageLink to the end of sourceLinks and save it as sourceLinks.sourceBlocks is emptyIf sourceBlocks is emptyrequest.channel_id.Reply in a thread in request.channel_id.
Reply To: request.message_tsI could not find a page in our Notion workspace about this (I searched page titles for: searchedFor), so there is nothing written down for me to answer from. Someone will need to answer this one by hand.searchedFor), so no answer was drafted.Finish the run: No Notion page title matched the search (searchedFor), so no answer was drafted.sourceBlocks with a blank line and save it as sources.Join sourceBlocks with a blank line and save it as sources.sourceLinks with a new line and save it as linkList.Join sourceLinks with a new line and save it as linkList.teamContext
The question:
questionText
The pages found in Notion, with their links and property values:
sources'. Save it as drafted.
Maximum response length: 700drafted.response_text and save it as answer.Trim drafted.response_text and save it as answer.answer is empty or answer contains NOT_IN_THE_WIKI (ignoring case)If answer is empty or answer contains NOT_IN_THE_WIKI (ignoring case)request.channel_id.Reply in a thread in request.channel_id.
Reply To: request.message_tsI found these pages in our Notion workspace, but none of them answers this:
linkList
Someone will need to answer this one by hand.questionText Save it as review.Request approval: Post this answer in Slack to: questionText Save it as review.Someone asked in Slack:
questionText
Drafted answer:
answer
Drafted from these Notion pages:
linkList
...review.approved is yesIf review.approved is yesrequest.channel_id.Reply in a thread in request.channel_id.
Reply To: request.message_tsanswer
From our Notion workspace:
linkList
_Drafted from the pages above and checked by a person before posting._outcomeNote to:Set outcomeNote to:A drafted answer was checked and not approved, so only the links are shared here.review.timed_out is yesIf review.timed_out is yesoutcomeNote to:Change outcomeNote to:Nobody checked the drafted answer within three days, so only the links are shared here.request.channel_id.Reply in a thread in request.channel_id.
Reply To: request.message_tsThese pages in our Notion workspace look relevant to your question:
linkList@outcomeNote