Manage webhooks across neeto products.
The neeto-webhooks-nano manages webhooks within neeto applications. The nano
exports the @bigbinary/neeto-webhooks-frontend NPM package
and neeto-webhooks-engine Rails engine for development.
1. Development with Host Application
- Engine
- Installation
- Usage
- Frontend package
- Installation
- Components
2. Instructions for Publishing
The engine is used to manage webhooks across neeto products.
1. Add this line to your application's Gemfile:
``ruby
source "NEETO_GEM_SERVER_URL" do
# ..existing gems
gem 'neeto-webhooks-engine'
# Use this for live development:
# gem 'neeto-webhooks-engine', path: "../neeto-webhooks-nano"
end
`
2. And then execute:
`zsh`
bundle install
config/routes.rb
3. Add this line to your application's file:`
ruby`
mount NeetoWebhooksEngine::Engine, at: "/neeto_webhooks"
/neeto_webhooks
NOTE: The mount point must be and cannot be changed to any other path.`
4. Run the following command to copy the migrations from the engine to the host
application:
zsh`
rails g neeto_webhooks_engine:install
`
5. Add the migrations to the database:
zsh`
bundle exec rails db:migrate
6. Add the following line to application's
config/initializer/neeto_webhooks_engine.rb file. Replace the
event_identifiers with an array of unique keywords representing possible
webhook events.
`zsh`
NeetoWebhooksEngine.event_identifiers = ["create", "update", "cancel"]
7. Add translations for the webhook events using the key format
webhooks.events.webhook_event, where webhook_event is the custom-defined
event_identifier.
`zsh`
webhooks:
events:
create: "Booking creation"
update: "Booking reschedule"
cancel: "Booking cancellation"
8. (Optional) Configure taxonomy identifiers to automatically inject taxonomy
values into translation strings. The values can then be used in locale strings
as interpolation variables.
`ruby`
NeetoWebhooksEngine.taxonomy_identifiers = {
customer: "singular",
teamMember: "singular"
}
9. Add the permission neeto_webhooks_engine.manage_webhooks to yourpermissions.yml
file.
You can learn more about the setup and usage here:
1. Models
2. Webhook Versioning Implementation
1. Install the latest neeto-webhooks-nano package using the below command:`
zsh`
yarn add @bigbinary/neeto-webhooks-frontend
Check the
Frontend package development guide
for step-by-step instructions to develop the frontend package.
#### NeetoWebhooks (source code)
This component is used to manage webhooks in your web application.
1. It provides a user interface for viewing, adding, and editing webhooks.
2. It also includes a user interface for listing deliveries and viewing delivery
details, featuring tabs that display both request and response information.
##### Props
- entityId: Specifies the ID of the entity.entityType
- : Specifies the type of the entity.
##### Optional Props
- breadcrumbs: An array of objects that specify breadcrumbs for navigation.helpLinkUrls
- : An object that specifies the URLs for the help links.webhooks
- : The URL for the webhooks help link.secrets
- : The URL for the secrets help link.deliveries
- : The URL for the deliveries help link.
##### Usage
`jsx
import React from "react";
import { NeetoWebhooks } from "@bigbinary/neeto-webhooks-frontend";
import { routes } from "common/routes";
import { BrowserRouter, Route, Switch } from "react-router-dom";
import { ToastContainer } from "react-toastify";
const Main = () => (
component={() => (
entityType={entityType}
breadcrumbs={[
{
text: "Settings",
link: routes.settings,
},
{ text: "Webhook" },
]}
helpLinkUrls={{
webhooks:
"https://help.neetokb.com/articles/creating-a-webhook",
secrets:
"https://help.neetokb.com/articles/securing-webhook-requests",
deliveries:
"https://help.neetokb.com/articles/managing-webhook-deliveries",
}}
/>
)}
/>
);
export default Main;
``
Consult the
building and releasing packages
guide for details on how to publish.