Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c9d9033

Browse filesBrowse files
committed
[Webhook] [Notifier] Added documentation for Webhook in combination with the Notifier component
1 parent 0b58658 commit c9d9033
Copy full SHA for c9d9033

File tree

1 file changed

+45
-0
lines changed
Filter options

1 file changed

+45
-0
lines changed

‎webhook.rst

Copy file name to clipboardExpand all lines: webhook.rst
+45Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,48 @@ final readonly class WebhookListener implements ConsumerInterface
130130
// Handle the mail engagement event
131131
}
132132
}
133+
134+
Usage in combination with the Notifier component
135+
------------------------------------------------
136+
137+
The usage of the Webhook component when using a third-party transport in
138+
the Notifier is very similar to the usage with the Mailer.
139+
140+
Currently, the following third-party sms transports support webhooks:
141+
142+
============ ==========================================
143+
SMS service Parser service name
144+
============ ==========================================
145+
Twilio ``notifier.webhook.request_parser.twilio``
146+
============ ==========================================
147+
148+
.. versionadded:: 6.3
149+
150+
Webhook support for the Twilio service was introduced in Symfony 6.3.
151+
152+
For SMS transports, an additional ``SmsEvent`` is available in the RemoteEvent
153+
consumer::
154+
155+
use Symfony\Component\RemoteEvent\Attribute\AsRemoteEventConsumer;
156+
use Symfony\Component\RemoteEvent\Consumer\ConsumerInterface;
157+
use Symfony\Component\RemoteEvent\Event\Sms\SmsEvent;
158+
use Symfony\Component\RemoteEvent\RemoteEvent;
159+
160+
#[AsRemoteEventConsumer('notifier_twilio')]
161+
final readonly class WebhookListener implements ConsumerInterface
162+
{
163+
public function consume(RemoteEvent $event): void
164+
{
165+
if ($event instanceof SmsEvent) {
166+
$this->handleSmsEvent($event);
167+
} else {
168+
// This is not an sms event
169+
return;
170+
}
171+
}
172+
173+
private function handleSmsEvent(SmsEvent $event): void
174+
{
175+
// Handle the sms event
176+
}
177+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.