Skip to content

Change: send events to webhook as JSON with a schema.#1563

Merged
arikfr merged 3 commits intomasterfrom
json_webhook
Feb 5, 2017
Merged

Change: send events to webhook as JSON with a schema.#1563
arikfr merged 3 commits intomasterfrom
json_webhook

Conversation

@arikfr
Copy link
Copy Markdown
Member

@arikfr arikfr commented Feb 2, 2017

Example of resulting event:

{
   "data":{
      "user_id":null,
      "created_at":"2017-02-02T08:08:15+02:00",
      "object_type":"test",
      "org_id":1,
      "object_id":null,
      "additional_properties":{
         "test":1
      },
      "action":"test"
   },
   "schema":"iglu:io.redash.webhooks/event/jsonschema/1-0-0"
}

Closes #1552.

@arikfr
Copy link
Copy Markdown
Member Author

arikfr commented Feb 2, 2017

@alexanderdean there are two changes here from your schema:

  • No id field. I prefer to not include it, in case in the future we might not store these events to the local database. If you still want an ID for deduplication purposes, we can add UUID maybe?
  • additional_properties is an object and not a string field.

@alexanderdean
Copy link
Copy Markdown

alexanderdean commented Feb 2, 2017

Sounds good @arikfr - I've added snowplow/iglu-central#484

Snowplow can't (yet) deduplicate webhook events based on webhook-specific fields, so no rush to add in an event UUID from our side (I agree however that it's better to expose a UUID than a current local database sequence)...

@arikfr arikfr merged commit 01a8075 into master Feb 5, 2017
@arikfr arikfr deleted the json_webhook branch February 5, 2017 08:36
@alexanderdean
Copy link
Copy Markdown

Not a deal-breaker but I would probably emit the created_at using UTC - so in this case it would be:

"created_at":"2017-02-02T06:08:15Z",

It's slightly more compact, and less brittle - the TZ of the instance running Redash shouldn't be significant at analytics time...

@arikfr
Copy link
Copy Markdown
Member Author

arikfr commented Feb 12, 2017

In most deployments the server time will be UTC anyway. I'll change it to be UTC regardless, but I guess it's less urgent.

@alexanderdean
Copy link
Copy Markdown

Makes sense - thanks @arikfr !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants