-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement Request] Multiple webhook urls per 'webhook' #9
Comments
something like this?
then
|
More that, say, So, say on WebhookChannel:33 you might do something like if (! $urls = $notifiable->routeNotificationFor('Webhook')) {
return;
}
$urls = !is_array($urls) ? [$urls] : $urls;
foreach ($urls as $url) {
$webhookData = $notification->toWebhook($notifiable)->toArray();
$response = $this->client->post($url, [
'body' => json_encode(Arr::get($webhookData, 'data')),
'verify' => false,
'headers' => Arr::get($webhookData, 'headers'),
]);
if ($response->getStatusCode() >= 300 || $response->getStatusCode() < 200) {
throw CouldNotSendNotification::serviceRespondedWithAnError($response);
}
} It's still not perfect, optimally you'd also be able to customize the payload and/or set custom options per endpoint, but it'd be a good step (and make it usable for us) |
Hi! Sorry for the long delay. I like the idea of this feature. Feel free to PR :) |
Would love to see this |
What we need is the ability for a single notification-notifiable combo to have multiple destination webhooks.
Maybe check if
routeNotificationForWebhook()
returns an array and iterate through them?The text was updated successfully, but these errors were encountered: