-
Notifications
You must be signed in to change notification settings - Fork 235
Integrate slackbot with baml client and sage backend #2308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
Integrate slackbot with baml client and sage backend #2308
Conversation
… handling Co-authored-by: chris.watts.t <chris.watts.t@gmail.com>
Cursor Agent can help with this pull request. Just |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
🌿 Preview your docs: https://boundary-preview-2d6dbbcd-4746-4ab3-99ad-1ab31bbbb80c.docs.buildwithfern.com |
return text | ||
.replace(/<@[^>]+>/g, '') // remove mentions |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
a user-provided value
@seawatts fyi the tests are all failing on: |
Yea. Not going to merge this. It was a one shot prompt to see if cursor could do it. It failed. |
Pull Request Template
Thanks for taking the time to fill out this pull request!
Issue Reference
Please link to any related issues
Changes
Please describe the changes proposed in this pull request
This PR enables a Slackbot by adding a new Slack Events API endpoint to
sage-backend
and making the backend more resilient to environment-dependent initialization at build time.Key changes include:
/api/slack/events
to handle Slackapp_mention
and direct messages, including signature verification and URL challenges.submitQuery
action to process user requests and respond in-thread.OpenAI
,Pinecone
,NotionLogger
, andSlackFeedbackLogger
clients to be initialized on demand within request handlers. This prevents build-time failures when environment variables are not present.submitQuery
to dynamically importbaml_client
at runtime, providing a fallback mechanism (returning top Pinecone docs) if the client is not available (e.g., if not generated during deployment).Testing
Please describe how you tested these changes
sage-backend
builds successfully and outlined Slack configuration for functional testing)typescript/apps/sage-backend
build environmentScreenshots
If applicable, add screenshots to help explain your changes
[Add screenshots here...]
PR Checklist
Please ensure you've completed these items
Additional Notes
Add any other context about the PR here
How to configure Slack:
app_mention
,message.im
.<your-sage-backend-url>/api/slack/events
.SLACK_SIGNING_SECRET
(from your Slack app settings)SLACK_BOUNDARY_BOT_TOKEN
(the Bot User OAuth Token)OPENAI_API_KEY
PINECONE_API_KEY
NOTION_BOUNDARY_BOT_TOKEN
,NOTION_ASK_BAML_LOGS_DATABASE_ID
@baamy find me a friday project
).submitQuery
function now uses aneval
-based dynamic import forbaml_client
. Ifbaml_client
is not generated and available at runtime, the bot will provide a fallback response using Pinecone search results. Ensurebaml_client
is generated perbaml_src/generators.baml
for full functionality.