I've done similar work simply by giving a model a database of text, and asking it to do a unit of work for every passage. "Checking for spam" would be the model checking surrounding messages and user's history, likely an opinionated verdict, but would work. Difficulty comes in when those units of work become complex or have to work in tandem, which isn't the case here.