Facility Control

 View Only
  • 1.  Sending message to Slack

    Posted 08-22-2022 15:56
    I'm trying to build out a button that (among other things) will send a message to a Slack channel. Slack says they use an HTTP POST request so I built out the following but I can't seem to get it to talk to Slack. Can someone double check me and see if I missed something?

    <abs contexttype="opengear" id="_top" keepalive="false">
       <button buttontype="push" height="115" id="btn-help3" left="67" name="Request Help 3" top="55" width="227">
          <task tasktype="ogscript">/*! block id=1002 !*/
    ogscript.asyncHTTP("https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX", "POST", "application/json", "Translator is requesting help", null);
    /*!!
     &lt;block id="1002" type="ogscript_async" x="1249" y="202" w="318" URL="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX" METHOD="POST" TYPE="application/json" DATA="Translator is requesting help" CALLBACK="null" /&gt;
    !!*/
    /*!!&lt;checksum&gt;392260399d9cc37673c3d4dbd5a12204&lt;/checksum&gt;!!*/</task>
       </button>
    </abs>
    ​


    ------------------------------
    John Folsom
    Director of Integration
    ------------------------------


  • 2.  RE: Sending message to Slack

    Posted 08-23-2022 09:19
    Hi John
    The basics of the call look good. Have you tried sending that exact payload over something like Postman? The only obvious issue I see is that you've sent your content-type to application/json but your data payload is a simple non-JSON string.

    James

    ------------------------------
    James Peltzer
    Ross Video
    ------------------------------



  • 3.  RE: Sending message to Slack

    Posted 08-23-2022 13:03
    Hey James! First, thank you so much for the Postman recommendation, that was a big help. Your point about JSON vs simple string was right on, I guess I assumed that the Dashboard block would take care of the JSON formatting once I picked that as the content-type but I needed to put {"text"; "my text here""} into the data field. Once I got that right it all started working. Thank you!!

    ------------------------------
    John Folsom
    Director of Integration
    ------------------------------