Robin
11/22/2024, 3:53 PMdef notify_slack_channel(
    flow_context,
    channel,
    message="completed without issues",
    status_emoji=":white_check_mark:",
):
    ACCOUNT_ID, WORKSPACE_ID = read_prefect_secrets()
    flow_run_id = flow_context.flow_run.id
    flow_name = flow_context.flow.name
    flow_run_url = f"{BASE_URL}/account/{ACCOUNT_ID}/workspace/{WORKSPACE_ID}/runs/flow-run/{flow_run_id}"
    flow_run_link = f"<{flow_run_url}|'{flow_context.flow_run.name}'>"
    send_chat_message(
        slack_credentials=slack_credentials_block,
        channel=f"#{channel}",
        text=f"{status_emoji} `flexa-{flow_name}`: {flow_run_link} {message}",
    )Marvin
11/22/2024, 3:54 PMprefect-slackprefect-slackpip install prefect-slackpython
   from prefect import flow
   from prefect_slack import SlackTask
   @flow
   def my_flow():
       slack_task = SlackTask(token="<YOUR_SLACK_TOKEN>")
       slack_task.run(
           channel="<YOUR_CHANNEL>",
           text="Flow run completed successfully!"
       )
   if __name__ == "__main__":
       my_flow()PREFECT_API_URLPREFECT_API_KEYRobin
11/22/2024, 3:57 PMRobin
11/22/2024, 4:00 PMMarvin
11/22/2024, 4:01 PMprefect-slackprefect-slackbash
pip install prefect-slackprefect-slackRobin
11/22/2024, 4:03 PMNate
11/22/2024, 4:04 PMNate
11/22/2024, 4:04 PMRobin
11/22/2024, 4:11 PMRobin
11/22/2024, 4:11 PMfrom prefect_slack import SlackTaskNate
11/22/2024, 4:12 PMNate
11/22/2024, 4:12 PMsend_chat_messageNate
11/22/2024, 4:13 PMRobin
11/22/2024, 4:16 PMNate
11/22/2024, 5:21 PMNate
11/22/2024, 5:21 PMsend_chat_messageNate
11/22/2024, 5:22 PMasyncawaitasyncio.runRobin
11/22/2024, 5:23 PMRobin
11/22/2024, 5:23 PMNate
11/22/2024, 5:24 PMsend_chat_messageasyncSlackCredentialsBring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by