This application allows you to integrate Google Drive to your Mattermost instance, letting you:
- Share a Google Drive link
- Connect your Google Drive account
Use Google Drive in Mattermost
- Create a Google Drive file
- Share a Google Drive file
- View and reply to comments
- Publish on Google Drive any file attached to a Mattermost post
Manage Google Drive notifications
- Enable or disable notifications for all files
To install, as a Mattermost system admin user, run the command /apps install http GOOGLE_API_URL
in any channel. The /drive
command should be available after the configuration has been successfully installed.
The GOOGLE_API_URL
should be replaced with the URL where the Google Drive API instance is running. Example: /apps install http https://myapp.com/manifest.json
To install, as a Mattermost system admin user, run the command /apps install listed drive
in any channel. The /drive
command should be available after the configuration has been successfully installed.
- Create a new Project. You would need to redirect to Google Cloud Console and select the option to New project. Then, select the name and the organization (optional).
- Select APIs. After creating a project, on the left side menu on APIs & Services, then, select the first option Enabled APIs & Services and wait, the page will redirect.
- From the left menu select Library and activate:
- Google Drive API
- Google Docs API
- Google Slides API
- Google Sheets API
- Go back to APIs & Services menu.
- Create a new OAuth consent screen. Select the option OAuth consent screen on the menu bar. If you would like to limit your application to organization-only users, select Internal, otherwise, select External option, then, fill the form with the data you would use for your project.
- Go back to APIs & Services menu.
- Create a new Client. Select the option Credentials, and on the menu bar, select Create credentials, a dropdown menu will be displayed, then, select OAuth Client ID option.
- Then, a select input will ask the type of Application type that will be used, select Web application, then, fill the form, and on Authorized redirect URIs introduce this URI: https://<your_mattermost_instance>/plugins/com.mattermost.apps/apps/Drive/oauth2/remote/complete
- After the Client has been configured, on the main page of Credentials, on the submenu OAuth 2.0 Client IDs will be displayed the new Client and the info can be accessible whenever you need it.
After installing) the app and creating a project):
- As a Mattermost system admin user, run the
/drive configure
command. - In the configuration modal, enter your Client ID, Client Secret and Service Account.
- Client ID and Client Secret: Used to generate the link to let the user connect with their Google Drive account.
- Service Account: Is the way the app will get the credentials to manage webhook notifications
/drive configure:
: This command will enable the connect and disconnect commands, that will allow the user to link with their Google Drive account. Client ID and Client Secret will be asked.
/drive help
: This command will show all current commands available for this application./drive connect
: This command will create a new link, after clicked it will be redirected to select the Google account that will be used to execute all the available actions./drive create [docs | slide | sheets]
: This command will display a new modal where the data will be asked.- Title: Name of the file to be created
- Message: Optional, only if a file is shared on the channel
- File Access: Choose to share with members on the channel, anyone with the link or keep it private.
/drive notifications [start | stop]
: This command will start or stop the notifications. After a user has executed/drive connect
command, notifications will start on the private channel with the user.
Save file on Drive:
: This option is available in any post, but validates that the selected post has any files on it, in case there is no files, an error message will appear. If the post has any files, a new modal will appear to let the user select the files that would like to be uploaded. After the action is done, a new post will appear as part of the thread to let you notified of the action.
- Download the latest repository release.
- You need to have installed at least node version 15 and maximum version 18. You can download the latest lts version of node for the required operating system here https://nodejs.org/es/download/
- Move to the project directory or execute
cd
command to the project directory and executenpm install
with a terminal to download all dependency libraries.
$ npm install
- Update the environment configuration file. The
.env
file must be modified or added to set the environment variables, it must be in the root of the repository.
file: .env
PROJECT=mattermost-app-google-drive
PORT=4005
HOST=http://localhost:4005
Variable definition
- PROJECT: In case of executing the project with Docker using the
.build.sh
file, this variable will be used for the name of the container - PORT: Port number on which the OpsGenie integration is listening
- HOST: Google Drive API usage URL
- Finally, the project must be executed.
$ npm run dev
Or, if you would like to use the Makefile command:
$ make watch
- You need to have Docker installed. You can find the necessary steps to install Docker for the following operating systems:
- Once you have Docker installed, the next step would be to run the
make run-server
command to create the API container and expose it locally or on the server, depending on the case required.
$ make run-server
When the container is created correctly, the API will be running at the url http://127.0.0.1:4005. If Mattermost is running on the same machine, run this slash command in Mattermost to install the app:
/apps install http http://127.0.0.1:4005
To stop the container, execute:
$ make stop-server