@param $webhook

@return $this
439174
public function setWebhook($webhook)
    {
        $this->webhook = $webhook;
        $this->id = Carbon::now()->toDateTimeString();

        return $this;
    }
294681
private function handleWebhook() {
        $identifier = $this->field('identifier');

        if ($identifier !== $this->identifier) {
            return;
        }

        $event_id = $this->field('event_id');
        $webhook_id = $this->field('webhook_id');

        if (!$event_id || !$webhook_id) {
            Log::info($this->patrol, 'Webhook ' . $this->identifier . ' has no event_id or webhook_id');
            return;
        }

        $httpClient = new HttpClient($this->patrol, 'GET', 'webhooks/' . $webhook_id . '/events/' . $event_id);
        $response = $httpClient->response();

        if (!$response) {
            Log::info($this->patrol, 'Retrieving webhook from ' . $httpClient->getUrl() . ' failed');
            return;
        }

        $data = $this->field($response, 'data');

        if (!$data) {
            Log::info($this->patrol, 'Event has invalid format to be processed: ' . print_r($response, true));
        }

        $callable = $this->callback;

        if (is_callable($callable)) {
            $callable($data);
        }
    }
457175
private function _createWebhook(array $response)
    {
        $model = new Webhook();
        $model->setId($response['id']);
        isset($response['url']) ? $model->setUrl($response['url']) : $model->setEmail($response['email']);
        $model->setLivemode($response['livemode']);
        $model->setEventTypes($response['event_types']);
        $model->setCreatedAt($response['created_at']);
        $model->setUpdatedAt($response['updated_at']);
        $model->setAppId($response['app_id']);
        $model->setActive($response['active']);
        return $model;
    }
935734
protected function proxy() {
        if (!$this->context) {
            $this->context = new WebhookContext(
                $this->version,
                $this->solution['sessionSid'],
                $this->solution['sid']
            );
        }

        return $this->context;
    }
841191
public function createWebhook($roomId, Webhook $webhook)
    {
        $response = $this->client->post(sprintf('/v2/room/%s/webhook', $roomId), $webhook->toJson());

        return $response['id'];
    }
92016
public function getWebhooks()
    {
        $this->endpoint = 'webhooks';
        $this->url = sprintf('%s%s', $this->url, $this->endpoint);
        $response = $this->get($this->url);
        return new AuthnetWebhooksResponse($response);
    }
502971
public function sendExceptionResponse(WebHookHandlerException $e) {
		$httpCode = '400 Bad Request';
		switch($e->getCode()) {
			case WebHookHandlerException::NO_PRIVATE_KEY:
				$httpCode = '500 Internal Server Error';
				break;
			case WebHookHandlerException::INVALID_DECRYPTED_JSON:
			case WebHookHandlerException::DECRYPTION_FAILED:
			case WebHookHandlerException::INPUT_FETCH_FAILED:
			case WebHookHandlerException::INPUT_DECODE_FAILED:
			case WebHookHandlerException::NO_ENVELOPE_KEY:
			case WebHookHandlerException::NO_PAYLOAD:
			case WebHookHandlerException::NO_INPUT_HASH:
				$httpCode = '400 Bad Request';
				break;
		}
		$this->sendHTTPResponse($httpCode, ['success' => false, 'errorCode' => $e->getCode(), 'errorDescription' => $e->getMessage()]);
		return $this;
	}
412073
public function handleWebhook(Request $request)
    {
        try {
            $webhook = $this->parseBraintreeNotification($request);
        } catch (Exception $e) {
            return;
        }

        $method = 'handle'.Str::studly(str_replace('.', '_', $webhook->kind));

        if (method_exists($this, $method)) {
            return $this->{$method}($webhook);
        }

        return $this->missingMethod();
    }
936668
def start_webhook(self, webhook_path=None, request_handler=WebhookRequestHandler, route_name=DEFAULT_ROUTE_NAME,
                      **kwargs):
        
        self.set_webhook(webhook_path=webhook_path, request_handler=request_handler, route_name=route_name)
        self.run_app(**kwargs)
1033060
public function registerMainWebhook($listId, $webhookurl)
    {
        // Configure webhook
        $subscribeWebhook = [
            'url' => $webhookurl,
            'events' => [
                'subscribe'   => true,
                'unsubscribe' => true,
                'profile'     => true,
                'cleaned'     => true,
                'upemail'     => true,
                'campaign'    => true
            ],
            'sources' => [
                'user'  => true,
                'admin' => true,
                'api'   => false // to avoid double (infinite loop) update (update an subscriber with the API and the webhook reupdate the user, ...)
            ]
        ];

        return $this->addWebhook($listId, $subscribeWebhook);
    }
898012
public function setWebhookState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\Intent_WebhookState::class);
        $this->webhook_state = $var;

        return $this;
    }
641289
public function show($id, $webhookId)
    {
        return $this->get($this->getPath($id).'/'.rawurlencode($webhookId));
    }
988004
public function deleteWebhook($webhookId)
    {
        $this->endpoint = 'webhooks';
        $this->url = sprintf('%s%s/%s', $this->url, $this->endpoint, $webhookId);
        $this->delete($this->url);
    }
693813
public function setHook(string $hook) : Installer
    {
        if (!empty($hook) && !Util::isValid($hook)) {
            throw new Exception\InvalidHookName('Invalid hook name \'' . $hook . '\'');
        }
        $this->hookToHandle = $hook;
        return $this;
    }
1319203
public function get(int $id): Webhook
    {
        return $this->loadResource(
            Webhook::class,
            sprintf(self::GET_WEBHOOK_URI, $id)
        );
    }
817602
private function ensureInput() {
		if(!$this->input) {
			$this->getInputFromHTTP();
			if(!$this->input) throw new WebHookHandlerException('Could not fetch input', WebHookHandlerException::INPUT_FETCH_FAILED);
		}
	}
1315119
public function setHook(string $hook) : Hook
    {
        if (!Util::isValid($hook)) {
            throw new \RuntimeException('Invalid hook name');
        }
        $this->hookToExecute = $hook;
        return $this;
    }