<% @page_title = "Set up a Webhook" %> <% content_for :header do %> <%= render "filters/menu" %>
<%= link_to collection_webhooks_path, class: "btn borderless txt-medium", data: { controller: "hotkey", action: "keydown.esc@document->hotkey#click" } do %> Webhooks <% end %>

<%= @page_title %>

<% end %>
<%= form_with model: @webhook, url: collection_webhooks_path, data: { controller: "form" }, html: { class: "flex flex-column gap" } do |form| %>

<%= form.text_field :name, required: true, autofocus: true, class: "input", placeholder: "Name this Webhook…", data: { action: "keydown.esc@document->form#cancel" } %>

<%= form.label :url do %> Payload URL

This is the URL for the app that will receive payloads from Fizzy.

<% end %> <%= form.url_field :url, required: true, pattern: "https?://.*", title: "Must be an http:// or https:// URL", class: "input", placeholder: "https://example.com", data: { action: "keydown.esc@document->form#cancel" } %>
<%= form.label :actions do %> Events

Trigger a call to the Payload URL when these things occur:

<% end %> <%= render "webhooks/form/actions", form: form %>
<%= form.button type: :submit, class: "btn btn--link center txt-medium" do %> Create Webhook <% end %> <%= link_to "Go back", collection_webhooks_path, data: { form_target: "cancel" }, hidden: true %> <% end %>