Feedbacky Backend
Introduction
- You need to edit your backend to pass the requests to Feedbacky Api
- NOTE! If you enabled Public on the Feedbacky Panel you can skip these steps and you can use https://feedbacky.appysode.com/api/feedback/create?id=${APP_ID} directly.
Getting Started
The Main Idea
- You need to create a proxy that redirects the requests to https://feedbacky.appysode.com/api
Api
- The feedbacky-button uses the url props for the request. So, the urls must be matched.
- Feedbacky Api uses /api/feedback/create to receive a feedback.
- So, if you don't want to use /api/feedback for the proxy you need to send it https://feedbacky.appysode.com/api/feedback/create
Example
NodeJS
- Note! You need to create the proxy before you create bodyParser. It breaks createProxyMiddleware
import express from "express";
import { createProxyMiddleware } from "http-proxy-middleware";
const app = express();
const FEEDBACKY_API = "https://feedbacky.appysode.com/api";
const FEEDBACKY_ID = `THE ID YOU COPPIED FROM THE PANEL`;
const FEEDBACKY_SECRET = `THE SECRET YOU COPPIED FROM THE PANEL`;
const feedbackyMiddleware = createProxyMiddleware({
target: FEEDBACKY_API,
changeOrigin: true,
ws: false,
logLevel: "debug",
onProxyReq: (proxyReq) => {
if (proxyReq.path.indexOf("?") > -1) {
proxyReq.path += `&id${FEEDBACKY_ID}&secret=${FEEDBACKY_SECRET}`;
} else {
proxyReq.path += `?id${FEEDBACKY_ID}&secret=${FEEDBACKY_SECRET}`;
}
},
});
app.use(express.json());
app.use("/api/feedback", feedbackyMiddleware);