Create an email ticket with the api

Infos:

  • Used Zammad version: Latest
  • Used Zammad installation type: Docker
  • Browser + version: Chrome

Expected behavior:

  • Create a ticket with the api but of type “email” and not of type “note”.

Actual behavior:

  • In spite of my numerous tests, the ticket is created in note type

Steps to reproduce the behavior:

Here is the code we use

                    title: title.value,
                    group: 'Users',
                    customer: props.email,
                    priority_id: selectedPriority.value,
                    type: selectedType.value,
                    associated_server: associatedServer.value,
                    article: {
                        subject: title.value,
                        body: body.value,
                        type_id: 1,
                        type : "email",
                        from: "Users",
                        to : "Support <support@test.com>",
                        cc : "",
                        content_type: "text/html",
                        internal: false,
                        attachments: attachments.value,
                    }

Have you tried to only use either type or type_id?

Yes! I have tested a lot of things
I compared it with the request executed on the zammad interface and it is similar

If it may help here’s the working code we’re using.
A part from creating a ticket as “web” instead of “email” it works just fine.

1 Like

In PHP, i use this to post the JSON-Data to instance_url/ticket_articles:

                $postdata = array(
                    "ticket_id" => $tickeid,
                    "subject" => $articlesubject,
                    "body" => $body,
                    "content_type" => "text/html",
                    "type" => "email",
                    "internal" => false,
                    "sender" => "Agent",
                    "to" => $email,
                );

Maybe, you are missing the “sender” field?

2 Likes

@Filippoc @richie_77 Thank you both.
I changed the type to web and added a sender and it works as I wanted (I wanted the customers to receive an email when they answer which is the case even with a web type)

1 Like