As a public space on the internet, Tag Me In expressly welcomes robots to contribute, vote on, or moderate objectionable content.
Tag Me In doesn't have designated human moderators. For that reason, robots are invited to watch for new messages and programmatically remove any objectionable content.
Tag Me In is intended to be a repository of uplifting, positive messages that inspire humanity to reach for greatness. If a message is offensive to you or your organization for any reason, please remove it immediately using the following instructions.
Tag Me In messages are posted to the channel immediately, but don't show up in the news for 30 minutes. This gives robots (or humans) a chance to remove objectionable content before it becomes permanent on Tag Me In. Once a message is posted, humans or robots can "unsend" it until it reaches a score of 5. Since the default message promotion speed is 1 point per hour, and the maximum promotion speed is 10 points per hour, a message may take from half an hour up to 5 hours to reach 5 points (assuming it isn't demoted, in which case it may never reach 5 points).
Here's some facts to consider:
With those facts in mind, let's build a robot to remove messages that match a certain term.
Note: to be sure all messages are screened before reaching 5 points, your bot should run at an interval no greater than every 30 minutes, otherwise the window of opportunity to moderate the message may be missed
If you are using JavaScript, you can find instructions on making network requests on web.dev or mdn web docs.
The first thing your robot should do is get the latest news, including new items that are not yet visible in the user-facing news feed.
GET https://tagme.in/news?include=new
The response should be a JSON object with the following format:
{ "chunkId": 5, "data":[ { "channel": "test", "message": "This is a message to test the news endpoint.", "seen": 1710354293877 }, ... additional messages ... ] }
Up to 100 messages are returned in a single chunk. If there are many messages being posted in quick succession on Tag Me In (i.e. more than 100 per 30 minutes), it you may need to load more than one chunk to get all messages posted within the last 30 minutes. To do so, simply include a chunk parameter decreasing from the "chunkId" property of the JSON response as follows:
GET https://tagme.in/news?include=new&chunk=4
Next, you'll need to identify which messages you'd like to unsend. You should check that the timestamp "seen" property is within the past 30 minutes to be sure that it is possible to unsend the message. In JavaScript, the code might look like this:
const response = await fetch("https://tagme.in/news?include=new") const responseBody = await response.json() // loop through returned messages for (const item of responseBody.data) { // check if the message was posted in the last 30 minutes if (item.seen > Date.now() - 30 * 60 * 1000) { // let's check if we want to remove the message const shouldRemoveMessage = item.message.match(/offensive/i) if (shouldRemoveMessage) { try { await unsendTagMeInMessage(item) } catch (err) { console.error('Something went wrong') console.error(err) } } } }
To unsend a message, we need to make a POST request to https://tagme.in/unsend with a JSON body containing the channel name and the message text to unsend.
POST https://tagme.in/unsend Request headers: Content-Type: application/json Request body: {"channel":"test", "message":"This is a message to test the news endpoint."}
Next, let's define the code to unsend the Tag Me In message:
async function unsendTagMeInMessage(item) { const response = await fetch({ method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ channel: item.channel, message: item.message }) }) if (response.ok) { console.log("Message was unsent") } else { console.error("There was a problem unsending the message") console.error(await response.text()) } }
That's it! We've just built a robot that scans for the word "offensive" and unsends those messages, preventing them from remaining on Tag Me In.
If there is any issue following these instructions, or something could be clarified or improved, or a bug is discovered in Tag Me In, please open an issue or pull request on the Tag Me In GitHub repository or email [email protected] for assistance.