-
Notifications
You must be signed in to change notification settings - Fork 347
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
added check for new user join to chat_endpoint #993
base: main
Are you sure you want to change the base?
Conversation
0b36dfb
to
527b901
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome stuff - thank you @biancaines 💙 just a couple nits
await slack_webhook.notify( | ||
body=f"Attempted to respond in DM channel: {channel_name}", | ||
subject="Slackbot DM Warning", | ||
print(payload.event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's change this to an assert so that our type checker knows for sure that payload.event
is not equal to None
print(payload.event) | |
assert payload.event is not None, "No event found!" |
message = message_var["text"] | ||
# format the message with the user's id | ||
f_string = message.format(user_id=user_id) | ||
# post the message to the user's DM channel | ||
await task(post_slack_message)( | ||
message=(f_string), | ||
channel_id=user_id, # type: ignore | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit on variable names and avoid shadowing the message
kwarg for post_slack_message
message = message_var["text"] | |
# format the message with the user's id | |
f_string = message.format(user_id=user_id) | |
# post the message to the user's DM channel | |
await task(post_slack_message)( | |
message=(f_string), | |
channel_id=user_id, # type: ignore | |
) | |
message_template = message_var["text"] | |
# format the message with the user's id | |
rendered_message = message_template.format(user_id=user_id) | |
# post the message to the user's DM channel | |
await task(post_slack_message)( | |
message=rendered_message, | |
channel_id=user_id, # type: ignore | |
) |
Added marvin welcome message to chat_endpoint.
In order to get the message, you'll need to create a Prefect Cloud variable called "marvin_welcome_message" that has the following json obj:
You'll also need to ensure the Slack chatbot is subscribed to the following bot events to check for new users joining the workspace :
^This can be modified on the "Event Subscriptions" page when configuring your app in Slack