Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Feb 5, 2017
Merged

Conversation

arikfr
Copy link
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
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

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

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
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

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