Skip to content

Instantly share code, notes, and snippets.

@FelixEhuan
Last active June 22, 2020 03:57
Show Gist options
  • Save FelixEhuan/28eae8d3fc3b12919a52109d6b4733b3 to your computer and use it in GitHub Desktop.
Save FelixEhuan/28eae8d3fc3b12919a52109d6b4733b3 to your computer and use it in GitHub Desktop.
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
import * as request from 'request-promise';
const ACTIVE_KEY = 'SOME-KEY'
export const callableFunction = () => functions.https.onCall( (data) => {
const data = snapshot.data();
const options = {
method: 'POST',
uri: ' https://travelcoach.api-us1.com/api/3/contacts',
headers: {
'Api-Token': ACTIVE_KEY
},
body: { data },
json: true // Automatically parses the JSON string in the response
};
return await request(options);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment