Files
probo/pkg/server/api/console/v1/graphql/webhook.graphql
Sacha Al Himdani 1df4af4556 Add document webhook events
Add a resource-oriented set of webhook events for the document
lifecycle. Each event carries the document plus only the sub-resource
it concerns (version, signature or approval).

Events:
- document.created / updated / archived / unarchived / deleted
- document.version.created / updated / published / rejected / deleted
- document.version.signature.requested / signed / cancelled
- document.version.approval.requested / approved / rejected / voided

Wires the new types through the migration, Go enum, GraphQL schema,
CLI, n8n nodes and the console webhooks settings UI.

Signed-off-by: Sacha Al Himdani <sacha@probo.com>
2026-07-01 17:13:59 +02:00

200 lines
7.1 KiB
GraphQL

enum WebhookEventType
@goModel(model: "go.probo.inc/probo/pkg/coredata.WebhookEventType") {
THIRD_PARTY_CREATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeThirdPartyCreated")
THIRD_PARTY_UPDATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeThirdPartyUpdated")
THIRD_PARTY_DELETED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeThirdPartyDeleted")
USER_CREATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeUserCreated")
USER_UPDATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeUserUpdated")
USER_DELETED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeUserDeleted")
OBLIGATION_CREATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeObligationCreated")
OBLIGATION_UPDATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeObligationUpdated")
OBLIGATION_DELETED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeObligationDeleted")
DOCUMENT_CREATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentCreated")
DOCUMENT_UPDATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentUpdated")
DOCUMENT_ARCHIVED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentArchived")
DOCUMENT_UNARCHIVED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentUnarchived")
DOCUMENT_DELETED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentDeleted")
DOCUMENT_VERSION_CREATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionCreated")
DOCUMENT_VERSION_UPDATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionUpdated")
DOCUMENT_VERSION_PUBLISHED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionPublished")
DOCUMENT_VERSION_REJECTED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionRejected")
DOCUMENT_VERSION_DELETED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionDeleted")
DOCUMENT_VERSION_SIGNATURE_REQUESTED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionSignatureRequested")
DOCUMENT_VERSION_SIGNATURE_SIGNED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionSignatureSigned")
DOCUMENT_VERSION_SIGNATURE_CANCELLED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionSignatureCancelled")
DOCUMENT_VERSION_APPROVAL_QUORUM_REQUESTED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionApprovalQuorumRequested")
DOCUMENT_VERSION_APPROVAL_QUORUM_UPDATED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionApprovalQuorumUpdated")
DOCUMENT_VERSION_APPROVAL_QUORUM_APPROVED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionApprovalQuorumApproved")
DOCUMENT_VERSION_APPROVAL_QUORUM_REJECTED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionApprovalQuorumRejected")
DOCUMENT_VERSION_APPROVAL_QUORUM_VOIDED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventTypeDocumentVersionApprovalQuorumVoided")
}
enum WebhookEventStatus
@goModel(model: "go.probo.inc/probo/pkg/coredata.WebhookEventStatus") {
PENDING
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventStatusPending")
SUCCEEDED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventStatusSucceeded")
FAILED
@goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventStatusFailed")
}
enum WebhookSubscriptionOrderField
@goModel(
model: "go.probo.inc/probo/pkg/coredata.WebhookSubscriptionOrderField"
) {
CREATED_AT
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.WebhookSubscriptionOrderFieldCreatedAt"
)
}
enum WebhookEventOrderField
@goModel(
model: "go.probo.inc/probo/pkg/coredata.WebhookEventOrderField"
) {
CREATED_AT
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.WebhookEventOrderFieldCreatedAt"
)
}
input WebhookSubscriptionOrder
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookSubscriptionOrderBy"
) {
direction: OrderDirection!
field: WebhookSubscriptionOrderField!
}
input WebhookEventOrder
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookEventOrderBy"
) {
field: WebhookEventOrderField!
direction: OrderDirection!
}
type WebhookSubscription implements Node {
id: ID!
organization: Organization @goField(forceResolver: true)
endpointUrl: String!
signingSecret: String! @goField(forceResolver: true)
selectedEvents: [WebhookEventType!]!
createdAt: Datetime!
updatedAt: Datetime!
events(
first: Int
after: CursorKey
last: Int
before: CursorKey
orderBy: WebhookEventOrder
): WebhookEventConnection! @goField(forceResolver: true)
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type WebhookEvent implements Node {
id: ID!
webhookSubscriptionId: ID!
status: WebhookEventStatus!
response: String
createdAt: Datetime!
}
type WebhookSubscriptionConnection
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookSubscriptionConnection"
) {
edges: [WebhookSubscriptionEdge!]!
pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true)
}
type WebhookSubscriptionEdge {
cursor: CursorKey!
node: WebhookSubscription!
}
type WebhookEventConnection
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookEventConnection"
) {
edges: [WebhookEventEdge!]!
pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true)
}
type WebhookEventEdge {
cursor: CursorKey!
node: WebhookEvent!
}
extend type Mutation {
createWebhookSubscription(
input: CreateWebhookSubscriptionInput!
): CreateWebhookSubscriptionPayload!
updateWebhookSubscription(
input: UpdateWebhookSubscriptionInput!
): UpdateWebhookSubscriptionPayload!
deleteWebhookSubscription(
input: DeleteWebhookSubscriptionInput!
): DeleteWebhookSubscriptionPayload!
}
input CreateWebhookSubscriptionInput {
organizationId: ID!
endpointUrl: String!
selectedEvents: [WebhookEventType!]!
}
input UpdateWebhookSubscriptionInput {
id: ID!
endpointUrl: String
selectedEvents: [WebhookEventType!]
}
input DeleteWebhookSubscriptionInput {
webhookSubscriptionId: ID!
}
type CreateWebhookSubscriptionPayload {
webhookSubscriptionEdge: WebhookSubscriptionEdge!
}
type UpdateWebhookSubscriptionPayload {
webhookSubscription: WebhookSubscription!
}
type DeleteWebhookSubscriptionPayload {
deletedWebhookSubscriptionId: ID!
}