Actions
Actions represent any action you can perform on Items. Some common examples include Delete, Ban, Mute, Send to Moderator, Approve, etc.
When you start building Cove Rules, they'll help you (1) find harmful Items, and (2) take action on those Items. In order for Cove to take action on Items on your behalf, we need to know what types of actions we can take, and how to take them. For example, if you want to create rules that automatically delete hateful content, Cove needs to be able to invoke your Delete action automatically (i.e. through a POST request).
For every Action you define in Cove, you have to expose the action through a public-facing API endpoint (by "public-facing", we mean an endpoint that can receive requests from our servers). Whenever your rules determine that some Item should receive an Action, we will send a POST request to the Action's API endpoint. When your server receives that POST request, your code should actually perform the corresponding action.
You can read about how to actually implement these endpoints here.
How to Create an Action
To create a new action:
- Navigate to the Actions tab
- Click "Create Action" in the top right corner
- Enter a name, and optionally a description
- Select the Item Types this Action can run on. Some Actions (e.g. Delete) might run on all Item Types. Some others (e.g. Apply Warning Label) might only run on posts, but not profiles, for example.
Note: To determine whether an Action "A" could run on a particular Item Type "T", you can ask yourself "if I were just given the unique ID of an item with type T, could I execute action A on it?". For example, if you create a "Ban User" Action, you might initially think that could only apply to a "User" Item Type. After all, how could I run the "Ban User" Action on a comment? However, if you would like to be able to ban a user based on a comment they created, then you would want your "Ban User" Action to run on a "Comment" Item Type. In your implementation of the "Ban User" Action, if we give you the ID of a comment, you'd need to ban the user who created that comment. - Input your Action's endpoint URL into the "Callback URL" field.
- If you'd like us to include certain parameters in the HTTP headers or body of the POST request, you can add those. For example, if we need to provide an API key to authenticate our requests to your backend, you can add that API key in the Headers section, and we'll include it in the HTTP headers of every request to this endpoint.
- Click "Create Action"
For extra security, we sign every request we send to these Action endpoints. You can read more about how these signatures work in our Authentication section.
Updated over 1 year ago