Slack Curl



  1. Justa quick video showing how to use curl to post to slack rooms or even users.
  2. でもcurl分からない状態でいきなりパッケージに頼るのもなぁ・・。という事で、Slack Web API を使って curl入門してみます。 筆者のスキル感 ・普段フロントエンドやることが多い ・Laravel歴2ヶ月くらい ・MVCモデル分かる、複雑な処理は無理.

Slack is a very good team collaboration tool that we use on a daily basis for sharing information. Remember the good old times on the irc channels?Slack is conceptually the same, but implemented with the latest and greatest web technologies out there (web sockets, rest api, etc). Also it wascreated with a lot extensibility/integration points, which opens a lot of cool options when it comes to send automatic notifications from scripts andprograms.

Slack Curl Mention

Slack Curl

Curl - command line tool for sending web requests. Windows - can be installed with Scoop and Chocolatey.; Linux - can be installed with package manager. MacOS - can be installed with Homebrew and MacPorts.; Also, you can download executable from their website and run it from a directory or make it discoverable through PATH, so it can be run from anywhere. Making curl requests to search your Slack History is a little clunky, so we have modified the example UI that MeiliSearch provides in their docs to search through the Slack results. @mattstone-ascot @jlwin it's most certainly not a matter of preference. The PHP Framework Interoperability Group (PHP-FIG), participated in by the maintainers of such insignificant PHP projects as Symfony, Laravel, Yii, Zend, Composer, Drupal, Joomla, Magento, phpBB and CakePHP, has set some universally accepted standards, amongst which the coding standards PSR-1 and PSR-2.

The easiest way is simply send a HTTP POST request from your script, using curl. You will need two things:

  • Create an incoming webhook in slack
  • Post your notification with curl

Go to slack home using a web browser, and select Add Integrations. Scroll to the bottom, and select Incoming WebHooks (click on Add).You have the option to select your channel (or create a new one), and you will see your hook url which looks something like https://hooks.slack.com/services/${ID}/. Give it a name and a custom icon.

Then, you can use this curl command to post:

curl - command line tool for sending web requests.

  • Windows - can be installed with Scoop and Chocolatey.
  • Linux - can be installed with package manager.
  • macOS - can be installed with Homebrew and MacPorts.

Also, you can download executable from their website and run it from a directory or make it discoverable through PATH,so it can be run from anywhere. Using a package manager is preferable as it simplifies the process of installing and updating the tool.

Usage

curl -X POST -H 'Content-Type: application/json' -d <body> <link>

Slack Curl

Bash/Zsh/etc.

PowerShell

Slack Curl

Command Prompt (cmd.exe)