Events in GitBook occur when specific actions occur in a GitBook Space or environment. Your integration can tap into these events, read information about them, and dispatch actions as they occur.
They are declared within the createIntegration
call, and should return async callback functions for the events you would like to listen to.
Example:
export default createIntegration({
events: {
space_view: async (event, context) => {
// Handle event when the space your integration is installed in is viewed
},
},
});
The following events can be read on the event
object passed into the arguments of the callback functions run when the event occurs.
Event received when integration has been installed or updated.
Key | Description |
---|---|
eventId | The id of the event |
type | The type of event fired |
installationId | The id of the installation event |
status | The status of the installation event |
Event received when integration has been installed or updated on a space.
Key | Description |
---|---|
eventId | The id of the event |
type | The type of event fired |
installationId | The id of the installation event |
spaceId | The id of the space the installation event occured in |
status | The status of the installation event |
Event received when a page has been visited.
Key | Description |
---|---|
eventId | The id of the event |
type | The type of event fired |
pageId | |
visitor | anonymousId cookies userAgent ip |
url | |
referrer |
Event generated when rendering a UI
Key | Description |
---|---|
eventId | The id of the event |
type | The type of event fired |
auth | userId |
componentId | |
props | |
state | |
context | |
action |
Event when the primary content of a space has been updated.
Key | Description |
---|---|
eventId | The id of the event |
type | The type of event fired |
Event when the visibility of the space has been changed.
Key | Description |
---|---|
eventId | The id of the event |
type | The type of event fired |
visibility | |
previousVisibility |
Event when a GitSync operation has been completed.
Key | Description |
---|---|
eventId | The id of the event |
type | The type of event fired |
state | |
revisionId | |
commitId |
Event when a GitSync operation has been started.
Key | Description |
---|---|
eventId | The id of the event |
type | The type of event fired |
revisionId | |
commitId |