Skip to content

zoom/webhook-to-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zoom Webhook to Postgress Sample App

The use of this sample app is subject to our Terms of Use

This is a sample app using a Webhook Only App to send events to a PostgreSQL Database.

Prerequisites

  1. Node JS
  2. Ngrok
  3. PostgreSQL
  4. Zoom Account
  5. Webhook only app credentials
    • Account ID
    • Client ID
    • Client Secret

Getting started

Open your terminal:

# Clone down this repository
git clone https://github.com/zoom/webhook-to-postgres

# Navigate into the cloned project directory
cd mywebhook-app 

# Run NPM to install the app dependencies
npm install

# initialize your ngrok session
ngrok http 3000

Create your Webhook Only App

In your web browser, navigate to Zoom Developer Portal and register/log into your developer account.

Click the "Build App" button at the top and choose "Webhook Only" application, give it a name and click "Create"

Screen Shot 2022-08-23 at 5 38 26 PM

Follow allong with Using Webhook documentation as we set this up:

Using Webhooks

Config: Information

The following information is required to activate your application:

- Basic Information
    1. App name
    2. Short description
    3. Company name
- Developer Contact Information 
    1. Name 
    2. Email address

Config: App Features

  1. Name your particular event (Subscription name)
  2. Add the event notification endpoint URL, followed by /webhook (In your terminal where you launched ngrok find the forwarding https value and copy/paste that here)
  3. Click "+ Add Events" and from the Meeting tab, select "Meeting has been created" and "Meeting has been deleted" events and click Done
  4. Lastly, navigate to the Activation tab and make sure your app is activaded

Config .env

Open the .env file in your text editor and enter the following information from the Feature section you just configured.

# Zoom Secret token from your Webhook only app
ZOOM_WEBHOOK_SECRET_TOKEN=

# PostgreSQL credentials and information (you will come back and fill up this information after we set up our database)
PORT=
PG_USER=
PG_HOST=
PG_DATABASE=
PG_PASSWORD=
PG_PORT=

Config: Creating Database

If you already have postgress installed in your local environment you can skip these steps, if not follow along to install pg and create a table in your database.

brew install postgresql

After the installation is complete, we’ll want to get postgresql up and running, which we can do with services start

brew services start postgresql

With PostgreSQL now installed, we will connect to the default postgres database running

psql postgres

We are now inside psql in the postgres database, you will see the prompt ends with an # to denote that we are logged in as the superuser, or root (postgres=#)

Commands within psql start with a backlash . To test this, we can check what database, user and por we have connected to using the \conninfo command

postgres=# \conninfo

Creating a role in Postgres

We are going to create a role called "me" and give it a password of "password":

postgres=# CREATE ROLE me WITH LOGIN PASSWORD 'password';

And we want "me" to be able to create a database:

postgres=# ALTER ROLE me CREATEDB;

Now, we will create a database for the "me" user. Exit from the default session with \q for quit and now we will connect postgres with "me"

psql -d postgres -U me

We can create a database with the SQL command as follows:

CREATE DATABASE zoomwebhooks;

Connect to the new database

\c zoomwebhooks

You are now connected to database "zoomwebhooks" as a user "me".

Creating a table in Postgres

Finally, in the psql command prompt, we will create a table called events with four fields, two VARCHAR types, one BIGINT type and an auto-incrementing PRIMARY KEY ID:

CREATE TABLE events (
  ID SERIAL PRIMARY KEY,
  name VARCHAR(30),
  accountid VARCHAR(30),
  meetingid BIGINT
);

We have finished with all our PostgreSQL tasks and make sure to add the credentials in your .env file. Now it is time to get our app up and running!

Start the App

Using your app

Run the npm script to start your application.

npm run start

While your app is running on port 3000, go to the WebPortal here and create a meeting or delete an existing meeting in your account. Once you do this, you will see the event printed in your console and as well a new instance created in your Postgress database.

You can add as many events as you want and they all will be stored in your database.

Happy coding!

Need help?

If you're looking for help, try Developer Support or our Developer Forum. Priority support is also available with Premier Developer Support plans.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published