Creation of article not possible - API

Infos:

  • Used Zammad version: 3.6.x
  • Used Zammad installation source: Package
  • Operating system: Windows 10 (Client) / Debian 10.8 (Server)
  • Browser + version: Microsoft Edge (latest)

Expected behavior:

API should create article for a given ticket.

Actual behavior:

  • I get a “not authorized” error when creating a article in a existing ticket for a customer with “setOnBehalfOfUser”.

Steps to reproduce the behavior:

  • Create Ticket
    Try to create a article in the ticket for a customer via a access token of an admin an “setOnBehalfOfUser”.

When i remove the “setOnBehalfOfUser” i can create an article in the ticket, but then it will be created as agent answer.

Code:
$this->client->setOnBehalfOfUser($userId);
$article = $this->client->resource(ResourceType::TICKET_ARTICLE);
$article->setValues([
“ticket_id” => $ticketId,
“body” => $request->input(“message”),
“type” => “web”,
]);
$article->save();

If you’re a normal agent without admin.user permission you can’t just take any article type and create it on behalf an customer. Same applies to other agents.

You may want to create a phone article instead, that should work.

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