Giter Club home page Giter Club logo

line-backup-files-to-google-drive's Introduction

# Line Messaging API with Google Drive Integration

Introduction

This project integrates Line Messaging API with Google Drive for handling various file types such as images, videos, audios, and other files.

Constants and Configuration

  • CHANNEL_TOKEN: Your Line Messaging API channel token.
  • GDRIVE_FOLDER_ID: Google Drive folder ID for storing general files.
  • GDRIVE_FOLDER_IMAGE_ID: Google Drive folder ID for storing image files.
  • GDRIVE_FOLDER_VIDEO_ID: Google Drive folder ID for storing video files.
  • GDRIVE_FOLDER_AUDIO_ID: Google Drive folder ID for storing audio files.

Functions

replyMsg(replyToken, messages)

This function sends a reply message using Line Messaging API.

toDrive(messageId, meType, mType, gdriveId)

This function uploads a file to Google Drive and returns the file's Google Drive link.

handleFileMessage(event)

This function handles file messages received through Line Messaging API, uploads the file to Google Drive, and sends a reply message with the file link.

getMimeType(fileType)

This function retrieves the MIME type of a file based on its extension.

doPost(e)

This function is the entry point for handling incoming HTTP POST requests, primarily from Line Messaging API events. It processes different types of messages (file, image, video, audio) and triggers appropriate actions.

Usage

  1. Replace the placeholder values (XXXXX) in the constants with your actual tokens and IDs.
  2. Deploy the script to your preferred hosting platform.
  3. Configure Line Messaging API to send incoming messages to the deployed endpoint (doPost function).
  4. Use Line Messaging API to interact with the integrated Google Drive functionality, such as uploading and retrieving files.

line-backup-files-to-google-drive's People

Contributors

secretmans 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.