title: How to do a POST request from within Hubot?
body: <p>I'm trying to code a Hubot listener that would automatically create a JIRA issue from a specific chat dialogue. Here's the example (I used Hubot-Rocketchat boilerplate code from here: <a href="https://github.com/RocketChat/hubot-rocketchat-boilerplate" rel="nofollow noreferrer">https://github.com/RocketChat/hubot-rocketchat-boilerplate</a>)</p>
  
  <pre><code>module.exports = (robot) =&gt; {
      robot.hear(/^#alerts (.*)/i, (res) =&gt; {
          const jiraurl="https://jira.example.com/rest/api/2/issue/"
          const jiraproject="ALERTS"
  
          text = res.match[1]
  
          data = JSON.stringify({
              "fields": {
                  "project":
                  {
                      "key": `#{jiraproject}`
                  },
                  "summary": `#{text}`,
                  "description": "Задача создана автоматически из RocketChat",
                  "issuetype": {
                  "name": "Инцидент"
                  }
              }
          })
  
          /* res.reply(data) */
          res.reply(`Создаю задачу в JIRA: ${text}`)
          robot.http(jiraurl)
              .header('Content-Type', 'application/json')
              .post(data) (err, response, body) =&gt;
  
                  if err
                      res.send `Ошибка: #{err}`
                      return
      })
  }
  </code></pre>
  
  <p>What would be the proper way to do this?</p>