Giter Site home page Giter Site logo

slack-notification-resource's Introduction

Slack notification sending resource

Sends messages to Slack.

Source Configuration

  • url: Required. The webhook URL as provided by Slack. Usually in the form: https://hooks.slack.com/services/XXXX

Behavior

out: Sends message to Slack.

Send message to Slack, with the configured parameters.

Parameters

Required:

Either of the following parameters are required:

  • text: Static text of the message to send.
  • text_file: File that contains the message to send. This allows the message to be generated by a previous task step in the Concourse job.

The text can contain links in form <http://example.com> or <http://example.com|Click here!>.

Optional:

  • channel: Optional. Override channel to send message to. #channel and @user forms are allowed.
  • username: Optional. Override name of the sender of the message.
  • icon_url: Optional. Override icon by providing URL to the image.
  • icon_emoji: Optional. Override icon by providing emoji code (e.g. :ghost:).
  • silent: Optional. Do not print curl output (avoids leaking slack webhook URL)

Metadata

Various metadata is available in the form of environment variables. Any environment variables present in the parameters will be automatically evaluated; this enables dynamic parameter content.

The following pipeline config snippet demonstrates how to incorporate the metadata:

---
jobs:
- name: some-job
  plan:
  - put: slack-alert
    params:
      channel: '#my_channel'
      text: |
        The build had a result. Check it out at:
        http://my.concourse.url/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
        or at:
        http://my.concourse.url/builds/$BUILD_ID

See the official documentation for a complete list of available metadata.

Examples

If you're interested in the API of Concourse resources and/or contributing to this resource, you can play with the out script using examples. There are some available in the examples folder.

Note: they have a params.debug set so that it only prints out the data structures rather than attempting to invoke the Slack API. Remove it and set a real Slack API to test the script against Slack.

$ cat examples/text.out | ./out
webhook_url https://some.url
body {"text":"Inline static text","username":"concourse","icon_url":null,"icon_emoji":null,"channel":null}

$ cat examples/text_file.out | ./out
webhook_url https://some.url
body {"text":"This text came from sample.txt. It could have been generated by a previous Concourse task.","username":"concourse","icon_url":null,"icon_emoji":null,"channel":null}

slack-notification-resource's People

Contributors

drnic avatar dsabeti avatar lnguyen avatar nopik avatar robdimsdale avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.