I am quite sure this is an FAQ, but a bit hard for me to search (which search terms?):
in my project with Zammad I get one array “Ticket” describing the ticket, and another one “articles” containing the individual articles the ticket contains of.
Ticket:
[
{
"id": 53,
"group_id": 2,
"priority_id": 2,
"state_id": 2,
"organization_id": null,
"number": "740534",
"title": "Testanfrage Weichinger",
"owner_id": 3,
"customer_id": 3,
"note": null,
"first_response_at": "2022-11-15T07:19:04.078Z",
"first_response_escalation_at": null,
"first_response_in_min": 0,
"first_response_diff_in_min": 4320,
"close_at": null,
"close_escalation_at": null,
"close_in_min": null,
"close_diff_in_min": null,
"update_escalation_at": null,
"update_in_min": null,
"update_diff_in_min": null,
"last_contact_at": "2022-11-15T07:20:05.013Z",
"last_contact_agent_at": "2022-11-15T07:19:41.008Z",
"last_contact_customer_at": "2022-11-15T07:20:05.013Z",
"last_owner_update_at": "2022-11-15T12:08:48.875Z",
"create_article_type_id": 1,
"create_article_sender_id": 1,
"article_count": 33,
"escalation_at": null,
"pending_time": null,
"type": null,
"time_unit": null,
"preferences": {
"channel_id": 3,
"escalation_calculation": {
"first_response_at": "2022-11-15T07:19:04.078Z",
"last_update_at": "2022-11-15T07:20:05.013Z",
"last_contact_at": "2022-11-15T07:20:05.013Z",
"sla_id": 2,
"sla_updated_at": "2023-01-11T16:02:47.791Z",
"calendar_id": 2,
"calendar_updated_at": "2023-01-15T13:20:30.043Z",
"escalation_disabled": false
}
},
"updated_by_id": 3,
"created_by_id": 3,
"created_at": "2022-11-15T07:19:04.022Z",
"updated_at": "2023-01-16T07:40:29.206Z",
"last_close_at": null
}
]
articles:
[
{
"id": 130,
"ticket_id": 53,
"type_id": 1,
"sender_id": 1,
"from": "Stefan Weichinger <[email protected]>",
"to": "[email protected]",
"cc": null,
"subject": "Testanfrage Weichinger",
"reply_to": null,
"message_id": "<[email protected]>",
"message_id_md5": "2bf547f5f570f6a8143ca8084110aee2",
"in_reply_to": null,
"content_type": "text/plain",
"references": null,
"body": "\nZum Test von Zammad-Emailing.\n\n-- \nViele Grüße | Stefan Weichinger | DW: | Mobil: \n",
"internal": false,
"preferences": {
"send-auto-response": true,
"is-auto-response": false
},
"updated_by_id": 3,
"created_by_id": 3,
"origin_by_id": null,
"created_at": "2022-11-15T07:19:04.078Z",
"updated_at": "2022-11-15T07:19:04.078Z",
"attachments": [],
"type": "email",
"sender": "Agent",
"created_by": "[email protected]",
"updated_by": "[email protected]"
},
{
"id": 131,
"ticket_id": 53,
"type_id": 1,
"sender_id": 1,
[..]
To pipe it into another API I need it in one json-file, like in:
{
"Ticket": {
"id": 53,
"group_id": 2,
"priority_id": 2,
"state_id": 2,
"organization_id": null,
"number": "740534",
"title": "Testanfrage Weichinger",
"owner_id": 3,
"customer_id": 3,
"note": null,
"first_response_at": "2022-11-15T07:19:04.078Z",
"first_response_escalation_at": null,
"first_response_in_min": 0,
"first_response_diff_in_min": 4320,
"close_at": null,
"close_escalation_at": null,
"close_in_min": null,
"close_diff_in_min": null,
"update_escalation_at": null,
"update_in_min": null,
"update_diff_in_min": null,
"last_contact_at": "2022-11-15T07:20:05.013Z",
"last_contact_agent_at": "2022-11-15T07:19:41.008Z",
"last_contact_customer_at": "2022-11-15T07:20:05.013Z",
"last_owner_update_at": "2022-11-15T12:08:48.875Z",
"create_article_type_id": 1,
"create_article_sender_id": 1,
"article_count": 33,
"escalation_at": null,
"pending_time": null,
"type": null,
"time_unit": null,
"preferences": {
"channel_id": 3,
"escalation_calculation": {
"first_response_at": "2022-11-15T07:19:04.078Z",
"last_update_at": "2022-11-15T07:20:05.013Z",
"last_contact_at": "2022-11-15T07:20:05.013Z",
"sla_id": 2,
"sla_updated_at": "2023-01-11T16:02:47.791Z",
"calendar_id": 2,
"calendar_updated_at": "2023-01-15T13:20:30.043Z",
"escalation_disabled": false
}
},
"updated_by_id": 3,
"created_by_id": 3,
"created_at": "2022-11-15T07:19:04.022Z",
"updated_at": "2023-01-16T07:40:29.206Z",
"last_close_at": null,
"article_ids": [
130,
132,
131,
243,
244,
245,
415,
419,
420,
411,
412,
413,
414,
416,
418,
421,
422,
423,
417,
441,
437,
438,
439,
440,
442,
443,
445,
447,
450,
489,
492,
927,
928
],
"ticket_time_accounting_ids": []
},
"articles": [
{
"id": 130,
"ticket_id": 53,
"type_id": 1,
[..]
"created_by": "[email protected]",
"updated_by": "[email protected]"
},
{
"id": 131,
"ticket_id": 53,
"type_id": 1,
"sender_id": 1,
"from": "\"somebody"
"to": "[email protected]",
[..]
}
So I have to add the “label” “articles” to the 2nd array and merge both?
Looked at the Merge-Node, but haven’t managed to get it right so far.
Could somebody point me to an example maybe?
I assume it might also be done in a Code-Node with some lines of script.
Thanks for any pointers!