Skip to main content

slack-webhook is a python client library for slack api Incoming Webhooks on Python 3.6 and above.

Project description

slack-webhook

PyPI License: MIT codecov Build Status PyPI - Python Version Downloads

slack-webhook is a python client library for slack api Incoming Webhooks on Python 3.6 and above.

Installation

$ pip install slack-webhook

Usage

basic

from slack_webhook import Slack

slack = Slack(url='https://hooks.slack.com/services/T00/B00/XXX')
slack.post(text="Hello, world.")

advanced

from slack_webhook import Slack

slack = Slack(url='https://hooks.slack.com/services/T00/B00/XXX')
slack.post(text="Robert DeSoto added a new task",
    attachments = [{
        "fallback": "Plan a vacation",
        "author_name": "Owner: rdesoto",
        "title": "Plan a vacation",
        "text": "I've been working too hard, it's time for a break.",
        "actions": [
            {
                "name": "action",
                "type": "button",
                "text": "Complete this task",
                "style": "",
                "value": "complete"
            },
            {
                "name": "tags_list",
                "type": "select",
                "text": "Add a tag...",
                "data_source": "static",
                "options": [
                    {
                        "text": "Launch Blocking",
                        "value": "launch-blocking"
                    },
                    {
                        "text": "Enhancement",
                        "value": "enhancement"
                    },
                    {
                        "text": "Bug",
                        "value": "bug"
                    }
                ]
            }
        ]
    }]
)

Getting started

For help getting started with Incoming Webhooks, view our online documentation.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slack-webhook-1.0.7.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

slack_webhook-1.0.7-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page