Wrong Reply Address When Creating Ticket Using API

In version 3.6 I used the code below to create a ticket via API. After migrating to version 5, the tickets are created, but when pressing the ‘Reply’ on the ticket, the reply address is wrong. I checked the documentation and I could not find the reason. Could you please help?

Map<String,Object> doc = new HashMap<>();
        doc.put( "title", StringUtil.isFilledTrim( title ) ? title : "DbSchema Report Bug");
        doc.put( "group_id", 1);
        doc.put( "customer_id", "guess:support@dbschema.com" );
        doc.put( "state_id", 2 );
        final Map<String,Object> article = new HashMap<>();
        article.put( "subject", StringUtil.isFilledTrim( title ) ? title : "DbSchema Report Bug");
        article.put( "body", message );
        article.put( "internal", "false" );
        article.put( "to", email );
        article.put( "cc", email );
        article.put( "content_type", "text/html" );
        article.put( "type", "web" );
        doc.put( "article", article );
        if ( !attachments.isEmpty() ) {
            final List<Map> attachmentList = new ArrayList<>();
            article.put( "attachments", attachmentList );
            for (File file : attachments) {
                try {
                    final Map<String, Object> attachmentMap = new HashMap<>();
                    attachmentList.add(attachmentMap);
                    attachmentMap.put("filename", file.getName());
                    final RandomAccessFile f = new RandomAccessFile(file, "r");
                    final byte[] bytes = new byte[(int)f.length()];
                    f.readFully(bytes);
                    attachmentMap.put("data", new String(java.util.Base64.getEncoder().encode( bytes ), StandardCharsets.UTF_8));
                    attachmentMap.put("mime-type", getContentType(file));
                } catch ( IOException ex ){
                    Log.error( ex );
                }
            }
        }

        return new GsonBuilder().setPrettyPrinting().create().toJson(doc);

Please go through the release notes. There were changes on the API which may affect you.

customer_id looks odd if you provide a guess:<email> after that.
The reason why your reply is not working as expected is because you’re not providing a from value in your article. How should Zammad know who to write?

Our documentation even has a payload example that might help you:
https://docs.zammad.org/en/latest/api/ticket/articles.html#list-articles-by-ticket

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.