Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
users.js
// forest/users.js const Liana = require('forest-express-sequelize'); Liana.collection('users', { actions: [ { name: 'Notify with slack', type: 'single', }, ], });
// routes/users.js const express = require('express'); const router = express.Router(); const Liana = require('forest-express-sequelize'); const models = require('../models'); const Liana = require('forest-express-sequelize'); const superagent = require('superagent'); router.post( '/actions/notify-with-slack', Liana.ensureAuthenticated, async (request, response) => { const { query, user } = request; const [userId] = await new RecordsGetter( models.user, user, query ).getIdsFromRequest(request); try { await superagent .post('https://user.app.nn.cloud/webhook/123456/abcde/') .send({ userId }); response.send({ success: 'Called webhook' }); } catch (e) { return response .status(400) .send({ error: `Failure calling webhook: ${e.message}` }); } } ); module.exports = router;