Created
March 3, 2023 22:20
-
-
Save Garconis/f7b23ef3d7f1eef3c6adbba588a54d7e to your computer and use it in GitHub Desktop.
Asana | Create a Status Update to the Project/Portfolio item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is wrapped in an `async` function | |
// you can use await throughout the function | |
// https://developers.asana.com/reference/createstatusforobject | |
// get parentID (the ID of the unique project) | |
var parentID = inputData.parentID; | |
let body = { | |
"data": { | |
// "title": "test", // if no custom title is supplied, we can omit this and it uses default of "Status Update - Month Day" | |
"text": "This site is live and the project is considered complete", | |
"status_type": "complete", | |
"parent": parentID | |
} | |
}; | |
// create the task based on the body and data | |
const res = await fetch('https://app.asana.com/api/1.0/status_updates', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
'Accept': 'application/json', | |
'Authorization': 'Bearer 0/XXXXXX' | |
}, | |
body: JSON.stringify(body) | |
}); | |
const data = await res.json(); | |
output = { data: data } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment