title: Send message to slack HTML/JavaScript
body: <p>I am trying to create a small webpage that has a field for text to be entered and a button to send. When the user hits the send button a script will run that sends the text to a slack channel. I have a API token but I am unsure on how to implement this using JS. I so far have the below, I know im close so if anyone can help be much appreciated. </p>
  
  <p><strong>HTML Button to send message</strong> </p>
  
  <pre><code>&lt;button name="submit" type="submit" id="contact-submit" data-submit="...Sending"&gt;Send slack Message&lt;/button&gt;
  </code></pre>
  
  <p><strong>Script to send message</strong></p>
  
  <pre><code>var path_to_call = 'http://slack.com/api/chat.postMessage?token=my+token+xxxxxxxxx&amp;channel=#testchannel&amp;text=Thisisatest';
  
  request(path_to_call, function(error, response, body) {
       if (!error &amp;&amp; response.statusCode == 200) { 
           console.log('Success');
       } else { 
           console.log(error);
       }
  });
  </code></pre>