Articles ======== General Information About Ticket Articles ----------------------------------------- Some attributes of articles might not be straight forward or come with fairly many options - below list hopefully helps you on this journey. content_type Zammad supports ``text/html`` for HTML formatted text or ``text/plain`` for plain text. This allows you to have better formatting options if you need them. Zammad web UI usually uses ``text/html``. type Zammad supports a huge number of article types. Below list may be incomplete depending on your instance and possibly installed add-ons / custom changes. If not stated otherwise, all article types below are **communication articles** and thus affecting SLA calculation in Zammad defaults. The difference is that communication articles provide the option to reply automatically. Which actions exactly are available depends on the article type and e.g. recipient lists. .. figure:: /images/api/ticket-article_reply-buttons.png :alt: Reply and forward buttons on email article :width: 90% ``email`` This allows you to create incoming or outgoing email articles. However, this highly depends on the chosen ``sender``. ``phone`` Indicates phone notes. ``web`` Usually used by customers only. This type is being used when ever your customer uses the web UI to create articles. ``note`` When ever a communication does not fit (e.g.: internal notes) choose note. Zammad also uses this article type as default fall back. This is **not a communication article**. ``sms`` This type is being used for Zammads SMS integration. ``chat`` This article type is technically a place holder and is only available via API. ``fax`` This article type is technically a place holder and is only available via API. ``twitter status`` & ``twitter direct-message`` These articles types are used by Zammads twitter channel. Technically you can use these to automatically respond to existing requests via twitter. ``facebook feed post`` & ``facebook feed comment`` These articles types are used by Zammads Facebook channel. Technically you can use these to automatically respond to existing requests via Facebook. ``telegram personal-message`` Used by Zammads Telegram channel. Technically you can use these to automatically respond to existing requests via Telegram. internal This attribute allows you to set the visibility of your articles. For internal visible only use ``true``, for visibly for your customers as well use ``false``. .. warning:: **🔒 Visibility: internal doesn't mean it's silent** If you set an article to ``internal: true`` but choose to send an email, please be aware that said Email is still being sent out! sender Indicates which use did create the article. You can choose from: - ``Agent`` - ``Customer`` - ``System`` .. warning:: Depending of above selection, some article types may not be available or behave different. Please be aware that ``System`` causes users not being able to read the bodies (this works similar to Zammads trigger displaying in tickets). .. _retrieve_articles_attachments: List Articles by Ticket ----------------------- Required permission: ``ticket.agent`` **or** ``ticket.customer`` ``GET``-Request sent: ``/api/v1/ticket_articles/by_ticket/{ticket id}`` Response: .. code-block:: json :force: # HTTP-Code 200 OK [ { "id": 9, "ticket_id": 5, "type_id": 1, "sender_id": 2, "from": "David Bell ", "to": "order@chrispresso.com", "cc": null, "subject": null, "reply_to": null, "message_id": null, "message_id_md5": null, "in_reply_to": null, "content_type": "text/html", "references": null, "body": "Hi,
\n
\nplease send me:
\n1 x Café Kopi susu
\n4 x Viennese melange
\n
\nDelivery Address:
\nDavid Bell
\nEiffel Tower
\n5 Avenue Anatole France
\n75007 Paris
\n\n
\nDavid Bell", "internal": false, "preferences": {}, "updated_by_id": 10, "created_by_id": 10, "origin_by_id": null, "created_at": "2021-08-02T11:57:18.068Z", "updated_at": "2021-08-02T11:57:18.068Z", "attachments": [], "type": "email", "sender": "Customer", "created_by": "david@example.com", "updated_by": "david@example.com", "time_unit": null }, { "id": 10, "ticket_id": 5, "type_id": 1, "sender_id": 1, "from": "Emma Taylor via ", "to": "David Bell ", "cc": null, "subject": null, "reply_to": null, "message_id": null, "message_id_md5": null, "in_reply_to": null, "content_type": "text/html", "references": null, "body": "Hi David,
\n
\nnice, we will ship it to your delivery address:
\n
\nEiffel Tower\n5 Avenue Anatole France\n75007 Paris.
\n
\nYou will get it till Wednesday.
\n\n
\n--
\nGreetings,
\n
\nEmma Taylor
", "internal": false, "preferences": {}, "updated_by_id": 5, "created_by_id": 5, "origin_by_id": null, "created_at": "2021-08-03T09:57:18.121Z", "updated_at": "2021-08-03T09:57:18.121Z", "attachments": [], "type": "email", "sender": "Agent", "created_by": "emma@chrispresso.com", "updated_by": "emma@chrispresso.com" } ] List Specific Article --------------------- Required permission: ``ticket.agent`` **or** ``ticket.customer`` ``GET``-Request sent: ``/api/v1/ticket_articles/{article id}`` Response: .. code-block:: json :force: # HTTP-Code 200 OK { "id": 9, "ticket_id": 5, "type_id": 1, "sender_id": 2, "from": "David Bell ", "to": "order@chrispresso.com", "cc": null, "subject": null, "reply_to": null, "message_id": null, "message_id_md5": null, "in_reply_to": null, "content_type": "text/html", "references": null, "body": "Hi,
\n
\nplease send me:
\n1 x Café Kopi susu
\n4 x Viennese melange
\n
\nDelivery Address:
\nDavid Bell
\nEiffel Tower
\n5 Avenue Anatole France
\n75007 Paris
\n\n
\nDavid Bell", "internal": false, "preferences": {}, "updated_by_id": 10, "created_by_id": 10, "origin_by_id": null, "created_at": "2021-08-02T11:57:18.068Z", "updated_at": "2021-08-02T11:57:18.068Z", "attachments": [], "type": "email", "sender": "Customer", "created_by": "david@example.com", "updated_by": "david@example.com", "time_unit": null } Create ------ Required permission: ``ticket.agent`` **or** ``ticket.customer`` .. tip:: If you want to create articles on behalf of other users (e.g. for a phone note), use the ``origin_by_id`` attribute. ``ticket.agent`` permission is mandatory for this. ``POST``-Request sent: ``/api/v1/ticket_articles`` .. tabs:: .. tab:: Plain article .. code-block:: json { "ticket_id": 5, "subject": "Call note", "body": "Called the customer and discussed their issues.
Turns out these were caused by invalid configurations - solved.", "content_type": "text/html", "type": "phone", "internal": false, "sender": "Agent", "time_unit": "15" } Response: .. code-block:: json :force: # HTTP-Code 201 Created { "id": 33, "ticket_id": 5, "type_id": 5, "sender_id": 1, "from": "Christopher Miller", "to": null, "cc": null, "subject": "Call note", "reply_to": null, "message_id": null, "message_id_md5": null, "in_reply_to": null, "content_type": "text/html", "references": null, "body": "Called the customer and discussed their issues.
Turns out these were caused by invalid configurations - solved.", "internal": false, "preferences": {}, "updated_by_id": 3, "created_by_id": 3, "origin_by_id": null, "created_at": "2021-11-08T16:13:35.962Z", "updated_at": "2021-11-08T16:13:35.962Z", "attachments": [], "type": "phone", "sender": "Agent", "created_by": "chris@chrispresso.com", "updated_by": "chris@chrispresso.com" } .. tab:: Article with attached files .. hint:: The first attachment example does work, remove the second "generalized" part to try the payload out. 🔨 .. code-block:: json { "ticket_id": 5, "to": "", "cc": "", "subject": "some subject", "body": "Please see attached file...", "content_type": "text/plain", "type": "note", "internal": true, "time_unit": "25", "attachments": [ { "filename": "portal.txt", "data": "VGhlIGNha2UgaXMgYSBsaWUhCg==", "mime-type": "text/plain" }, { "filename": "{filename}", "data": "{file content base64 encoded}", "mime-type": "{attachments mime-type}" } ] } Response: .. code-block:: json :force: # HTTP-Code 201 Created { "id": 35, "ticket_id": 5, "type_id": 10, "sender_id": 1, "from": "Christopher Miller", "to": "", "cc": "", "subject": "some subject", "reply_to": null, "message_id": null, "message_id_md5": null, "in_reply_to": null, "content_type": "text/plain", "references": null, "body": "Please see attached file...", "internal": true, "preferences": {}, "updated_by_id": 3, "created_by_id": 3, "origin_by_id": null, "created_at": "2021-11-09T12:02:55.434Z", "updated_at": "2021-11-09T12:02:55.434Z", "attachments": [ { "id": 17, "filename": "portal.txt", "size": "19", "preferences": { "Mime-Type": "text/plain" } } ], "type": "note", "sender": "Agent", "created_by": "chris@chrispresso.com", "updated_by": "chris@chrispresso.com" } .. tab:: Article with inline images Inline images can be used by providing data URIs in your HTML markup. .. code-block:: json { "ticket_id": 5, "to": "", "cc": "", "subject": "some subject", "body": "Let's see the phoenix ", "content_type": "text/html", "type": "note", "internal": false, "time_unit": "12" } Response: .. code-block:: json :force: # HTTP Code 201 Created { "id": 37, "ticket_id": 5, "type_id": 10, "sender_id": 1, "from": "Christopher Miller", "to": "", "cc": "", "subject": "some subject", "reply_to": null, "message_id": null, "message_id_md5": null, "in_reply_to": null, "content_type": "text/html", "references": null, "body": "Let's see the phoenix ", "internal": false, "preferences": {}, "updated_by_id": 3, "created_by_id": 3, "origin_by_id": null, "created_at": "2021-11-09T12:10:49.375Z", "updated_at": "2021-11-09T12:10:49.375Z", "attachments": [ { "id": 19, "filename": "image1.png", "size": "3735", "preferences": { "Content-Type": "image/png", "Mime-Type": "image/png", "Content-ID": "5.e384b84e-bfef-49f7-af22-8546fb99f8dc@fqdn", "Content-Disposition": "inline" } } ], "type": "note", "sender": "Agent", "created_by": "chris@chrispresso.com", "updated_by": "chris@chrispresso.com" } Receive Attachments ------------------- Now that you have all those fancy attachments within your tickets, you may want to download specific ones. ``GET``-Request sent: ``/api/v1/ticket_attachment/{ticket id}/{article id}/{attachment id}`` Response: .. figure:: /images/zammad_logo_70x61.png :alt: Returned image attachment .. hint:: If you're not sure which articles a ticket / article contains, please :ref:`retrieve ` affected articles first.