Skip to content
This repository was archived by the owner on May 14, 2020. It is now read-only.
This repository was archived by the owner on May 14, 2020. It is now read-only.

Attachments do not returned after create/update of Thread in Conversation #21

@sphinks

Description

@sphinks

There is a problem on backend side that it does not return attachments as part of conversation entity. Typical flow:

  1. Create attachment
Attachment attachment = new Attachment();
attachment.setData("Test data");
attachment.setFileName("http://developer.helpscout.net/img/logo.png");  
attachment.setMimeType("image/jpeg");  
client.createAttachment(attachment);

Raw json for this:

{
"mimeType":"image/jpeg",
"fileName":"http://developer.helpscout.net/img/logo.png",
"size":0,
"width":0,
"height":0,
"data":"Test data"
}

Response: Code 201 + HashCode = 7dd595c509909af1d2bf1f308dc628b7ba91e366
2. Add new attachment to conversation:

List<Attachment> attachments = new ArrayList<Attachment>();
attachments.add(attachment);
thread.setAttachments(attachments);

List<LineItem> threads = new ArrayList<LineItem>();
threads.add((LineItem)thread);
readConversation.setThreads(threads);
client.updateConversation(readConversation);

Raw Json:

{"id":185888453,"type":"Email","folderId":806466,"isDraft":false,"number":43,
"source":{"type":"api","via":"user"},
"owner":{"id":110114,"firstName":"Ivan","lastName":"Z","email":"sphinks@newmail.ru","type":"User"},
"mailbox":{"id":67978,"name":"Sphinks"},
"customer":{"id":74921843,"firstName":"Help","lastName":"Scout","email":"customer@example.com","phone":"855-435-7726","type":"Customer"},
"threadCount":2,"status":"active","subject":"It is updated!","preview":"New Text",
"createdAt":"2016-03-28T03:12:13Z",
"modifiedAt":"2016-03-28T03:12:14Z",
"createdBy":{"id":110114,"firstName":"Ivan","lastName":"Z","email":"sphinks@newmail.ru","type":"User"},
"threads":[
{"id":484195988,"type":"Customer","state":"published","body":"New Text","toList":[],"ccList":[],"bccList":[],
"attachments":[
{"mimeType":"image/jpeg",
"fileName":"http://developer.helpscout.net/img/logo.png",
"size":0,
"width":0,
"height":0,
"hash":"7dd595c509909af1d2bf1f308dc628b7ba91e366",
"data":"Test data"}
],
"status":"active",
"createdBy":   {"id":74921843,"firstName":"Help","lastName":"Scout","email":"customer@example.com","phone":"855-435-7726","type":"Customer"},
"createdAt":"2016-03-28T03:12:14Z"}
]
}

Response: 200.

  1. Read conversation entity from server:

    readConversation = client.getConversation(testConversation.getId());

Raw Json:

{"item":
{"id":185888453,"type":"email","folderId":806466,"isDraft":false,"number":43,
"owner":{"id":110114,"firstName":"Ivan","lastName":"Z","email":"sphinks@newmail.ru","phone":null,"type":"user"},
"mailbox":{"id":67978,"name":"Sphinks"},
"customer":{"id":74921843,"firstName":"Help","lastName":"Scout","email":"customer@example.com","phone":"855-435-7726","type":"customer","emails":["help@helpscout.net","customer@example.com"]},
"threadCount":2,"status":"active",
"subject":"It is updated!",
"preview":"New Text",
"createdBy":{"id":110114,"firstName":"Ivan","lastName":"Z","email":"sphinks@newmail.ru","phone":null,"type":"user"},
"createdAt":"2016-03-28T00:12:13Z",
"modifiedAt":"2016-03-28T00:12:14Z",
"closedAt":null,
"closedBy":null,
"source":{"type":"api","via":"user"},
"cc":[],"bcc":[],
"tags":null,
"threads":[
{"id":484195988,"type":"customer","assignedTo":null,"status":"active","createdAt":"2016-03-28T00:12:14Z","openedAt":null,
"createdBy":{"id":74921843,"firstName":"Help","lastName":"Scout","email":"customer@example.com","phone":"855-435-7726","type":"customer","emails":["help@helpscout.net","customer@example.com"]},
"source":{"type":"api","via":"customer"},
"actionType":null,"actionSourceId":null,"fromMailbox":null,"state":"published",
"customer":{"id":74921843,"firstName":"Help","lastName":"Scout","email":"customer@example.com","phone":"855-435-7726","type":"customer","emails":["help@helpscout.net","customer@example.com"]},
"body":"New Text","to":null,"cc":[],"bcc":[],
"attachments":null,
"savedReplyId":null,
"createdByCustomer":true},
{"id":484195986,"type":"customer",
"assignedTo":{"id":110114,"firstName":"Ivan","lastName":"Z","email":"sphinks@newmail.ru","phone":null,"type":"user"},
"status":"active","createdAt":"2016-03-28T00:12:13Z","openedAt":null,
"createdBy":{"id":74921843,"firstName":"Help","lastName":"Scout","email":"customer@example.com","phone":"855-435-7726","type":"customer","emails":["help@helpscout.net","customer@example.com"]},
"source":{"type":"api","via":"customer"},"actionType":null,"actionSourceId":null,"fromMailbox":null,"state":"published",
"customer":{"id":74921843,"firstName":"Help","lastName":"Scout","email":"customer@example.com","phone":"855-435-7726","type":"customer","emails":["help@helpscout.net","customer@example.com"]},
"body":"Hello. I need some help.","to":null,"cc":[],"bcc":[],
"attachments":null,
"savedReplyId":null,
"createdByCustomer":true}]}}

As result there is no attachments. Possible two variants:

  1. Attachment were created in wrong way (missed some field) - then server should not return code 201 and this should be fixed.
  2. Attachment were created, but not returned as part of conversation entity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions