API with Zammad automatic reply

Hi,

i would like to answer on a Ticket automaticly.

params = {
“state”: “closed”,
“article”: {
“body”: "Sehr geehrter Kunde, "
“type”: “email”
“from”: “”,
“to”

The value should to obtained automatically. The author’s email address should go here.

Does somebody has any idea?

Greetings

Tristan

You could use the email address of the customer as recipient if you read the full ticket:

ubuntu-rs@ubuntu-rs:/workspace/git_zammad/zammad$ curl -s -u"admin@example.com:test" http://ubuntu-rs:3000/api/v1/tickets/1?full=true | jq '.assets.Ticket."1".customer_id'
2
ubuntu-rs@ubuntu-rs:/workspace/git_zammad/zammad$ curl -s -u"admin@example.com:test" http://ubuntu-rs:3000/api/v1/tickets/1?full=true | jq '.assets.User."2".email'
"nicole.braun@zammad.org"

if you meant the sender, then it is a bit more tricky. I think you would need to get group and with it you can find the sender address of the email.

ubuntu-rs@ubuntu-rs:/workspace/git_zammad/zammad$ curl -s -u"admin@example.com:test" http://ubuntu-rs:3000/api/v1/tickets/1?full=true | jq '.assets.Ticket."1".group_id'
1
ubuntu-rs@ubuntu-rs:/workspace/git_zammad/zammad$ curl -s -u"admin@example.com:test" http://ubuntu-rs:3000/api/v1/tickets/1?full=true | jq '.assets.Group."1".email_address_id'
1
ubuntu-rs@ubuntu-rs:/workspace/git_zammad/zammad$ curl -s -u"admin@example.com:test" http://ubuntu-rs:3000/api/v1/email_addresses/1 | jq '.email'
"zammad@localhost"

Actually update: It seems that the from field is automatically filled. I just tried this request:

curl --request POST \
  --url http://ubuntu-rs:3000/api/v1/ticket_articles \
  --header 'Authorization: Basic YWRtaW5AZXhhbXBsZS5jb206dGVzdA==' \
  --header 'Content-Type: application/json' \
  --data '{
   "ticket_id": 1,
   "subject": "Call summary",
   "body": "test 123",
   "content_type": "text/html",
   "type": "email",
   "internal": false,
   "sender": "Agent",
   "to": "test@example.com"
}'

(Articles — Zammad System Documentation documentation)

Sorry if I made myself unclear. So as a whole. I want that when a ticket is closed in Youtrack, the person in Zammad gets an automatic message that we are finished and their error will be fixed. However, in Youtrack there is only a link to the ticket. Therefore, an API request would either have to obtain the email address automatically or be able to respond to the customer’s message. I manage to get a message written, but then no email is sent to the customer. Therefore, it seems to me that there is still a step missing with the mailing

Setting the to attribute is mandatory and does not happen automatically.
That’s because a ticket is not limitted to one conversation partner and that partner could change due to internal questions to others by e.g. your customer.

So you may have to shoot a second request to find out who you’re talking to actually.