Tutorial to write a complete Slack integration from scratch.
The GitBook Integration Platform is currently in alpha. It's not opened to developers just yet.
This guide will show you how to build an integration in GitBook that can authenticate the user with OAuth and handle events from GitBook to trigger actions on the external service (Slack).
For a complete code source reference, you can check out the official Slack integration's code: https://github.com/GitbookIO/integrations/tree/main/integrations/slack.
After following the Quickstart guide to install and configure the GitBook CLI, you can create a new integration:
gitbook new ./my-slack
The CLI will prompt you to enter a title and to select scopes, choose the scopes
space:contentto ensure the integration can listen to the
Now that our integration can be edited locally, it's time to implement a flow to let the user authenticate themselves.
To do so, we are going to make 2 changes:
- Create a configuration in our
gitbook-manifest.yamlfile to indicate how the Slack credentials should be stored.
- Implement an OAuth HTTP flow
gitbook-manifest.yamlfile to define the following configuration:
description: Authorization between Slack and GitBook.