EventHook API and schemas #337
Unanswered
mortenoh
asked this question in
Specs & RFCs
Replies: 1 comment 3 replies
-
How would this work for SMS events? For example, I want to fire a webhook call when a message is POSTed to |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Event Hooks DHIS2-12194
Event hooks represent a way to have external system react to what's happening inside of DHIS2. We are currently at a very early stage but it does now work for
metadata
paths which is the focus for our 2.40 release. All payloads/schemas download should be considered experimental and be changed before release.EventHook
schemaid
name
enabled
true
)source.path
<main-type>.<sub-type>.<id>
for examplemetadata.organisationUnit.bRNvL6NMQXb
source.fields
targets
webhook
TargetHook that does at
POST
with json payload to an external service.type
webhook
url
POST
wil be made here with the event payload)headers
auth
Authorization
header with supplied auth type (see below forapi-token
andhttp-basic
examplesconsole
TargetSimple console logger using
log.info(event)
with the json payload.type
console
EventHook
payload examplesEventHook
with*
field filter listening onmetadata.*
changes. Target iswebhook
withapi-token
auth type.EventHook
with*
field filter listening onmetadata.*
changes. Target iswebhook
withhttp-basic
auth type.Event
schemaThis represent the current
Event
schema that is sent out for every published event. Focus and examples are on metadata (but the general idea should apply everywhere)Given a event hook that listens on
metadata
and has the fieldsid,name
applied a an example event payload currently looks like this.path
id
if applicable to typecreatedAt
meta
Map<>
). For metadata its currently used to tell what type of operation occuredcreate
update
delete
but what exactly else should be there, or if there is a better way of doing this is up to debateobject
OrganisationUnit
so this is that object with field filtering applied (in the same way you would get this if you did/api/organisationUnits/ID?fields=id,name
)Beta Was this translation helpful? Give feedback.
All reactions