Zammad Paramotor through n8n is not happy

Describe the problem/error/question

I am sending from TacticalRMM (Alert) through a webhook to n8n then Zammad.

Here is the Request Body From TacticalRMM
{
“title”: “{{ $json[“severity”] }} on {{ $json[“hostname”] }}”,
“group”: “Users”,
“customer”: “{{ $json[“client.zammad_email”] }}”,
“article”: {
“subject”: “{{ $json[“severity”] }} on {{ $json[“hostname”] }}”,
“body”: “Client: {{ $json[“client.name”] }}, Site: {{ $json[“site.name”] }}: {{ $json[“message”] }} at {{ $json[“alert_time”] }}”,
“type”: “note”,
“internal”: false
}
}

In the Zammad Ticket Creation Node

Everything seems to be happy except “Customer Email Name or ID”

I have tried several iterations of this

{{ ($json[“client_email”] || ‘[email protected]’).trim() }}

I am getting the

-The Value “” is not supported. I tried to hard code the email, still not happy.

What is the error message (if any)?

{
“errorMessage”: “Your request is invalid or could not be processed by the service”,
“errorDescription”: “No lookup value found for ‘customer’: "null"”,
“errorDetails”: {
“rawErrorMessage”: [
“422 - {"error":"No lookup value found for ‘customer’: \"null\"","error_human":"No lookup value found for ‘customer’: \"null\""}”
],
“httpCode”: “422”
},
“n8nDetails”: {
“nodeName”: “Zammad”,
“nodeType”: “n8n-nodes-base.zammad”,
“nodeVersion”: 1,
“resource”: “ticket”,
“operation”: “create”,
“time”: “10/8/2024, 1:19:04 PM”,
“n8nVersion”: “1.60.1 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“NodeApiError: Your request is invalid or could not be processed by the service”,
" at Object.zammadApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Zammad/GenericFunctions.js:58:15)“,
" at processTicksAndRejections (node:internal/process/task_queues:95:5)”,
" at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Zammad/Zammad.node.js:374:40)“,
" at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:722:19)”,
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:670:51",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1100:20"
]
}
}

Please share your workflow

I have Webhook > Zammad (ticket creation)

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.60.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):**Docker
  • Operating system: Ubuntu 22.04 - Self Hosting

Welcome to the community @rzrsolutions !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.


The error seems to suggest that you are referring to a non-existing property in the output of the Webhook node. Hence the value is null. As a result the ticket cannot be created.

Could you check the actual input data for Zammad node? You might have misspelt the name or the property is nested and you need to pick the correct reference to the customer email or the customer Zammad user ID. Perhaps those values do not even exist in Zammad if they come from some other source (TacticalRMM ?).

Thank you for the response, really appreciate it. I am very new to n8n so please know I may be a little green on some concepts.

I think this is what you are asking

Is this what is needed

[
{
“headers”:
{
“host”:
n8n.rzrsolutions.com”,
“user-agent”:
“python-requests/2.32.3”,
“content-length”:
“463”,
“accept”:
/”,
“accept-encoding”:
“gzip, deflate, br”,
“authorization”:
“9kzjDhhg1ZAdqMknUb9wstzttlRxFjUBek1FNiv1p5YBU053VyGssXkoKCC0jKuG”,
“content-type”:
“application/json”,
“x-forwarded-for”:
“172.18.0.1”,
“x-forwarded-host”:
n8n.rzrsolutions.com”,
“x-forwarded-proto”:
“https”
},
“params”:
{
},
“query”:
{
},
“body”:
“{\n “title”: “{{ $json[“severity”] }} on {{ $json[“hostname”] }}”,\n “group”: “Users”,\n “customer”: “{{ $json[“client.zammad_email”] }}”,\n “article”: {\n “subject”: “{{ $json[“severity”] }} on {{ $json[“hostname”] }}”,\n “body”: “Client: {{ $json[“client.name”] }}, Site: {{ $json[“site.name”] }}: {{ $json[“message”] }} at {{ $json[“alert_time”] }}”,\n “type”: “note”,\n “internal”: false\n }\n}”,
“webhookUrl”:
https://n8n.rzrsolutions.com/webhook/trmm-alert”,
“executionMode”:
“production”
}
]

Hey @rzrsolutions , yes, that is what I was asking of. Please, next time paste the JSON (as well as n8n workflow) as per my initial tip (it follows again). Without doing so, make our job to help you much harder.

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.


There are a few points to make about that data:

  1. The property you are after is nested in the value of body
  2. This value is actually a stringified object. To use the properties in there you need to convert the string to object first.
  3. Some values have not be evaluated and are present as expressions, ei. {{ $json["severity"] }}

In other words, the error makes perfect sense now as you do not have client_email available and “[email protected]” is probably does not exist in Zammad.

For a start, you need to fix the data that is sent to the webhook. Find out why the expressions have not been substituted for the actual values. Once that is fixed, you can come back to check Zammad node.

{
  "meta": {
    "instanceId": "9d28fa4f88ae0747e3d147ad0cbea0a748963b2c8a514456fd09701f565244df"
  },
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "/trmm-alert",
        "options": {}
      },
      "id": "2d82b688-9d67-44a7-a035-b588fbb978bf",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        940,
        420
      ],
      "webhookId": "29b3896f-07a3-47b2-9eea-bb70c4f22dd2"
    }
  ],
  "connections": {},
  "pinData": {}
}

{
  "meta": {
    "instanceId": "9d28fa4f88ae0747e3d147ad0cbea0a748963b2c8a514456fd09701f565244df"
  },
  "nodes": [
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Parse the incoming data from the Webhook (evaluating the expressions)\nlet title = `${$json[\"severity\"]} on ${$json[\"hostname\"]}`;\nlet customer = $json[\"client.zammad_email\"];\nlet subject = `${$json[\"severity\"]} on ${$json[\"hostname\"]}`;\nlet body = `Client: ${$json[\"client.name\"]}, Site: ${$json[\"site.name\"]}: ${$json[\"message\"]} at ${$json[\"alert_time\"]}`;\n\n// Create the article structure\nlet article = {\n  \"subject\": subject,\n  \"body\": body,\n  \"type\": \"note\",\n  \"internal\": false\n};\n\n// Return the properly structured and evaluated data to the next node\nreturn {\n  json: {\n    title: title,\n    group: \"Users\",  // Static value for the group\n    customer: customer,\n    article: article\n  }\n};\n"
      },
      "id": "00ebd49d-0551-43fb-97a7-ce6706e32943",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1140,
        420
      ]
    }
  ],
  "connections": {},
  "pinData": {}
}

{
  "meta": {
    "instanceId": "9d28fa4f88ae0747e3d147ad0cbea0a748963b2c8a514456fd09701f565244df"
  },
  "nodes": [
    {
      "parameters": {
        "resource": "ticket",
        "title": "={{ $json[\"title\"] }}\n\n",
        "group": "Users",
        "customer": "={{ $json[\"customer\"] }}\n\n",
        "article": {
          "articleDetails": {
            "subject": "{{ $json[\"article\"][\"subject\"] }}",
            "body": "={{ $json[\"article\"][\"body\"] }}\n",
            "reply_to": "[email protected]"
          }
        },
        "additionalFields": {}
      },
      "id": "4429dae9-e5a7-4eba-84f9-6f63913d2655",
      "name": "Zammad",
      "type": "n8n-nodes-base.zammad",
      "typeVersion": 1,
      "position": [
        1320,
        420
      ],
      "credentials": {
        "zammadTokenAuthApi": {
          "id": "zfZP1w1JuIj3BJH2",
          "name": "Zammad Token Auth account"
        }
      }
    }
  ],
  "connections": {},
  "pinData": {}
}

[/quote]
(I hope I pasted workflow correctly)
Ok I have been using ChatGPT to work through this, but the bot gets stuck, so know I am working at this trying to find a solution.

I am going to paste in our conversation so know that it is back and forth (I may have cursed a little at the bot) hopefully this will help.

Here is the TacticalRMM webhook

Request Headers
{
“Content-Type”: “application/json”,
“Authorization”: “9kzjDhhg1ZAdqMknUb9wstzttlRxFjUBek1FNiv1p5YBU053VyGssXkoKCC0jKuG”
}

Request Body
{
“title”: “High on server1”,
“group”: “Users”,
“customer”: “[email protected]”,
“article”: {
“subject”: “High on server1”,
“body”: “Client: RZR Solutions, Site: Main Office: CPU Usage is high at 2024-10-08T12:45:00Z”,
“type”: “note”,
“internal”: false
}
}

ChatGPT had me add a function node in between, as you can see it still is having the same issue with the empty email.

This is what I changed in zammad node

{{ $json[“title”] }}
{{ $json[“customer”] }}
{{ $json[“article”][“subject”] }}
{{ $json[“article”][“body”] }}

I made a few changes it suggested but nothing really changed, same error regardless. I know it is because it isn’t accepting “” blank but I am at a loss and not sure what I am missing.

Hey @rzrsolutions , it is hard to follow the information you provide. You pasted individual nodes instead of the whole worfkflow. However, the most important piece is the actual data that is the output of the Webhook.

Again, I can only guess what your workflow looks like. Did you mean to give me something like below (trying to assemble the nodes together myself).

If that is your workflow then it makes sense that it is not working.

Your code in the Code node has to be composed based on the data that comes from the Webhook. If you show what that data is, we can help you with the actual code and configuration of the rest of the nodes.

I believe you provided the output of the Webhook. In particular, you showed this bit

{
  "body": "{\n \"title\": \"{{ $json[\"severity\"] }} on {{ $json[\"hostname\"] }}\",\n \"group\": \"Users\",\n \"customer\": \"{{ $json[\"client.zammad_email\"] }}\",\n \"article\": {\n \"subject\": \"{{ $json[\"severity\"] }} on {{ $json[\"hostname\"] }}\",\n \"body\": \"Client: {{ $json[\"client.name\"] }}, Site: {{ $json[\"site.name\"] }}: {{ $json[\"message\"] }} at {{ $json[\"alert_time\"] }}\",\n \"type\": \"note\",\n \"internal\": false\n }\n}",
  "webhookUrl": "https://n8n.rzrsolutions.com/webhook/trmm-alert",
  "executionMode": "production"
}

As I mentioned, it is a stringified representation of an object. Thus could have been converted to JSON with the help of JSON.parse() method but there has to be real values in place of expressions like {{ $json["severity"] }}. Is it actual data that comes out of the webhook? If so, you need to fix it on the side that sends this data to this webhook.

If you do have proper values, then please show what that looks like.

For example, for clarity, if the output data that comes out of Webhook is like below

[
  {
    "headers": {
      "host": "n8n.rzrsolutions.com",
      "user-agent": "python-requests/2.32.3",
      "content-length": "463",
      "accept": "/",
      "accept-encoding": "gzip, deflate, br",
      "authorization": "9kzjDhhg1ZAdqMknUb9wstzttlRxFjUBek1FNiv1p5YBU053VyGssXkoKCC0jKuG",
      "content-type": "application/json",
      "x-forwarded-for": "172.18.0.1",
      "x-forwarded-host": "n8n.rzrsolutions.com",
      "x-forwarded-proto": "https"
    },
    "params": {},
    "query": {},
    "body": "{\"title\":\"Highonserver1\",\"group\":\"Users\",\"customer\":\"[email protected]\",\"article\":{\"subject\":\"Highonserver1\",\"body\":\"Client:RZRSolutions,Site:MainOffice:CPUUsageishighat2024-10-08T12:45:00Z\",\"type\":\"note\",\"internal\":false}}",
    "webhookUrl": "https://n8n.rzrsolutions.com/webhook/trmm-alert",
    "executionMode": "production"
  }
]

Then the solution could be as the following

Again, it is all tide up to the actual data format that comes out of the Webhook.

Ok I figured out how to paste workflow, really apologize for making more work than intended.

I saw youir reply to add a fixed body, but when I search in nodes for fix body, fix, or body nothing comes up. What is the name of the node?

{
“errorMessage”: “Unexpected token ‘}’ [line 21]”,
“errorDescription”: “SyntaxError”,
“errorDetails”: {},
“n8nDetails”: {
“nodeName”: “Webhook Output”,
“nodeType”: “n8n-nodes-base.code”,
“nodeVersion”: 2,
“n8nVersion”: “1.60.1 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code:21”,
“}()”,
“^”,
“”,
“SyntaxError: Unexpected token ‘}’”,
" at makeNiceSyntaxError (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/transformer.js:41:16)“,
" at transformer (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/transformer.js:84:8)”,
" at NodeVM.run (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/nodevm.js:485:17)“,
" at JavaScriptSandbox.runCodeAllItems (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/JavaScriptSandbox.js:49:45)”,
" at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/Code.node.js:119:40)“,
" at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:722:42)”,
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:670:66",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1100:20"
]
}
}

This is the latest workflow below.

Here is the error

{
“errorMessage”: “Your request is invalid or could not be processed by the service”,
“errorDescription”: “Missing required value for field ‘title’!”,
“errorDetails”: {
“rawErrorMessage”: [
“422 - {"error":"Missing required value for field ‘title’!"}”
],
“httpCode”: “422”
},
“n8nDetails”: {
“nodeName”: “Zammad”,
“nodeType”: “n8n-nodes-base.zammad”,
“nodeVersion”: 1,
“resource”: “ticket”,
“operation”: “create”,
“time”: “10/9/2024, 5:30:27 AM”,
“n8nVersion”: “1.60.1 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“NodeApiError: Your request is invalid or could not be processed by the service”,
" at Object.zammadApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Zammad/GenericFunctions.js:58:15)“,
" at processTicksAndRejections (node:internal/process/task_queues:95:5)”,
" at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Zammad/Zammad.node.js:374:40)“,
" at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:722:19)”,
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:670:51",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1100:20"
]
}
}

Hey @rzrsolutions , the node I called “Webhook Output” is just to emulate the data that comes out of Webhook. You need to remove it in your workflow and work with the actual data (not the one I am guessing how it looks like).

The whole solution might need to be changed depending on the actual data structure you do get via Webhook. Please, copy the data from one of your successful Webhook run (or pin it) and paste it here to help you further. I am still guessing here rather than working with the actual data.

Do also note that you Zammad node uses expressions for many fields but not all of them are configured for expression mode. That will certainly cause errors as the expression will not be substituted for the actual values.

I am 100% open to starting over and trying another way, I do not really know the direction to take.

I can share what the goal is and hopefully get direction from there.

I am using TacticalRMM (it is a remote management tool to access, PC, Mac, and Linux) it monitors and provides alerts.

The goal was to have tickets auto generated based on the alarm severtity.

I have several Open Source Tools I plan on using for this process.

TacticalRMM
Zammad
Snipe-It
Wazuh
I was trying to use n9n to get them all talking to each other. I am not a developer know enough to be dangerous, but mostly I just hack around.

I own and run an MSP.

I am completely open to suggestions.

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