die; } _errors_on(); # Get Pipedrive API object $apiPD = new apiPipeDrive(); $apiCall = new callWebhook(); # Set default timezone date_default_timezone_set('America/New_York'); # receive the payload $payload = file_get_contents('php://input'); $data = json_decode(@$payload, true); //Getting Deal Info and change stage if pipeline id is '1' (i.e. for "Leads") $deal_info = $apiPD->getDealInfo($data['current']['id']); $deal_info = json_decode($deal_info, TRUE); if ($deal_info['data']['pipeline_id'] == "1") { $deal_info = $apiPD->modifyDeal($data['current']['id'], array("stage_id" => "1")); } // store into the database //qi("pd_push_notification_log", array("payload" => _escape($payload))); # now, identify if that is hot lead then get the number of customer and start calling the customer # c2a6fc3129578b646ae55717ed15f03ce3ee4df0 - this is key for custom attribute/field - "Source" $deal_source = $data['current']['c2a6fc3129578b646ae55717ed15f03ce3ee4df0']; if (in_array($deal_source, array('37')) || 1) { # Get Person ID $person_id = $data['current']['person_id']; # Get Deal ID $deal_id = $data['current']['id']; # Get Person info $person_info = $apiPD->getPersonInfo($person_id); $person_info = json_decode($person_info, true); # Get Phone