feat: Add event subscription option to webhooks (#4540)

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Pranav Raj S
2022-04-25 17:44:42 +05:30
committed by GitHub
parent fa51fd1d73
commit 899176a793
25 changed files with 552 additions and 359 deletions

View File

@@ -0,0 +1,12 @@
class AddSubscriptionsToWebhooks < ActiveRecord::Migration[6.1]
def change
add_column :webhooks, :subscriptions, :jsonb, default: %w[
conversation_status_changed
conversation_updated
conversation_created
message_created
message_updated
webwidget_triggered
]
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_04_18_094715) do
ActiveRecord::Schema.define(version: 2022_04_24_081117) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
@@ -763,6 +763,7 @@ ActiveRecord::Schema.define(version: 2022_04_18_094715) do
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.integer "webhook_type", default: 0
t.jsonb "subscriptions", default: ["conversation_status_changed", "conversation_updated", "conversation_created", "message_created", "message_updated", "webwidget_triggered"]
t.index ["account_id", "url"], name: "index_webhooks_on_account_id_and_url", unique: true
end