Slack Slack: Incoming Webhooks

Summary

This module contains actions for sending messages & approval requests to a Slack channel.

Before you Start

Ensure you have created a PPA Slack app, & enabled incoming webhooks.

See the Integration page for more information

Actions

slack.incoming_webhooks.

send_approval_request

Send an approval request to a Slack channel & wait until it approved/rejected.

Once the request is responded to, a message will be posted to Slack containing the following:

  • Whether the request was approved or rejected
  • The username of the person who responded to the request

Example screenshots of all the Slack messages can be found under the example.

Slack Channel

The message will be send to the channel associated with the supplied webhook URL.

Input
  • url: the Slack incoming webhook URL

  • message: a message to include in the approval request

Output

A dictionary with the following keys:

  • approved: true if the request was approved, false if it was not

  • responder: the PPA user who submitted the response

Example
1
2
3
4
5
- slack.incoming_webhooks.send_approval_request:
    message: Add user to Remote Desktop Users group.
  load:
    url: slack_secrets.webhook_url
  save: approval_response
Approval Request Screenshot

approval-request

Approved Message Screenshot

requested-approved

Rejected Message Screenshot

request-rejected

Supplying Sensitive Data

You should always use a PPA Vault integration to provide sensitive data to a plugin action.

slack.incoming_webhooks.

send_message

Send a message to a Slack channel.

Slack Channel & Rich Messages

The message will be send to the channel associated with the supplied webhook URL.

View the Slack block kit builder here for more information on creating rich messages.

Input
  • url: the Slack incoming webhook URL

  • message: the message to send to the channel

Output

Nothing is outputted by this action.

Simple Message
1
2
3
4
- slack.incoming_webhooks.send_message:
    message: Hello from PPA!
  load:
    url: slack_secrets.webhook_url
Markdown Message
1
2
3
4
5
6
7
8
- slack.incoming_webhooks.send_message:
    message: blocks:
    - type: section
      text:
        type: mrkdwn
        text: 'Hello from PPA!'
  load:
    url: slack_secrets.webhook_url

Supplying Sensitive Data

You should always use a PPA Vault integration to provide sensitive data to a plugin action.