Giter Site home page Giter Site logo

dropbox-hooks's Introduction

Dropbox Webhooks

Overview

A Node.js application designed to run custom code in response to events from Dropbox. Specifically, it listens for webhook notifications from Dropbox indicating that files have been added, removed, or changed, and then performs custom actions in response to these events.

Getting Started

Prerequisites

  • Node.js and Yarn installed on your machine
  • A Dropbox App with appropriate permissions
  • Optional: Ngrok for exposing your local development environment to the internet (for receiving webhooks from Dropbox)

Setting Up Your Environment

  1. Install Dependencies Navigate to the project directory and install the required npm packages. Update the .env file with your own Dropbox App Secret and Access Token. These can be found in the Dropbox App Console.

    yarn install && cp .env.example .env
  2. Start the Development Server Use the following command to start the development server. It will restart automatically upon any code changes.

    yarn dev
  3. Expose Your Local Server To receive webhooks from Dropbox, you need to expose your local development server to the internet. You can use Ngrok for this:

    ngrok http 3000

    This will provide you with a public URL that forwards to your local server.

Configuring Dropbox Webhook

  1. Add Webhook URL to Dropbox App Console
    • Go to the Dropbox App Console.
    • Choose your app, or create a new one if necessary.
    • In the settings for your app, find the 'Webhook URIs' section.
    • Add the public URL provided by Ngrok (or your production URL) followed by the webhook endpoint path (e.g., https://<your-url>/dropbox-webhook).

Building the Docker Container

To containerize the application, ensuring it can run in any environment that supports Docker:

  1. Build the Docker Image Run the following command in the project root directory:

    docker build -t my-dropbox-webhooks .
  2. Run the Docker Container After building the image, start a container from the image:

    docker run -p 3000:3000 -e DROPBOX_APP_SECRET=your_dropbox_app_secret -e DROPBOX_ACCESS_TOKEN=your_dropbox_access_token my-dropbox-webhooks

    This will start the application inside a Docker container, listening on port 3000.

Next Steps

You can now extend the application to handle specific Dropbox events according to your needs. Implement the event handlers in the application logic, and ensure they respond as expected to the events emitted by Dropbox.


For further details on the Dropbox API and webhooks, refer to the official Dropbox API documentation.

dropbox-hooks's People

Contributors

nielsmaerten avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.