Hi @Kariah_Petrille,
Unfortunately our API requires that you send an attachment response when we make a call to your app server’s On submit callback endpoint. Hence why we marked it as required in our docs:
The reason for this is because the modal form and widget are tied to the attachment.
That being said, when we make an API call to your app server’s On submit callback endpoint we send an attachment ID in the POST request body that you can use to look up the story on the task (Get stories from a task) that has the attachment on it and delete that story (Delete a story).
NOTE: this is a documentation bug we should have attachment
shown under the “Body Params” section of our On submit callback endpoint
EX: req.body
of Asana’s API call to your app server’s On submit callback endpoint:
{
data: '{"attachment":123,"user":456,"workspace":789,"expires_at":"2024-08-06T00:58:54.770Z","values":{"single_line_text_full_width":"","single_line_text_half_width":"","single_line_text_full_width_is_watched":"","multi_line_text":"","rich_text":"<BODY></BODY>","dropdown_half_width":"","dropdown_full_width":"","radio_button":"1"},"task":91011}'
}
You can take the "attachment":123
→ 123
response and make a call to Get stories from a task endpoint to get the stories on the task. Then filter for the story that has the attachment on it and call Delete a story endpoint.
NOTE: for your Get stories from a task you’ll probably want to specify html_text
for opt_fields
since the content from the html_text
will contain the attachment_gid
Example response from request to Get stories from a task with html_text
in opt_fields
{
"data": [{
"gid": "789",
"html_text": "<b><a href=\"https://app.asana.com/0/profile/456\">Demo</a></b> attached <a href=\"https://app.asana.com/app/asana/-/get_asset?asset_id=123\">I'm an Attachment</a>"
}]
}