Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8836893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:35:43+00:00 2026-06-14T09:35:43+00:00

I am working on making my first Hubot script which would add a quick

  • 0

I am working on making my first Hubot script which would add a quick task to Asana.
I’m not looking at doing anything too crazy, or at least didn’t think I was.

Currently I have

url  = 'https://app.asana.com/api/1.0'

WORKSPACE = "1111111111111"
user = "xxxxxx.xxxxxxxxxxxxxxxx"
pass = ""

module.exports = (robot) ->
  robot.respond /task (.*)/i, (msg) ->
    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) ->
        console.log(err)
        console.log(res)
        console.log(body)
        msg.send body

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.

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.

Any direction would be great!

Thanks.

EDIT

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.

module.exports = (robot) ->
  robot.respond /task (.*)/i, (msg) ->
    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) ->
        console.log(err)
        console.log(res)
        console.log(body)
        msg.send body
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:35:45+00:00Added an answer on June 14, 2026 at 9:35 am

    Submitting an answer to the question so stackoverflow won’t show it as unanswered.

    Copying from EDIT in OP.

    dropping .query() and putting the string in .post() the output is finally correct.

    module.exports = (robot) ->
      robot.respond /task (.*)/i, (msg) ->
        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) ->
            console.log(err)
            console.log(res)
            console.log(body)
            msg.send body
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: addEventListener in content script not working I'm making first steps to write
I'm working on making my first Python C extension, which defines a few functions
I'm working on making a script with node.js for setting up my dzen2 in
I'm working on making my script mesh with OAuth instead of Basic Auth, and
Working on my first FB app and making good progress. I know that non-testers
I am working on my first iPhone app and making good progress. But there
I'm working for the first time on Android. I'm making an app where, at
I'm working on my first Android project, and I'm starting off by making a
So I'm making my first Android app, using ADT in Eclipse and working with
I'm making my first Android game which is going to be a 3D arcade-ish

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.