Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. SLACK driver, use text formatting?

SLACK driver, use text formatting?

Scheduled Pinned Locked Moved Support
6 Posts 2 Posters 15.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    M
    Millenium7
    wrote on last edited by
    #1

    We've been using the SLACK notification driver for a while to send basic text, with the most advanced formatting to date being simple bold highling of certain text elements. This is done by just putting * around text i.e.
    *this part is bold* this part is not

    But I want to actually post with different colours, perhaps even with fancy attachments, but for now I just want to stick with colors

    Is it possible with the included SLACK driver?
    I've tried simply parsing this as text
    {"attachments": [{"color": "#ad03fc","text": "Optional text that appears within the attachment"}]}
    which pasting it in here shows is valid syntax https://api.slack.com/docs/messages/builder
    but I just get the literal text in the SLACK channel. I don't know how the included driver actually works to perhaps further modify the syntax so it works

    Any help?

    Alternatively can NetXMS do a HTTP Put? because if so I know how to make that work, we already do fancy formatting with Solarwinds that way

    1 Reply Last reply
    0
    • F
      F
      Filipp Sudanov
      wrote on last edited by
      #2

      In current implementation of slack driver it creates a simple json like this:

      {"channel":"C061EG9SL","text":"mesage_text"}
      

      so anything you write just goes into "text" field. An ability to generate custom jsons would require to make quite some changes in slack notification channel code.

      1 Reply Last reply
      0
      • M
        M
        Millenium7
        wrote on last edited by
        #3

        Ok so the SLACK driver is not going to be able to support fancy formatting beyond anything that can be expressed in regular text, i.e. bolding

        However can NetXMS do a HTTP PUT? As that would allow me to post whatever I want. As mentioned before this is how we get fancy formatting from Solarwinds NCM as it pushes to slack via a HTTP PUT operation

        1 Reply Last reply
        0
        • F
          F
          Filipp Sudanov
          wrote on last edited by
          #4

          You can create action that "executes command on the management server" and call curl in that action.

          1 Reply Last reply
          0
          • M
            M
            Millenium7
            wrote on last edited by
            #5

            I know nothing about curl or executing commands from NetXMS. So is this the correct syntax to put into the 'command' box?

            
            Was close. This is the correct syntax
            
            curl -d 'payload={"attachments": [{"color": "#36a64f","text": "Text example from node %n message is %m %M"}]}' -X PUT https://{SLACK WEBHOOK URL}
            1 Reply Last reply
            0
            • F
              F
              Filipp Sudanov
              wrote on last edited by
              #6

              Thanks for sharing

              1 Reply Last reply
              0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              Powered by NodeBB Contributors
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups