Created
October 25, 2016 14:05
-
-
Save MappingKat/95a80a264c73cbf4e425f1ac96b6ac09 to your computer and use it in GitHub Desktop.
block-1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// `express` is a minimal and flexible web application framework that helps with routing logic. | |
var express = require('express'); | |
// `fulcrumMiddleware` is a library that lets you take some shortcuts for setting up Fulcrum webhooks. | |
var fulcrumMiddleware = require('connect-fulcrum-webhook'); | |
// `request` allows you to make REST calls to APIS so that you can get, add, update or delete data. | |
var request = require('request'); | |
// setting up the local port to listen on | |
var PORT = process.env.PORT || 9000; | |
// setting up the express framework | |
var app = express(); | |
function payloadProcessor (payload, done) { | |
if (payload.data.form_id && payload.data.form_id === "{FULCRUM FORM ID}"){ | |
if (payload.type === "record.create") { | |
createRecord(payload, done); | |
} else if (payload.type === "record.update") { | |
updateRecord(payload, done); | |
} else if (payload.type === "record.delete") { | |
deleteRecord(payload, done); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment