Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Insert action when new ticket created.

Any help with this would be very much appreciated.

Can anyone please give me the file and line number where new tickets are created? Note: I am assuming that there is a single point where new tickets are created (instantiated) from either web form or created by staff?

The reason is that I would like to send an SMS message to the $phone with the ticket number - this is accomplished by calling another php script using $phone as an input parameter e.g. include 'sendSMS.php'; 

Case 1 (user creates ticket via web form): You have created a new ticket # 123. 

Case2 (staff member creates ticket for customer): A new ticket # 123 has been created for you. 

I just need to know where to insert ---> include 'sendSMS.php'; 

 A big thank you to anyone that can help. I will gladly post my finished code for others.


  • edited December 2013
    Haven't used 1.6, But I would look inside /include/class.ticket.php for function create($vars, &$errors, $origin, $autorespond=true, $alertstaff=true) {

    I'd put your custom additions at the bottom, right before it returns the $ticket object.

    That's if you want to do it "that way".. Might be better to hook into "notify staff" function, and simply add the sms call when it would ordinarily send an email.
    You don't know how many config changes you have made that might make the create function return prematurely etc.. At least if you KNOW it is sending emails to staff on ticket creation, that you can mod that function to also send an sms to admins/staff.

    For instance, in 1.7 it has the line: (also in,     function onNewTicket(..)):                 $email->sendAlert($staff->getEmail(), $msg['subj'], $alert, null, $options);

    You could add your call immediately after that. That way osTicket handles which staff to sms, you just sms all the required admins at once. If that ticket requires a manager to receive an email / SMS, simply configure it in osTicket, done. I imagine if you have the correct mobile number stored in osTicket, you could even pull that for the sms! (You may have to add a function to retrieve it, there isn't one in 1.7 by default.

    For instance, in class.staff.php: add

    function getMobile(){
    return $this->ht['mobile'];

    Then, in your class.ticket.php function call, you can, MySMSClass::sendSMS($this->getExtId(), $staff->getMobile()); etc.
  • I'm not aware of anyone that uses or develops for 1.6ST anymore... especially now that its like 3 years old.  You might want to consider upgrading to 1.8 (or at least 1.7.3) and waiting for the plugin module implementation due in 1.8.1.  I feel that SMS would make a great plugin that would be useful to other people.
  • Hi Guys - thanks for answering my post and to Grizly's detail in particular.

    Great advice and ideas. I have upgraded to 1.7.4 so will implement as you suggested.
    I agree it would be best where email notifications are sent. I have developed a REST API where I can send an SMS. It would help users/staff track tickets as emails tend to fall down cracks and disappear. It would also be used for system notifications e.g. priority tickets overdue or system issues.

    If we can develop plugins from 1.8.1 that would be really helpful and would certainly help amalgamate the development effort.

    Great product and helpful folk.. Nice to give something back to the community.

    I would be happy to contribute via the SMS plug.

    Thanks again - Daily Oliver..

  • Sounds pretty fantastic to me. :)
Sign In or Register to comment.