Skip to content

feat: slack webhook handler #516

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

Merged
merged 10 commits into from
Feb 16, 2025
Merged

feat: slack webhook handler #516

merged 10 commits into from
Feb 16, 2025

Conversation

jayhack
Copy link
Contributor

@jayhack jayhack commented Feb 16, 2025

Enables the following syntax:

app = CodegenApp(name="slack-test", image=base_image, modal_api_key='')

# Runs on app mention events
@app.slack.event('app_mention')
def handle_mention(client: WebClient, event: SlackEvent):
    output = client.chat_postMessage(
        thread_ts=event.ts,
        text="Hello, world!",
        channel=event.channel
    )
    return {"message": "Event handled successfully"}

# Have to put this at the end
@app.function(secrets=[modal.Secret.from_dotenv()])
@modal.web_endpoint(method="POST")
def entrypoint(event: SlackWebhookPayload):
    app.slack.handle(event)

@jayhack jayhack requested review from codegen-team and a team as code owners February 16, 2025 05:14
@jayhack jayhack enabled auto-merge (squash) February 16, 2025 05:18
Copy link

codecov bot commented Feb 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files

@jayhack jayhack merged commit 21076d5 into develop Feb 16, 2025
25 of 26 checks passed
@jayhack jayhack deleted the jay/modal-integration branch February 16, 2025 05:23
Copy link
Contributor

🎉 This PR is included in version 0.18.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

rushilpatel0 pushed a commit that referenced this pull request Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants