I am trying to create an Ticket via PHP & the REST genericinterface from OTRS (https://doc.otrs.com/doc/manual/admin/6.0/en/html/genericinterface.html#id-1.6.12.10.7.2).
I can create an Ticket and also an Article. But instead of an outgoing email the OTRS History looks like the user was sending a ticket to the queue. And also no mail is going out to the customer :-(. But I like to have an outgoing EMail Ticket together with a pending state of the ticket.
Here my PHP code
<?php
header("Content-type: application/json; charset=utf-8");
require __DIR__ . '/vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'http://test-otrs.company.local/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/']);
$arrTicket = array(
"Title" => 'some ticket title',
"Queue" => 'testqueue',
"Lock" => 'unlock',
"Type" => 'Unclassified',
"State" => 'new',
"Priority" => '3 normal',
"Owner" => 'username',
"CustomerUser" => 'user@test.com'
);
$arrArticle = array(
"CommunicationChannel" => 'Email',
"SenderType" => 'agent',
"To" => 'user@test.com',
"Subject" => 'some subject',
"Body" => 'some body',
"ContentType" => 'text/plain; charset=utf8'
);
$response = $client->post('Ticket', ['json' => array("UserLogin" => "username", "Password" => "testtesttest", "Ticket" => $arrTicket, "Article" => $arrArticle)]);
if ($response->getBody())
{
echo $response->getBody();
}
https://forums.otterhub.org/viewtopic.php?p=168025#p168025 solved my problem. You need a extra plugin (https://github.com/znuny/Znuny4OTRS-GIArticleSend) to be able to send an outgoing EMail Ticket.