Replying to Avatar Rif'at Ahdi R

Just suggestion, maybe you can add policy rule like this

https://github.com/atrifat/strfry-policies/pull/1

Policy that request external API that you can freely implement later to process the event. I have done this nfrelay.app to filter RplyFamily and impersonator by reading metadata profile.

Simple Policy API server example can be made like this:

```

const express = require('express');

const bodyParser = require('body-parser');

const app = express();

const PORT = 3000;

// Middleware to parse JSON bodies

app.use(bodyParser.json());

// POST route for /spamfilter

app.post('/spamfilter', (req, res) => {

const { input } = req.body; // Destructure input from the request body

const content = input.content; // Assuming content is a property of input

// Simple spam detection logic (for demonstration purposes)

const spamKeywords = ['spam', 'buy now', 'click here'];

const isSpam = spamKeywords.some(keyword => content.includes(keyword));

// Respond with { accept: true } or { accept: false }

if (isSpam) {

return res.status(200).json({ accept: false });

}

res.status(200).json({ accept: true });

});

// Start the server

app.listen(PORT, () => {

console.log(`Server is running on http://localhost:${PORT}`);

});

```

I’ll add it to the list (GH issue) tomorrow and add it when I get time

Reply to this note

Please Login to reply.

Discussion

No replies yet.