Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions admin_manual/webhook_listeners/budibase_workflows.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
==================
Budibase workflows
==================


Budibase can easily be connected to Nextcloud and start automations reacting to Nextcloud events.


Using a Nextcloud webhook as automation trigger
-----------------------------------------------

When creating a new automation in Budibase, you can choose "Webhook" as trigger.

.. image:: images/new_automation.png
:alt: Budibase for creating a new automation, with highlighted "Webhook" button

Budibase shows a schema request URL you can use to send the expected payload schema in advance.

Check failure on line 17 in admin_manual/webhook_listeners/budibase_workflows.rst

View workflow job for this annotation

GitHub Actions / Lint RST files

trailing whitespace (trailing-whitespace)

The easiest way to to this is to go to the Orchestration Gateway admin settings and click "Register new Budibase webhook":

.. image:: images/new_budibase.png
:alt: Orchestration Gateway dialog for registering a Budibase webhook

Here you can fill in the event you want your automation to be started by and the schema URL, and then send the schema. Budibase will show 4 detected bindings upon successful sending. You can then fill in the trigger URL provided by Budibase, all needed filters and the authentication tokens that should be included in the callback, and save.
As soon as you have your automation deployed, it will now be triggered every time your chosen event happens in Nextcloud.



Use payload information in bindings
-----------------------------------

For every event, there are 4 bindings registered in Budibase:

* ``user``: the user that triggered the Nextcloud event
* ``time``: a timestamp for the triggering
* ``event``: an array containing additional information about the event (see the :ref:`list of webhook events<webhook_events>` for details)
* ``authentication``: the requested authentication tokens

These bindings can be used in any step of your automation to use the information given by the callback.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 122 additions & 7 deletions admin_manual/webhook_listeners/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,33 @@

occ app:enable webhook_listeners

Listening to events
-------------------
Managing webhooks
-----------------

You can use the OCS API to add webhooks for specific events. See:
You can either use the OCS API to manage your webhooks or install the additional ``orchestration_gateway`` app to have a graphical user interface for adding, changing and deleting webhooks.

the Orchestration Gateway adds an administration settings page listing your registered webhooks and making it easy to configure them.

.. image:: images/list_webhooks.png
:alt: Orchestration Gateway settings showing a list of registered webhooks

To add a new one, you can choose between a generic new webhook or a Budibase-specific one.

Check failure on line 49 in admin_manual/webhook_listeners/index.rst

View workflow job for this annotation

GitHub Actions / Lint RST files

trailing whitespace (trailing-whitespace)


.. image:: images/new_webhook.png
:alt: Orchestration Gateway dialog for adding a new webhook


If you want to use the OCS API to add webhooks for specific events, see:
`Register a new webhook <https://docs.nextcloud.com/server/latest/developer_manual/_static/openapi.html#/operations/webhook_listeners-webhooks-index>`_.

Note: When authenticating with the OCS API to register webhooks, the account you
use must have administrator rights or delegated administrator rights.
.. note::

Check failure on line 60 in admin_manual/webhook_listeners/index.rst

View workflow job for this annotation

GitHub Actions / Lint RST files

trailing whitespace (trailing-whitespace)
When authenticating with the OCS API to register webhooks, the account you use must have administrator rights or delegated administrator rights. To delegate the webhook registration to non-admin users, they have to be in a group that gets administration privileges for "Webhooks" granted. To use the Orchestration Gateway UI, they need *additional* privileges for "Orchestration Gateway".

Listing registered webhooks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Listing registered webhooks via occ
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can list all currently registered webhook listeners from the command line:

Expand Down Expand Up @@ -203,6 +219,8 @@

It is recommended to restart this worker at least once a day to make sure code changes are effective and avoid memory leaks, in this example the service restarts every 60 seconds.

.. _webhook_events:

Nextcloud Webhook Events
------------------------

Expand Down Expand Up @@ -577,7 +595,104 @@
"time": 1700054321,
}


Mail App Events
~~~~~~~~~~~~~~~~~
Mail events use different distinct payload formats, depending on the event.
When the optional ``mail`` app is installed:

- ``NewMessageReceivedEvent``

.. code-block:: json

{
"event": {
"class": "OCA\\Mail\\Event\\NewMessageReceivedEvent",
"accountId": 34,
"inReplyToRfcMessageId": "5888857",
"mailboxId": 10,
"messageId": 108778,
"messageUri": "89789789",
"RfcMessageId": "897789",
"sentAt": "1787826765",
"subject": "Important data changes",
"threadRootId": "9947988"
},
"user": {
"uid": "carol",
"displayName": "Carol"
},
"time": 1787826832,
}


- ``MessageSentEvent``

.. code-block:: json

{
"event": {
"class": "OCA\\Mail\\Event\\MessageSentEvent",
"accountId": 34,
"inReplyToRfcMessageId": "5888857",
"sendAt": "1787826765",
"subject": "Important data changes"
},
"user": {
"uid": "carol",
"displayName": "Carol"
},
"time": 1787826832,
}


- ``MessageFlaggedEvent``

.. code-block:: json

{
"event": {
"class": "OCA\\Mail\\Event\\MessageFlaggedEvent",
"accountId": 34,
"flag": "Spam",
"mailboxId": 10,
"messageId": 108778,
"set": true,
"uid": 897789
},
"user": {
"uid": "carol",
"displayName": "Carol"
},
"time": 1787826832,
}


- ``MessageDeletedEvent``

.. code-block:: json

{
"event": {
"class": "OCA\\Mail\\Event\\MessageDeletedEvent",
"accountId": 34,
"mailboxId": 10,
"uid": 108778
},
"user": {
"uid": "carol",
"displayName": "Carol"
},
"time": 1787826832,
}

.. note::

For filtering or automation, always check the actual payload you receive, as it matches
the JSON examples above, not PHPDoc or internal PHP array type style.


.. toctree::
:maxdepth: 2

budibase_workflows

Check failure on line 698 in admin_manual/webhook_listeners/index.rst

View workflow job for this annotation

GitHub Actions / Lint RST files

No newline at end of file. (missing-final-newline)
1 change: 1 addition & 0 deletions go.php/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ <h1>Redirecting to documentation...</h1>
'admin-windows-compatible-filenames': '/admin_manual/configuration_files/windows_compatible_filenames.html',
'admin-workflowengine': '/admin_manual/file_workflows/index.html',
'admin-android-deep-link-handling': '/admin_manual/configuration_server/android_deep_link_handling.html',
'admin-webhook-listeners': 'admin_manual/webhook_listeners/index.html',

'developer-manual': '/developer_manual',
'developer-backports': '/developer_manual/getting_started/development_process.html#bugfixes',
Expand Down
Loading