Skip to content

Instantly share code, notes, and snippets.

@kiriu-j
Created November 22, 2021 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiriu-j/d8c369a071669fb4bc2c775edb1e2914 to your computer and use it in GitHub Desktop.
Save kiriu-j/d8c369a071669fb4bc2c775edb1e2914 to your computer and use it in GitHub Desktop.
import os
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
slack_token = os.environ["SLACK_BOT_TOKEN"]
client = WebClient(token=slack_token)
try:
response = client.chat_postMessage(
channel="channel name",
text="Hello from your app! :tada:",
)
except SlackApiError as e:
assert e.response["error"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment