Skip to content

Navigation Menu

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

[Webhook] update doc #19974

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

Open
wants to merge 1 commit into
base: 6.4
Choose a base branch
Loading
from
Open

[Webhook] update doc #19974

wants to merge 1 commit into from

Conversation

alli83
Copy link
Contributor

@alli83 alli83 commented Jun 18, 2024

Update the webhook documentation

@alli83 alli83 marked this pull request as draft June 18, 2024 22:42
@carsonbot carsonbot added this to the 6.4 milestone Jun 18, 2024
@carsonbot carsonbot changed the title [WEBHOOK]: update doc [Webhook] : update doc Jun 18, 2024
@alli83 alli83 force-pushed the webhook-update-doc branch from af22c0a to ee47ae8 Compare June 18, 2024 22:42
------------------------------------------------------------------

It is important to note that when the incoming webhook is processed by the :class:`WebhookController`, you have the option to handle the consumption of remote events asynchronously.
Indeed, this can be configured using a bus, with the default setting pointing to the Messenger component's default bus.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: show config

webhook.rst Outdated Show resolved Hide resolved
webhook.rst Outdated Show resolved Hide resolved
webhook.rst Show resolved Hide resolved
@alli83 alli83 force-pushed the webhook-update-doc branch 13 times, most recently from bb79ac4 to 581043f Compare June 19, 2024 13:16
@alli83 alli83 marked this pull request as ready for review July 1, 2024 07:20
Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had time for a quick review of the first bit of this document.

I was a bit confused on "who was the consumer and who was the provider".

webhook.rst Outdated Show resolved Hide resolved
webhook.rst Outdated Show resolved Hide resolved
webhook.rst Outdated Show resolved Hide resolved
webhook.rst Outdated Show resolved Hide resolved
webhook.rst Outdated Show resolved Hide resolved
@alli83 alli83 force-pushed the webhook-update-doc branch from 581043f to ea9732e Compare August 4, 2024 09:35
@mxr576
Copy link

mxr576 commented Sep 28, 2024

Thanks for this PR, the Webhook component deserves a high quality and detailed documentation!

@faizanakram99
Copy link
Contributor

faizanakram99 commented Jan 10, 2025

@javiereguiluz what is preventing this PR from being merged?

Is there anything pending?

The server part of webhook still remains undocumented, it is a super useful feature of symfony especially when combined with api platform (or simply openapi docs), i think not many people know symfony can also send webhooks (not just consume them).

Symfony Webhook, when used alongside Symfony RemoteEvent, streamlines the management of these fundamental phases.

A Single Entry Endpoint: Receive
--------------------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be a sub-heading of the Consuming Webhooks section instead ? With the new doc covering both consuming and providing webhooks, I think we should have only 3 h2 titles: Installation, Consuming webhooks and Providing webhooks

The routing name must be unique as this is what connects the provider with your
webhook consumer code.

.. code-block:: yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use a configuration-block to show the configuration in all formats

For example, you can use Mercure to broadcast updates to clients of the hub, among other actions ...::

// src/Webhook/ExampleRequestParser.php
#[AsRemoteEventConsumer('my_first_parser')] # routing name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[AsRemoteEventConsumer('my_first_parser')] # routing name
#[AsRemoteEventConsumer('my_first_parser')] // routing name

We don't use # as a delimiter for line comments in the Symfony coding standards

you will need to configure the settings (as mentioned earlier) and also create your own consumer.
This is necessary because it involves your own business logic and your specific reactions to the remote event(s) that may be received from the built-in parsers.

Usage in Combination with the Mailer Component
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure having 2 sections about using it in combination with mailer and notifier in the page (one in the section about the parser and one in the section about the handler) makes sense. I think it might be better to organize the content the other way around:

  • usage with mailer
  • usage with notifier
  • usage with custom webhooks (talking about both the request parser and the handler)

It's crucial to understand that the :class:`Symfony\\Component\\Webhook\\Controller\\WebhookController` itself remains provider-agnostic, utilizing
a routing mechanism to determine which parser should handle incoming webhooks for analysis.

As mentioned earlier, incoming webhooks require a specific prefix to be directed to the :class:`Symfony\\Component\\Webhook\\Controller\\WebhookController`.
Copy link
Member

@stof stof Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this section gives far too much details about the WebhookController, which are irrelevant for most users as they won't ever touch it directly, while not explaining the high-level picture:

webhooks are received on a URL <prefix>/<routing-name> and routed to the appropriate request parser and handler based on the routing name.

That's the info that users need to have, with configuration examples in all formats for the routing configuration

@OskarStark OskarStark changed the title [Webhook] : update doc [Webhook] update doc Mar 4, 2025
@stof
Copy link
Member

stof commented Mar 4, 2025

thinking about this again, I think we should rather talk about Sender or Dispatcher instead of Provider. There is no place in the code where we ever talk about "providing" webhooks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.