Added webhook format example to webhook management views

This commit is contained in:
Dan Brown 2021-12-12 18:02:08 +00:00
parent dbd4281ae8
commit 3bf34b6a0d
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
4 changed files with 40 additions and 0 deletions

View File

@ -252,6 +252,8 @@ return [
'webhooks_delete' => 'Delete Webhook',
'webhooks_delete_warning' => 'This will fully delete this webhook, with the name \':webhookName\', from the system.',
'webhooks_delete_confirm' => 'Are you sure you want to delete this webhook?',
'webhooks_format_example' => 'Webhook Format Example',
'webhooks_format_example_desc' => 'Webhook data is sent as a POST request to the configured endpoint as JSON following the format below. The "related_item" and "url" properties are optional and will depend on the type of event triggered.',
//! If editing translations files directly please ignore this in all
//! languages apart from en. Content will be auto-copied from en.

View File

@ -11,6 +11,8 @@
<form action="{{ url("/settings/webhooks/create") }}" method="POST">
@include('settings.webhooks.parts.form', ['title' => trans('settings.webhooks_create')])
</form>
@include('settings.webhooks.parts.format-example')
</div>
@stop

View File

@ -11,6 +11,8 @@
{!! method_field('PUT') !!}
@include('settings.webhooks.parts.form', ['model' => $webhook, 'title' => trans('settings.webhooks_edit')])
</form>
@include('settings.webhooks.parts.format-example')
</div>
@stop

View File

@ -0,0 +1,34 @@
<div component="code-highlighter" class="card content-wrap auto-height">
<h2 class="list-heading">{{ trans('settings.webhooks_format_example') }}</h2>
<p>{{ trans('settings.webhooks_format_example_desc') }}</p>
<pre><code class="language-json">{
"event": "page_update",
"text": "Benny updated page \"My wonderful updated page\"",
"triggered_at": "2021-12-11T22:25:10.000000Z",
"triggered_by": {
"id": 1,
"name": "Benny",
"slug": "benny"
},
"triggered_by_profile_url": "https://bookstack.local/user/benny",
"webhook_id": 2,
"webhook_name": "My page update webhook",
"url": "https://bookstack.local/books/my-awesome-book/page/my-wonderful-updated-page",
"related_item": {
"id": 2432,
"book_id": 13,
"chapter_id": 554,
"name": "My wonderful updated page",
"slug": "my-wonderful-updated-page",
"priority": 2,
"created_at": "2021-12-11T21:53:24.000000Z",
"updated_at": "2021-12-11T22:25:10.000000Z",
"created_by": 1,
"updated_by": 1,
"draft": false,
"revision_count": 9,
"template": false,
"owned_by": 1
}
}</code></pre>
</div>