Create Email-Article via API

Infos:

  • Used Zammad version: 7.0.1.2
  • Used Zammad installation type: SaaS
  • Operating system: N/A
  • Browser + version: N/A

Expected behavior:

We’d like to:

  1. Create a Ticket via the ticket API with an article of type “email”
  2. Add an Article of type “email” to an existing ticket via the article API

both without this triggering an email to be send out.

We’d like to do this because:

  1. We plan on performing a number of classification- and enriching-steps on incoming emails before tickets are created and we can pass all of those to the ticket directly if we create it via API
  2. We still want the agent to be able to use the “reply to” feature of email-type articles

Actual behavior:

Whenever adding an article of type “email” an email is being send-out by the system. We found no way to suppress this

Steps to reproduce the behavior:

Use the Zammad-Ticket-API to create a new ticket with e.g. the following payload:

{
   "title": "Ticket with email",
   "group": "People working on emails",
   "customer": "test@test.com",
   "article": {
      "subject": "Email subject",
      "body": "Email body",
      "type": "email",
      "from": "John Sender <john.sender@test.com>",
      "to": "recipient@test.com",
      "content_type": "text/html",
      "internal": false
   }
}

What kind of email is send out? Are these notification emails? If so, you can edit your profile to get only notifications for specific groups or actions.

Hi, no it’s the article itself that is send-out.

So in in my example this would be an email with:

Subject: Email subject
Body: Email body

What is the sender of this email? I mean that notifications contain the email body and the subject.

This I think illustrates it well. Here we tested setting the “to” address to an address from which emails are imported to Zammad and this resulted in the email created via API being added to the ticket again

Here a view of the raw-data of the email that was received

It seems to be the original email while updates look like this for us

If you only need the from header and no CC, the phone note is a very well working workaround. It also has the reply button.

Worked like a charm - thank you :slight_smile:

We’ve set the email we want to reply-to as the “to” field and it got populated in the recipient when using “reply”

We’ll try! For our first use-case this will be fine but later we’ll need to handle cc. We could do this by just maintaining multiple addresses in the “to”. Can this be done?

Cheers
Lukas

You can add several toaddresses in the articles attribute or even use cc for that. cc is cleaner in my opinion.

Morning :sun:

I did a bit of testing:

CC works but does not populate the cc in the “reply”

TO works fine

I think this is fine :slight_smile:

I’ll request suppressing the automatic sending of emails when articles are created as a new feature.

Thank you very much for the help :heart:

Cheers
Lukas

Hi.

Your To/Cc fields in the UI look strange, like an array. Are you sure that this is correct?

Hi :slight_smile:

I’ve created it as:

    article_payload = {
        "ticket_id": ticket_id,
        "subject": article_subject,
        "body": article_body,
        "to": ["lukas.marsoner@unite.eu"],
        "cc": ["lukas.marsoner@mercateo.com"],
        "type": "phone",   # or 'email' depending on use
        "internal": False
    }

it looks a bit strange but works fine :slight_smile:

to and cc should be strings IMO. :slight_smile:

Works fine but other than visual-representation the result is the same :slight_smile:

1 Like

I actually got this to work setting the “sender” to “Customer”. Did not want to let that unmentioned :slight_smile:

1 Like

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