Hi Zendesk Developer Community,
We're developing a Zendesk App Framework (ZAF) v2 application that allows agents to send an email-type side conversation from a ticket, including attachments that already exist on that ticket.
Our Workflow:
-
Fetch Ticket Attachments: Our ZAF app (running in the ticket sidebar) successfully fetches all comments for the current ticket using
client.request({ url: \/api/v2/tickets/${ticketId}/comments.json` })`. -
Extract Attachment Details: We parse the
attachmentsarray from each comment, collecting unique attachment objects (which includeid,file_name,content_url, etc.). - User Selection: The app UI displays these attachments (filename and size) with checkboxes, allowing the agent to select which ones to include in the side conversation.
-
Construct Payload: When the agent submits:
- We gather the numeric
idof each selected attachment. - We construct the payload for the
POST /api/v2/tickets/{ticket_id}/side_conversationsendpoint. - Based on API error feedback, we are formatting the
attachment_idsparameter as an array of strings (e.g.,["12345", "67890"]).
- We gather the numeric
The Issue:
When we make the client.request() call to create the side conversation, even with attachment IDs that we have verified exist on the target ticket's comments and are correctly formatted in the payload, we consistently receive a 422 Unprocessable Content error with the response body: {"error":"Attachment [ID] was not found"}
(Where [ID] is the specific attachment ID we provided).
Example Payload Sent:
JSON
{
"message": {
"type": "email",
"subject": "Fax Transmission (Ticket #1111111)",
"body": "This is the fax message body.",
"to": [
{
"email": "fax_recipient@example.com"
}
],
"attachment_ids": [
"22222222222222" // Example ID known to be on a comment in ticket #1111111
]
}
}
Our Questions:
- Under what specific conditions would the Side Conversation API return
{"error":"Attachment [ID] was not found"}for an attachment ID that is verifiably present on the target ticket's comments and correctly formatted in the API request? - Are there any known issues, undocumented requirements, or specific states/permissions an attachment needs to be in (e.g., regarding its original comment being public/private, age, malware scan status if "malware_not_found" isn't sufficient) to be successfully used with the
attachment_idsparameter when creating an email-type side conversation? - Is there a potential delay for newly added ticket attachments to become "available" or "findable" by the Side Conversation API, even if they are immediately visible via the Comments API?
We've exhausted client-side troubleshooting for fetching and formatting these IDs. The API acknowledges the request structure as valid (it's not a general 400 Bad Request for structure anymore) but specifically cannot find the referenced attachment for use in the side conversation.
Any insights or guidance would be greatly appreciated!
Thank you.
Just wanted to let you know that I'm looking into this for you. With recent updates made to ZAF, I've had a few similar inquiries with client.request come up so I'm doing some testing and research to see if this is related to that.
If you could share when this issue started for you that would be super helpful. 😊️