public function process($body, $retry = 0) { try { $data = ['webhook_event' => $body]; $signature = new Signature($this->signature_key); $curl = new Curl(); $curl->setHeader('X-BOT2HOOK-SIGNATURE', $signature->generate($this->config['webhook_url'], $data)); $response = $curl->post($this->config['webhook_url'], $data); if (empty($response) || !is_object($response) || empty($response->ok)) { $error = "Outgoing webhook error. "; if (empty($response)) { $error .= 'Curl: ' . $curl->curlErrorCode . ' - ' . $curl->curlErrorMessage . "\n"; } else { $error .= 'Response: ' . print_r($response, true) . "\n"; } throw new \Exception($error); } } catch (\Exception $e) { $this->retry($e, 'b2h_outgoing', $body, $retry); } }