
Hi List!
I want to open otrs tickets with API with this php-script:
<pre>
<?php
$otrs_subject = "test";
$otrs_queue = $Queue;
$otrs_from = "service@domain.com";
$otrs_email = "pp@gmail.com";
$otrs_user = "api";
$otrs_pass = "xxxxx";
$otrs_url = "http://otrs.domain.com/otrs/rpc.pl";
$otrs_queue = "Technik";
$otrs_customerid = $otrs_from;
$otrs_customeruser = $otrs_from;
$otrs_userid = 12; # your OTRS-Userid, varies of course in every
installation
$otrs_message = "Test";
$soapclient = new SoapClient(null, array('location' => $otrs_url,
'uri' => "Core",
'trace' => 1,
'login' => $otrs_user,
'password' => $otrs_pass,
'style' => SOAP_RPC,
'use' => SOAP_ENCODED));
# creating a ticket number
$ticketnr = $soapclient->__soapCall("Dispatch", array($otrs_user,
$otrs_pass, "TicketObject", "TicketCreateNumber"));
#php changes long numbers to 123E+10 notation to prevent this screwing
up our ticketnumbers we convert notation
#it into normal plain numbers. but only if not string, because
sometimes you have a string addition like XY123 on your
#ticket numbers
if(! is_string($ticketnr) ) $ticketnr = number_format($ticketnr,0,
'.', '');
// # create the new ticket
$ticketid = $soapclient->__soapCall("Dispatch", array($otrs_user,
$otrs_pass, "TicketObject", "TicketCreate",
"TN", $ticketnr,
"Title", $otrs_title,
"Queue", $otrs_queue,
"Lock" , "unlock",
"PriorityID", 3,
"State" , "new",
"CustomerId", $otrs_customerid,
"CustomerUser", $otrs_userid,
"OwnerID" , $otrs_userid,
"UserID", $otrs_userid
));
$articleid = $soapclient->__soapCall("Dispatch", array($otrs_user,
$otrs_pass, "TicketObject", "ArticleSend",
"TicketID" , $ticketid,
"ArticleType" , "email-external", # email-external|
email-internal|phone|fax|...
"SenderType" , "agent", # agent|system|customer
"From" , $otrs_from,
"To" , $otrs_email,
"Subject" , "[Ticket#".$ticketnr."] ".$otrs_subject,
"Body" , $otrs_message,
"ContentType" , "text/plain; charset=utf-8",
"Charset" , "utf-8",
"HistoryType" , "EmailCustomer", # EmailCustomer|Move|
AddNote|PriorityUpdate|WebRequestCustomer|...
"HistoryComment" , "generated by OTRSInterface-Class",
"UserID" , $otrs_userid,
"NoAgentNotify" , 0, # if you don't want to send agent
notifications
"Type" , "text/plain",
"Loop" , 0 # auto reject|auto follow up|auto follow
up|auto remove
));
?>
This script works, but otrs do not send autoresponse which I setup in
OTRS-webpanel.
when I open ticket with sending normal email to that queue,
customers gets wonderful auto reply from OTRS.
Is it possible that OTRS-API send autoreply to that customer which I
setup in OTRS?
Viele Gruesse,
Peter
--
Peter

any news in this? Am Mittwoch, den 23.09.2009, 14:08 +0200 schrieb Peter Padberg:
Hi List! I want to open otrs tickets with API with this php-script:
<pre>
$otrs_subject = "test"; $otrs_queue = $Queue; $otrs_from = "service@domain.com"; $otrs_email = "pp@gmail.com"; $otrs_user = "api"; $otrs_pass = "xxxxx"; $otrs_url = "http://otrs.domain.com/otrs/rpc.pl"; $otrs_queue = "Technik";
$otrs_customerid = $otrs_from; $otrs_customeruser = $otrs_from; $otrs_userid = 12; # your OTRS-Userid, varies of course in every installation $otrs_message = "Test";
$soapclient = new SoapClient(null, array('location' => $otrs_url, 'uri' => "Core", 'trace' => 1, 'login' => $otrs_user, 'password' => $otrs_pass, 'style' => SOAP_RPC, 'use' => SOAP_ENCODED));
# creating a ticket number $ticketnr = $soapclient->__soapCall("Dispatch", array($otrs_user, $otrs_pass, "TicketObject", "TicketCreateNumber"));
#php changes long numbers to 123E+10 notation to prevent this screwing up our ticketnumbers we convert notation #it into normal plain numbers. but only if not string, because sometimes you have a string addition like XY123 on your #ticket numbers if(! is_string($ticketnr) ) $ticketnr = number_format($ticketnr,0, '.', '');
// # create the new ticket
$ticketid = $soapclient->__soapCall("Dispatch", array($otrs_user, $otrs_pass, "TicketObject", "TicketCreate", "TN", $ticketnr, "Title", $otrs_title, "Queue", $otrs_queue, "Lock" , "unlock", "PriorityID", 3, "State" , "new", "CustomerId", $otrs_customerid, "CustomerUser", $otrs_userid, "OwnerID" , $otrs_userid, "UserID", $otrs_userid ));
$articleid = $soapclient->__soapCall("Dispatch", array($otrs_user, $otrs_pass, "TicketObject", "ArticleSend", "TicketID" , $ticketid, "ArticleType" , "email-external", # email-external| email-internal|phone|fax|... "SenderType" , "agent", # agent|system|customer "From" , $otrs_from, "To" , $otrs_email, "Subject" , "[Ticket#".$ticketnr."] ".$otrs_subject, "Body" , $otrs_message, "ContentType" , "text/plain; charset=utf-8", "Charset" , "utf-8", "HistoryType" , "EmailCustomer", # EmailCustomer|Move| AddNote|PriorityUpdate|WebRequestCustomer|... "HistoryComment" , "generated by OTRSInterface-Class", "UserID" , $otrs_userid, "NoAgentNotify" , 0, # if you don't want to send agent notifications "Type" , "text/plain", "Loop" , 0 # auto reject|auto follow up|auto follow up|auto remove ));
?>
This script works, but otrs do not send autoresponse which I setup in OTRS-webpanel. when I open ticket with sending normal email to that queue, customers gets wonderful auto reply from OTRS.
Is it possible that OTRS-API send autoreply to that customer which I setup in OTRS?
Viele Gruesse, Peter
participants (1)
-
Peter Padberg