-
Notifications
You must be signed in to change notification settings - Fork 473
feat: add Slack webhook to thread Loops contact status and source #2222
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
feat: add Slack webhook to thread Loops contact status and source #2222
Conversation
- Add Slack Events API webhook endpoint at /webhook/slack/events - Extract email from Loops bot messages and look up contact Source - Post threaded reply with Source field under Loops bot messages - Add Slack signature verification middleware - Add Loops API integration to fetch contact by email - Add environment variables: SLACK_BOT_TOKEN, SLACK_SIGNING_SECRET, LOOPS_API_KEY, LOOPS_SLACK_CHANNEL_ID Co-Authored-By: [email protected] <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
✅ Deploy Preview for hyprnote ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for hyprnote-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
- Improve email regex to handle + and other valid characters - Add timeout to Slack API requests with AbortController - Handle Slack API errors properly (check ok: false in JSON response) - Export LoopsContact interface Co-Authored-By: [email protected] <[email protected]>
Co-Authored-By: [email protected] <[email protected]>
- Add classifyContactStatus function to categorize contacts based on Source, Intent, Platform - Paid: Source = 'Stripe webhook' - Signed up: Source = 'Supabase webhook' - Interested: Source = 'LANDING_PAGE' + Intent = 'Waitlist' + Platform = 'Windows' or 'Linux' - Update Slack thread reply to show status with details Co-Authored-By: [email protected] <[email protected]>
Summary
Adds a Slack Events API webhook endpoint that listens for Loops bot messages about new contacts and automatically threads a reply with the contact's status and source information. When Loops posts a message like
<mailto:[email protected]|[email protected]> was added to your account, this webhook extracts the email, looks up the contact in Loops, classifies their status, and replies in a thread withStatus: {status} (Source: {source}, Intent: {intent}, Platform: {platform}).Contact Status Classification:
New files:
apps/api/src/middleware/slack.ts- Slack signature verification middlewareapps/api/src/integration/loops.ts- Loops API client +classifyContactStatusfunctionapps/api/src/integration/slack.ts- Slack API client to post thread repliesNew environment variables (all optional):
SLACK_BOT_TOKEN- Bot token for posting messagesSLACK_SIGNING_SECRET- For webhook signature verificationLOOPS_API_KEY- For fetching contact dataLOOPS_SLACK_CHANNEL_ID- Optional channel filterReview & Testing Checklist for Human
"Stripe webhook","Supabase webhook","LANDING_PAGE","Waitlist","Windows","Linux". Confirm these match the actual values stored in Loops (case-sensitive).intentandplatformas top-level fields - I assumed these are top-level fields on the contact object. They might be custom fields with different names in the actual API response.middleware/slack.tswas written manually using Web Crypto API. Compare against Slack's official documentation./<mailto:([^|]+)\|/should match the actual Loops message format. Test with real messages.Recommended test plan:
{API_URL}/webhook/slack/eventsmessage.channelseventsNotes
url_verificationchallenge for initial setupStatus: {status} (Source: {source}, Intent: {intent}, Platform: {platform})Link to Devin run: https://app.devin.ai/sessions/c9e80737c4dc4ebda4eed2f6c217928c
Requested by: [email protected] (@ComputelessComputer)