support
This commit is contained in:
parent
3c4057e65a
commit
f53602294f
@ -221,7 +221,6 @@ class Controller_api_twilio_sms extends Crunchbutton_Controller_Rest {
|
|||||||
|
|
||||||
// Log
|
// Log
|
||||||
Log::debug( [ 'action' => 'saving the answer', 'id_support' => $answer->id_support, 'phone' => $phone, 'message' => $message, 'type' => 'sms' ] );
|
Log::debug( [ 'action' => 'saving the answer', 'id_support' => $answer->id_support, 'phone' => $phone, 'message' => $message, 'type' => 'sms' ] );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// c::timeout(function() use ($nums, $b, $twilio, $env, $id) {
|
// c::timeout(function() use ($nums, $b, $twilio, $env, $id) {
|
||||||
|
|||||||
@ -17,10 +17,24 @@ class Crunchbutton_Hipchat_Notification extends Cana_Model {
|
|||||||
self::sendNotification($msg);
|
self::sendNotification($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function NewSupport($support) {
|
||||||
|
$msg = "A new customer service issue (#$support->id_support): ".
|
||||||
|
"$support->name, $support->phone, $support->message";
|
||||||
|
self::sendNotification($msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function NewSupportAnswer($answer) {
|
||||||
|
$msg = "$answer->name has responded to ".
|
||||||
|
"customer service issue #$answer->id_support.";
|
||||||
|
self::sendNotification($msg);
|
||||||
|
}
|
||||||
|
|
||||||
public static function sendNotification($msg) {
|
public static function sendNotification($msg) {
|
||||||
|
error_log($msg);
|
||||||
$msg = urlencode(str_replace('\n', ' ', $msg));
|
$msg = urlencode(str_replace('\n', ' ', $msg));
|
||||||
$env = c::env() == 'live' ? 'live' : 'dev';
|
$env = c::env() == 'live' ? 'live' : 'dev';
|
||||||
$msg = "[env:$env] " . $msg;
|
$msg = "[env:$env]+" . $msg;
|
||||||
|
error_log($msg);
|
||||||
$url = self::$api_url.
|
$url = self::$api_url.
|
||||||
'?auth_token='.self::$auth_token.
|
'?auth_token='.self::$auth_token.
|
||||||
'&room_id='.self::$room_id.
|
'&room_id='.self::$room_id.
|
||||||
@ -29,6 +43,7 @@ class Crunchbutton_Hipchat_Notification extends Cana_Model {
|
|||||||
'¬ify=0'. // don't blink the chat window
|
'¬ify=0'. // don't blink the chat window
|
||||||
'&format=json'.
|
'&format=json'.
|
||||||
'&message='.$msg;
|
'&message='.$msg;
|
||||||
|
error_log($url);
|
||||||
$req = \Httpful\Request::get($url);
|
$req = \Httpful\Request::get($url);
|
||||||
$req->expects('json');
|
$req->expects('json');
|
||||||
$rsp = $req->sendIt();
|
$rsp = $req->sendIt();
|
||||||
@ -37,7 +52,7 @@ class Crunchbutton_Hipchat_Notification extends Cana_Model {
|
|||||||
|
|
||||||
public static function sendUrgentNotification($msg) {
|
public static function sendUrgentNotification($msg) {
|
||||||
$msg = urlencode(str_replace('\n', ' ', $msg));
|
$msg = urlencode(str_replace('\n', ' ', $msg));
|
||||||
$msg = '[env:'.c::env().'] ' . $msg;
|
$msg = '[env:'.c::env().']+' . $msg;
|
||||||
$url = self::$api_url.
|
$url = self::$api_url.
|
||||||
'?auth_token='.self::$auth_token.
|
'?auth_token='.self::$auth_token.
|
||||||
'&room_id='.self::$room_id.
|
'&room_id='.self::$room_id.
|
||||||
|
|||||||
@ -144,5 +144,6 @@ class Crunchbutton_Support extends Cana_Table {
|
|||||||
|
|
||||||
public function save() {
|
public function save() {
|
||||||
parent::save();
|
parent::save();
|
||||||
|
Crunchbutton_Hipchat_Notification::NewSupport($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,5 +20,6 @@ class Crunchbutton_Support_Answer extends Cana_Table {
|
|||||||
|
|
||||||
public function save() {
|
public function save() {
|
||||||
parent::save();
|
parent::save();
|
||||||
|
Crunchbutton_Hipchat_Notification::NewSupportAnswer($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user