Web Hooks
About Web Hooks
Web Hooks are an exciting way to be notified when the statuses of your users change in Simple In/Out. Using Web Hooks, Simple In/Out will contact a URL of your choice with a JSON payload containing details about the status change, the user, and more. This has many potential use cases, from Slack-like chat room integrations, to building your own reporting, to integrations with many 3rd party software platforms.
Currently, Simple In/Out supports 3 different events for Web Hooks:
- New Status Update both Now and in the Past (status.new)
- New Scheduled Status Updates (status.schedule)
- Deleted a Status from the Past (status.destroy)
The payloads we send for these are very similar in nature. Here's an example
{ "username": "Bojack Horseman", "icon_url": "http://bojackhorseman.com/avatar.gif", "text": "*In* In Hollywoo", "type": "status.new", "data": { "user_id": "445452", "status": "in", "comment": "In Hollywoo", "created_at": 1448046759, "admin": { "id": "2844", "name": "Princess Carolyn" }, "application": { "id": "84774", "name": "Simple In/Out iOS" } } }
Here are some definitions about these keys/values:
- username: The user's name.
- icon_url: The URL of their avatar used in Simple In/Out.
- text: A plain-text description of what happened in Slack's MarkDown format. Parsing this string is not recommended, if you wish to have the values within instead utilize the other fields.
- type: The type of event that occurred, which currently consists of 'status.new', 'status.schedule', and 'status.destroy', but may be expanding in the future.
- data: An object containing data relevant to the event itself.
Status Web Hooks
Status changes are the use case behind Web Hooks as they currently exist. The 'data' payload in these returns breaks down as follows:
- user_id: A unique string identifying the user
- status: A string identifying the status type, either 'in' or 'out'
- comment: A string containing the optional comment that was included with the status update.
- created_at: When the status occurred. For past status updates, this is the time the status was created for in the past. For scheduled statuses, this is the time the status will be applied in the future, not the time it was just put on the schedule.
- admin: This is an object that contains the unique identifier and name of the other user that made the update, if the status update wasn't created by the actual user.
- application: This is an object that contains the unique identifier and name of the application the user used to that made the update, if the status update wasn't created by the actual user.