Manychat to glitch webhook


#1

Hi all
I have got some great help so far, i am using manychat and got a webhook to connect to my glitch.com app and run the database connection, now the thing i need to know now if someone can please help me is how to i pass a request and get the data and add that to the sql query

thanks in advance

this is my code thus far

// server.js
// where your node app starts

// init project
var express = require('express');
var app = express();
const requestPromise = require('request-promise');
 
// we've started you off with Express, 
// but feel free to use whatever libs or frameworks you'd like through `package.json`.

app.use(express.static('public'));

// http://expressjs.com/en/starter/basic-routing.html
app.get("/", function (request, response) {
  response.sendFile(__dirname + '/index.html');
});



//=======================================================================================
//  Get the Client data from database
//=======================================================================================

app.get("/Getcompany", function (request, response) {

const mysql = require('mysql');
const connection = mysql.createConnection({
  host: '**.**.**.**',
  user: '*****',
  password: '*******',
  database: '*******'
});
connection.connect((err) => {
 if (err) throw err;
  console.log('Connected!');
});

});
  // listen for requests :)
var listener = app.listen(process.env.PORT, function () {
  console.log('Your app is listening on port ' + listener.address().port);
});

MOD EDIT: formatting


#2

Hi @Crashmailman, I’ve moved this question to the Coding Help category, since it’s not related to using Glitch specifically.

It might help others help you if we knew a little more about specifically what you’re trying to accomplish and what you’ve tried so far. For instance, to be able to help with a specific sql query its important to know what information are you expecting to pull from the request and how you expect it to show up in your database.