Installing cURL on Windows for Slack Notifications

Macbook Pro Pexels

Do the following steps to install cURL on a Windows OS.  I mainly use cURL on Windows Servers to notify me of certain events via API.

Installing cURL

  • Download cURL
    • Make sure to download the one from: Viktor Szakats
    • Extract the contents to: c:\curl
  • Download the cacert.pem
    • Extract this to where curl.exe is located. Typically, this is located in c:\curl\bin
    • Rename this file to: curl-ca-bundle.crt

Add as Environment Variable

Credits to CharlesNadeau on the following guide.

  1. In the Start menu, right-click This PC and select More > Properties.
    Note: In Windows 7, right-click Computer and select Properties.
  2. Click Advanced System Settings.
  3. In the Advanced tab, click the Environment Variables button on the lower right side.
  4. Select the “Path” variable in System Variables, and click Edit.
  5. In the Edit environment variable dialog box, click New and add the path to the curl.exefile. Example: C:\curl.

Slack Notification API Example

Use the following to send a curl to a Slack hook.

C:\curl\curl-7.59.0-win64-mingw\bin\curl.exe -k -g -X POST -d "payload={\"text\":\"This is the notification in the body of Slack.\", \"channel\":\"#channel\", \"username\":\"FIRSTNAME LASTNAME\", \"icon_emoji\":\":thumbsup:\"}" https://hooks.slack.com/services/API_URL

Credits:

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: