Create ticket by api > answer on mail shows mail from api token owner

Infos:

  • Used Zammad version: 6.5
  • Used Zammad installation type: package
  • Operating system: Ubuntu 24.04

Hey guys,

I have a little question.
I created a PHP form for our users to create tickets with some fields. The form works perfectly. The only thing is if an agent click on the article on answer the wrong email will be used (the mail of the admin who has created the token for the api and creates the ticket).

Example:
The User fills the form

if the user click on Ticket erstellen the following PHP code will be used to create a ticket:

<?php
$zammadApiUrl = 'https://tickets.khk.local/api/v1/tickets';

$data =
[
	'title' => $betreff,
	'group_id' => 2, #Personal
	'customer' => strtolower($email),
	'article' =>
	[
		'subject' => $betreff,
		'body' => '<p><strong>Name:</strong> '.$autor.'<br><strong>E-Mail:</strong> '.$email.'<br><strong>Telefon:</strong> '.$telefon.'<br><strong>Betreff:</strong> '.$betreff.'<br><strong>Erstellt über:</strong> Ticketformumlar</p><hr><p>'.nl2br($text).'</p>',
		'content_type' => 'text/html',
		'type' => 'web',
		'internal' => false,
		'from' => 'customer',
		'sender' => 'Customer'
	],
	'type' => $type,
	'abrechnung' => [$abrechnung]
];

$ch = curl_init($zammadApiUrl);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token token='.$apiToken, 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);

The ticket is now created. If the agent from the HR answer the mail from the customer is not set. The mail is now from the Admin. How can I change that?

Thanks in advance for tipps! :slight_smile: