Skip to content

snirbenyosef/cnvrg_ai_library_slack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Slack channel integration

send a custom message to a slack channel using incoming webhook slack app.

How It Works

Using Slack's built-in incoming webhook capabilities to send a message: https://slack.dev/python-slack-sdk/webhook/index.html

Running

In Slack:

  1. Go here to create a new slack app. Select Create New App -> From Scratch. Choose a Name & Workspace.

  2. Install app to workspace & choose the target slack channel. From app page, select Settings -> Install App

  3. Copy the webhook URL from the bottom of the page.

In cnvrg:

  1. Define a new secret in your cnvrg project: Go to Settings -> Secrets -> Add. Set the secret's name to be SLACK_WEBHOOK_URL, and the value to be the URL.

  2. Choose the Slack AI Library component, and pass the text you'd wish to send, to the message argument.

Demo Inputs

Send a custom text message:

--message "this is my message"

Send the value of an environemnt variable:

--message $SOME_ENV_VAR

Send the value of a local variable within your code runtime:

--message local_variable

Send the value of a previous task's tag (read more about flow tags here):

--message {{training.length}}

Example Demo from command line:

You can use the following command to try the demo:

python3 slack.py --message "my bonnie is over the ocean, my bonnie is over the sea"        

Customizing the Slack app appearance

You can customize the "bot user" that will send the messages in your webhook app, by visiting the Slack app page and going to Settings -> Basic Information -> then scroll to bottom for Display Information

About

cnvrg_ai_library_slack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%