Ticket creation via n8n automation

Infos:

Disclaimer: If questions about n8n are not allowed here please let me know and I will close this post. Nevertheless I hope someone has an idea here.

  • Used Zammad version: 6.4.1-1741348581.b9a98307.jammy
  • Used Zammad installation type: package
  • Operating system: Ubuntu jammy
  • Browser + version: Brave / CLI

Expected behavior:

  • Creating a ticket via n8n triggers also a notification to the customer.

Actual behavior:

  • No notification to the customer is sent / error about missing recipient

Steps to reproduce the behavior:

  • use the n8n Zammad action to create a new ticket, select channel email, try to create ticket.
{ "error": "Sending an email without a valid recipient is not possible.", "error_human": "Sending an email without a valid recipient is not possible." }

Note

API permission for token: admin.group, ticket.agent

I just cant find where to enter the recipient. I thought this is the customer email name?

It is impossible to help you without knowing the exact API request that’s being sent. If I’d had to guess, I’d say it’s incomplete.

Fair enough! Cant really find it in n8n.

Using cURL gives me the same error:

curl -X POST \
  -H "Authorization: Token token=SECRET" \
  -H "Content-Type: application/json" \
  -d '{
        "title": "New Ticket Title",
        "group": "Users",
        "customer": "tom@domain.my",
        "article": {
          "subject": "Subject of the ticket",
          "body": "This is the body of the ticket.",
          "type": "email",
          "internal": false
        }
      }' \
  "http://helpdesk.domain.my/api/v1/tickets"

{"error":"Sending an email without a valid recipient is not possible.","error_human":"Sending an email without a valid recipient is not possible."}%

I tried it with the syntax documented here: Tickets — Zammad System Documentation documentation

{
   "title": "Help me!",
   "group": "2nd Level",
   "customer": "david@example.com",
   "article": {
      "subject": "My subject",
      "body": "I am a message!",
      "type": "note",
      "internal": false
   }
}

I adapted it to my use case and got the same result:

{"error":"Sending an email without a valid recipient is not possible.","error_human":"Sending an email without a valid recipient is not possible."}%

Creating the ticket for the user and group manually via UI (also in the mail channel) it works flawlessly. I even receive the mail.

EDIT:
I found the solution in create_spec.rb.

The to field has to be explicitly set.

curl -X POST \
  -H "Authorization: Token token=SECRET" \
  -H "Content-Type: application/json" \
  -d '{
        "title": "New Ticket Title",
        "group": "Users",
        "customer": "tom@domain.my",
        "article": {
          "subject": "Subject of the ticket",
          "body": "This is the body of the ticket.",
          "type": "email",
          "internal": false,
          "to": "tom@domain.my",
          "sender": "Customer"
        }
      }' \
  "http://helpdesk.wicked.design/api/v1/tickets"

For anyone interested, this is the rb file I was looking at:

1 Like