Last active
November 17, 2019 00:38
-
-
Save MappingKat/a7a51f7b22ac00cae1818bad0f3dc820 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