Skip to content
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

Webhooks #526

Open
tusmester opened this Issue Dec 3, 2018 · 0 comments

Comments

1 participant
@tusmester
Copy link
Member

commented Dec 3, 2018

The Webhook technology may serve as another extensibility point in sensenet by providing callbacks for well-known repository events (content create/edit/etc.).

This will let 3rd party developers write event handlers without having to create/modify server-side code, which is a huge benefit (so this is not a notification system for end users).

Acceptance

  • collect events to provide webhooks for (later we will add more)
  • design and implement the webhook API
    • who can register a webhook?
    • Prepare for hosting multiple clients in the same repo.
    • what can we register a webhook for? (granularity: per site? per workspace? - similar to notification)
  • documentation

API proposal

When something happens in the repository, we will decide whether to send a webhook request based on the registered web hooks. By default we will use the account of the user who registered the webhook, so we will send a request only if that user has access to that particular content. If this is not sufficient, see the last example with the dedicated admin user (can this be an info leak?).

// register for all events under the workspace
WebHooks.Register(workspacePath, url);

// register for all events in a workspace (including the ws itself)
WebHooks.Register(workspacePath, url, new WebHookOptions
{
    IncludeRoot = true
});

// register for all events on a workspace, but not its children
WebHooks.Register(workspacePath, url, new WebHookOptions
{
    LocalOnly = true
});

// register for create/modify events, but not delete
WebHooks.Register(workspacePath, url, new WebHookOptions
{
    Events = new [] {"create", "modify"}
});

// register for all events for files
WebHooks.Register(workspacePath, url, new WebHookOptions
{
    ContentTypes = new[] { "File" }
});

// register for create events that are accessible for a certain admin user
WebHooks.Register("/Root/IMS", url, new WebHookOptions
{
    Events = new[] { "create" },
    ContentTypes = new[] { "CustomUser" },
    Admin = "domain\\hradmin"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.