title: Hubot Scripts integrating with Asana
body: <p>I am working on making my first Hubot script which would add a quick task to Asana.<br>
  I'm not looking at doing anything too crazy, or at least didn't think I was.</p>
  
  <p>Currently I have</p>
  
  <pre><code>url  = 'https://app.asana.com/api/1.0'
  
  WORKSPACE = "1111111111111"
  user = "xxxxxx.xxxxxxxxxxxxxxxx"
  pass = ""
  
  module.exports = (robot) -&gt;
    robot.respond /task (.*)/i, (msg) -&gt;
      params = {name: "#{msg.match[1]}", workspace: "#{WORKSPACE}"}
      stringParams = JSON.stringify params
      auth = 'Basic ' + new Buffer("#{user}:#{pass}").toString('base64')
      msg.http("#{url}/tasks")
        .headers("Authorization": auth, "Content-Length": stringParams.length, "Accept": "application/json")
        .query(params)
        .post() (err, res, body) -&gt;
          console.log(err)
          console.log(res)
          console.log(body)
          msg.send body
  </code></pre>
  
  <p>All I really want it to do is output that it's posting to the workspace. I know there is more to the Asana API to make it all work properly, but watching my log's tail, nothing is outputting, nothing is logging to console, nothing is happening.</p>
  
  <p>If I do a console.log under the params, it will output the JSON and it's correct, but it seems like the post is never happening.</p>
  
  <p>Any direction would be great!</p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>After some more tweaking, following Dan was a step in the right direction, dropping .query() and putting the string in .post() the output is finally correct.</p>
  
  <pre><code>module.exports = (robot) -&gt;
    robot.respond /task (.*)/i, (msg) -&gt;
      params = {data:{name: "#{msg.match[1]}", workspace: "#{WORKSPACE}"}}
      stringParams = JSON.stringify params
      auth = 'Basic ' + new Buffer("#{user}:#{pass}").toString('base64')
      msg.http("#{url}/tasks")
        .headers("Authorization": auth, "Content-Length": stringParams.length, "Accept": "application/json")
        .post(stringParams) (err, res, body) -&gt;
          console.log(err)
          console.log(res)
          console.log(body)
          msg.send body
  </code></pre>