← Back to Blog
pythonslackbotgoogle-meetflaskautomation

Slack-Based Google Meet Integration System

Slack-Based Google Meet Integration System

Tired of alt-tabbing out of Slack to create a Google Meet? This integration lets your team type /meeting in any Slack channel and instantly get a meeting link — without ever leaving the app.


How It Works

text
User types /meeting in Slack

Slack sends POST request to Flask endpoint

Flask calls Google Calendar API

Calendar creates event with Meet conference

Meet link returned to Slack channel

Prerequisites

  • Python 3.8+
  • A Slack workspace (admin access)
  • A Google Cloud project with Calendar API enabled
  • ngrok for local tunnelling during development

Setup

1. Install dependencies

bash
pip install flask slack-sdk google-auth google-auth-oauthlib google-api-python-client python-dotenv

2. Environment variables

SLACK_SIGNING_SECRET=your_slack_signing_secret
SLACK_BOT_TOKEN=xoxb-your-bot-token
GOOGLE_CREDENTIALS_FILE=credentials.json

Google Calendar API Setup

  1. Go to Google Cloud Console
  2. Create a project → Enable Google Calendar API
  3. Create OAuth 2.0 credentials → Download credentials.json
  4. Add your Google account as a test user in the OAuth consent screen
python
# auth.py
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
import os, pickle

SCOPES = ['https://www.googleapis.com/auth/calendar']

def get_credentials():
    creds = None
    if os.path.exists('token.pickle'):
        with open('token.pickle', 'rb') as token:
            creds = pickle.load(token)

    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file(
                'credentials.json', SCOPES
            )
            creds = flow.run_local_server(port=0)
        with open('token.pickle', 'wb') as token:
            pickle.dump(creds, token)

    return creds

Meet Link Generator

python
# meet.py
from googleapiclient.discovery import build
from datetime import datetime, timedelta, timezone
import uuid
from auth import get_credentials


def create_meet_link(title: str = "Quick Meeting") -> str:
    creds = get_credentials()
    service = build('calendar', 'v3', credentials=creds)

    now = datetime.now(timezone.utc)
    event = {
        'summary': title,
        'start': {
            'dateTime': now.isoformat(),
            'timeZone': 'UTC',
        },
        'end': {
            'dateTime': (now + timedelta(hours=1)).isoformat(),
            'timeZone': 'UTC',
        },
        'conferenceData': {
            'createRequest': {
                'requestId': str(uuid.uuid4()),
                'conferenceSolutionKey': {'type': 'hangoutsMeet'},
            }
        },
    }

    result = service.events().insert(
        calendarId='primary',
        body=event,
        conferenceDataVersion=1,
    ).execute()

    return result['hangoutLink']

Flask Endpoint

python
# app.py
from flask import Flask, request, jsonify
from slack_sdk.signature import SignatureVerifier
from meet import create_meet_link
import os
from dotenv import load_dotenv

load_dotenv()

app = Flask(__name__)
verifier = SignatureVerifier(os.environ['SLACK_SIGNING_SECRET'])


@app.route('/meeting', methods=['POST'])
def meeting():
    # Verify the request is genuinely from Slack
    if not verifier.is_valid_request(request.get_data(), request.headers):
        return jsonify({'error': 'Invalid request'}), 403

    user_name = request.form.get('user_name', 'Someone')
    channel = request.form.get('channel_name', 'your channel')

    try:
        meet_link = create_meet_link(f"Meeting from #{channel}")
        return jsonify({
            'response_type': 'in_channel',
            'text': f'🎥 *{user_name}* started a meeting:\n{meet_link}',
        })
    except Exception as e:
        return jsonify({
            'response_type': 'ephemeral',
            'text': f'❌ Could not create meeting: {str(e)}',
        })


if __name__ == '__main__':
    app.run(debug=True, port=3000)

Slack App Configuration

1. Create the app

Go to api.slack.com/apps → Create New App → From Scratch.

2. Add a slash command

Navigate to Slash Commands → Create New Command:

Field Value
Command /meeting
Request URL https://your-ngrok-url.ngrok.io/meeting
Short Description Create a Google Meet link

3. Expose your local server with ngrok

bash
ngrok http 3000

Copy the HTTPS URL → paste it into Slack's Request URL field.

4. Install the app to your workspace

OAuth & Permissions → Add scopes: commands, chat:write → Install to Workspace.


Test It

Start your server:

bash
python app.py

In any Slack channel, type:

text
/meeting

You'll see a response like:

text
🎥 prakash started a meeting:
https://meet.google.com/abc-defg-hij

Challenges & Solutions

ngrok URL resets on restart — Use a paid ngrok plan for a static URL, or deploy to a server (Render, Railway free tier work well).

OAuth token expiry — The token.pickle approach handles refresh automatically. For production, store credentials in a database.

Timezone issues — Always use UTC internally and convert for display.


Production Deployment

For production, replace ngrok with a real server:

bash
# Deploy to Railway
railway login
railway init
railway up

Update the Slack slash command Request URL to your production domain.


What's Next

  • Add a meeting title parameter: /meeting Weekly Standup
  • Send a calendar invite to participants mentioned in the command
  • Log meetings to a Google Sheet for tracking
  • Build a full Slack bot with multi-step conversations using Bolt for Python
Share this article
← Back to all articles