Classify posts with a decision model in Workflows

:bookmark: This guide explains how to use a decision model in Discourse Workflows to classify posts and act on the answers.

:person_raising_hand: Required user level: Administrator

The Classify node asks a decision model questions about each item, such as a new post. It adds the answers to the item so later nodes can act on them.

Decision models return probabilities, not prose. They are faster and cheaper than an AI agent for yes/no and pick-one decisions.

Before you start

  • Workflows is enabled. It’s available on the Business and Enterprise plans.
  • A decision model is configured. Hosted sites have one already. Otherwise, see Configure a decision model.

The Classify node appears once a decision model exists.

Example: send help-desk auto-replies to review

When a user signs up with a help-desk address, notification emails can come back as posts like “Your ticket has been created”. This workflow sends them to the review queue.

  1. Create a workflow with the Post created trigger.

  2. Add Classify:

    • Decision model: your model
    • Text: keep the default, {{ $json.post.raw }}
    • Add a question:
      • Name: auto_reply
      • Type: Yes/no
      • Question: “Is this an automated reply from a ticketing or help desk system, not a message written by a person?”

  3. Add If: {{ $json.classification.auto_reply.probability }} greater than 0.9

  4. On the true branch, add Flag post:

    • Post ID: {{ $json.post.id }}
    • Flag type: Add post to review queue
  5. Publish.

Check the execution log for a few days and adjust the threshold.

Question types

Each answer is added at classification.<name>. Use short names without spaces, because you reference them in expressions.

Type Use it to Answer
Yes/no Test one condition probability: chance of yes, from 0 to 1
Choice Pick one label choice, probabilities, confidence
Score Rate on a scale level, score, probabilities, confidence

For Score, list levels from lowest to highest. score is a weighted value starting at 0 for the first level.

If the model declines a question, that answer has type set to refusal and a reason. It has no probability.

Images

Set Images to {{ $json.post.upload_ids }} to include the post’s images. The model needs image support. Uploads that aren’t images are ignored. If an image can’t be sent, the node fails instead of answering without it.

Additional resources