/firebase-for-twitter-api

Twitter APIを firebase cloud functionsで簡単に叩けるようにするものです。

Primary LanguageJavaScript

firebase-for-twitter-api

Tool to enable easy use of Twitter API from Firebase Cloud Function

Prerequisitte

  • creation of Firebase project
  • know how to use Cloud Functions for Firebase
    • If you are unsure, read this

Usage

Deploy functions

  • git clone https://github.com/kazuyaseki/firebase-for-twitter-api
  • cd firebase-for-twitter-api/functions
  • npm install or yarn install
  • modify setting files
    • set your project name to .firebaserc
    • set your consumer_key and consumer_secret of Twitter API inside functions/index.js
  • firebase deploy --only functions

Add case

search for the function you want from the API reference

add your function to index.js as follows. replace function name and url accordingly.

exports.your_function_name = functions.https.onRequest((request, response) => {
  cors((request, response) => {
    callApi(request, response, 'URL of the API you want to call');
  });
});