flexget.components.notify.notifiers.slack module#

class flexget.components.notify.notifiers.slack.SlackNotifier[source]#

Bases: object

Send a Slack notification.

Sending messages using incoming webhooks

Example:

notify:
  entries:
    via:
      - slack:
          web_hook_url: "https://hooks.slack.com/services/..."
          blocks:
            - section:
                text: '<{{ tvdb_url }}|{{ series_name }} ({{ series_id }})>'
            - section:
                text: '{{ tvdb_ep_overview }}'
                image:
                  url: "https://api.slack.com/img/blocks/bkb_template_images/plants.png"
                  alt_text: 'plants'
                fields:
                  - '*Score*'
                  - '*Genres*'
                  - '{{ imdb_score }}'
                  - "{{ imdb_genres | join(', ') | title }}"
                  - '*Rating*'
                  - '*Cast*'
                  - '{{ imdb_mpaa_rating }}'
                  - >
                    {% for key, value in imdb_actors.items() %}{{ value }}{% if not loop.last %}, {% endif %}
                    {% endfor %}
            - image:
                url: "{{ tvdb_banner }}"
                alt_text: "{{ series_name }} Banner"
            - context:
                - image:
                    url: 'https://image.freepik.com/free-photo/red-drawing-pin_1156-445.jpg'
                    alt_text: 'red pin'
                - text: ':round_pushpin:'
                - text: 'Task: {{ task }}'

Legacy custom integrations incoming webhooks

Example (legacy):

notify:
  entries:
    via:
      - slack:
          web_hook_url: <string>
          [channel: <string>] (override channel, use "@username" or "#channel")
          [username: <string>] (override username)
          [icon_emoji: <string>] (override emoji icon)
          [icon_url: <string>] (override emoji icon)
          [attachments: <array>[<object>]] (override attachments)
notify(title, message, config)[source]#

Send a Slack notification.

schema = {'additionalProperties': False, 'allOf': [{'else': {'allOf': [{'error_not': "Can only use one of 'icon_emoji' or 'icon_url'", 'not': {'required': ['icon_emoji', 'icon_url']}}, {'error_not': "Cannot specify 'blocks' while using version 1 Slack formatting", 'not': {'required': ['blocks']}}], 'anyOf': [{'required': ['message']}, {'required': ['attachments']}]}, 'if': {'required': ['blocks']}, 'then': {'allOf': [{'error_not': "Cannot specify 'message' while using version 2 Slack formatting", 'not': {'required': ['message']}}, {'error_not': "Cannot specify 'attachments' while using version 2 Slack formatting", 'not': {'required': ['attachments']}}]}}], 'definitions': {'image_block': {'additionalProperties': False, 'properties': {'alt_text': {'type': 'string'}, 'url': {'format': 'uri', 'type': 'string'}}, 'required': ['url', 'alt_text'], 'type': 'object'}, 'image_block_w_title': {'additionalProperties': False, 'properties': {'alt_text': {'type': 'string'}, 'title': {'type': 'string'}, 'url': {'format': 'uri', 'type': 'string'}}, 'required': ['url', 'alt_text'], 'type': 'object'}}, 'properties': {'attachments': {'items': {'additionalProperties': False, 'dependentRequired': {'actions': ['callback_id']}, 'properties': {'actions': {'items': {'additionalProperties': False, 'properties': {'name': {'type': 'string'}, 'text': {'type': 'string'}, 'type': {'type': 'string'}, 'value': {'type': 'string'}}, 'required': ['name', 'text', 'type', 'value'], 'type': 'object'}, 'minItems': 1, 'type': 'array'}, 'author_icon': {'type': 'string'}, 'author_link': {'type': 'string'}, 'author_name': {'type': 'string'}, 'callback_id': {'type': 'string'}, 'color': {'type': 'string'}, 'fallback': {'type': 'string'}, 'fields': {'items': {'additionalProperties': False, 'properties': {'short': {'type': 'boolean'}, 'title': {'type': 'string'}, 'value': {'type': 'string'}}, 'required': ['title'], 'type': 'object'}, 'minItems': 1, 'type': 'array'}, 'footer': {'type': 'string'}, 'footer_icon': {'type': 'string'}, 'image_url': {'type': 'string'}, 'pretext': {'type': 'string'}, 'text': {'type': 'string'}, 'thumb_url': {'type': 'string'}, 'title': {'type': 'string'}, 'title_link': {'type': 'string'}, 'ts': {'type': 'number'}}, 'required': ['fallback'], 'type': 'object'}, 'type': 'array'}, 'blocks': {'items': {'additionalProperties': False, 'properties': {'context': {'items': {'anyOf': [{'required': ['text']}, {'required': ['image']}], 'properties': {'image': {'$ref': '#/definitions/image_block'}, 'text': {'type': 'string'}}, 'type': 'object'}, 'maxItems': 10, 'minItems': 1, 'type': 'array'}, 'divider': {'type': 'boolean'}, 'image': {'properties': {'image': {'$ref': '#/definitions/image_block_w_title'}, 'text': {'type': 'string'}}, 'type': 'object'}, 'section': {'additionalProperties': False, 'anyOf': [{'required': ['text']}, {'required': ['fields']}], 'properties': {'fields': {'items': {'type': 'string'}, 'maxItems': 10, 'minItems': 1, 'type': 'array'}, 'image': {'$ref': '#/definitions/image_block'}, 'text': {'type': 'string'}}, 'type': 'object'}}, 'type': 'object'}, 'maxItems': 50, 'minItems': 1, 'type': 'array'}, 'channel': {'type': 'string'}, 'icon_emoji': {'type': 'string'}, 'icon_url': {'format': 'uri', 'type': 'string'}, 'message': {'type': 'string'}, 'unfurl_links': {'type': 'boolean'}, 'username': {'default': 'Flexget', 'type': 'string'}, 'web_hook_url': {'format': 'uri', 'type': 'string'}}, 'required': ['web_hook_url'], 'type': 'object'}#
flexget.components.notify.notifiers.slack.register_plugin()[source]#