Custom Form to Create new ticket via API

  • Used Zammad version: 2.8

Hi, I am trying to create my own custom form on my website to create tickets, but have some issues.

First I check to see if the customer exists, and if not I create them.

Then I create a ticket as follows:

{
 "title": "Test Ticket from Site",
 "group": "Users",
  "customer": "bob@smith.example.com",
 "article": {
   "subject": "This is a test",
   "body": "My Message",
   "type": "email",
   "internal": false
 }
}

When I do this, the ticket does get created, but I am using the auth token on my admin account to authenticate, and the ticket gets created as though the message came from me. Am I missing something obvious?

Yes, there’s several things that might help you.
First of all, I guess you might want to simulate an E-Mail for simplicity reasons, so you to tell Zamamd that this is actually an E-Mail. Also, phone notes (which will be the default when creation happens) will always be from the agent. If you set the customer correct, that should be good to go normally.

Anyway, here’s an API example for the screenshot below, this will exactly create what you see on the screen. So you can fiddle around with that to meet your requirenment. I hope this helps. :slight_smile:

{
    "group_id": 1,
    "priority_id": 3,
    "state_id": 2,
    "organization_id": 2,
    "title": "Some API-Test",
    "owner_id": 3,
    "customer_id": 6,
    "note": null,
    "first_response_at": null,
    "first_response_escalation_at": "2019-01-31T10:50:28.000Z",
    "first_response_in_min": null,
    "first_response_diff_in_min": null,
    "close_at": null,
    "close_escalation_at": "2019-02-06T10:50:28.000Z",
    "close_in_min": null,
    "close_diff_in_min": null,
    "update_escalation_at": "2019-02-01T11:20:28.000Z",
    "update_in_min": null,
    "update_diff_in_min": null,
    "last_contact_at": "2019-01-14T15:50:28.000Z",
    "last_contact_agent_at": null,
    "last_contact_customer_at": "2019-01-14T15:50:28.000Z",
    "last_owner_update_at": null,
    "create_article_type_id": 5,
    "create_article_sender_id": 2,
    "article_count": 1,
    "escalation_at": "2019-01-31T10:50:28.000Z",
    "pending_time": null,
    "type": "email",
    "time_unit": null,
    "preferences": {
        "escalation_calculation": {
            "first_response_at": null,
            "last_update_at": "2019-01-14T15:50:28.000Z",
            "close_at": null,
            "sla_id": 1,
            "sla_updated_at": "2019-01-15T08:30:55.830Z",
            "calendar_id": 1,
            "calendar_updated_at": "2019-01-17T10:53:45.906Z",
            "escalation_disabled": false
        }
    },
    "updated_by_id": 3,
    "created_by_id": 3,
    "created_at": "2019-01-14T15:50:28.000Z",
    "updated_at": "2019-01-18T17:49:29.928Z",
	"tags": "gets,ignored,anyway,noreply",
	"article": {
        "type_id": 1,
        "sender_id": 2,
        "from": "LeTest <alias@secret.tld>",
        "to": "Users",
        "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": "Some amazing test!",
        "internal": false,
        "preferences": {},
        "updated_by_id": 3,
        "created_by_id": 3,
        "origin_by_id": 5,
        "created_at": "2019-01-14T15:51:50.000Z",
        "updated_at": "2019-01-14T15:51:50.341Z",
        "attachments": [],
        "type": "email",
        "sender": "Customer",
        "created_by": "alias@secret.tld",
        "updated_by": "alias@secret.tld",
        "origin_by": "test2@test.com"
    }
}

Of course you can leave out not needed stuff. :slight_smile:

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