Automatic Actions are not triggered if created through the API

I’m baffled!

I used the python API client to create a set of actions that change the color of the task, based in the Category (the “\Kanboard\Action\TaskAssignColorCategory” action).

The actions are properly displayed in the Kanboard interface, and I can see the database being populated too (of course). But creating or editing a task and assigning a category does NOT change the color of the task.

If I create a new Project and I manually create Categories and the realtive Action to change color based on that category, then it does work (for that project only).

In the beginning I thought that something on my installation (maybe a configuration or an installed plugin) was interfering, but I tried with a brand new installation (new DB, NO plugins) and the problem persists.

Any ideas on how to easily debug this, apart from going line by line through the whole hooks abstraction path?

Many thanks!

Giving a tiny example would be helpful.

Are you using the correct event name (‘task.create_update’)?

Action registrations are always bound to a single project.

Further hints: Enable debug logging, maybe you can see something there.

It works like a charm here.
As soon as I assign the specified category, the tasks color changes to red.

image

I know it is weird. This is a sample of how the new categories and actions are created.

DEFAULT_CATEGORIES = [
    {"name": "Epic", "color": "pk_ep"},
    {"name": "User Story", "color": "pk_us"},
    {"name": "Bug", "color": "pk_bg"},
    {"name": "Task", "color": "green"},
    {"name": "Specification", "color": "pk_sp"},
    {"name": "Graphical Design", "color": "pk_gd"},
    {"name": "Work Package", "color": "pk_wp"},
    {"name": "Deliverable", "color": "pk_dv"},
    {"name": "Requirement", "color": "pk_rq"},
    {"name": "Validation Plan", "color": "pk_vp"},
    {"name": "Verification Test", "color": "pk_vt"},
    {"name": "Meeting", "color": "pk_mt"},
    {"name": "Action Item", "color": "pk_ai"},
    {"name": "Feedback", "color": "pk_fb"},
    {"name": "Knowledge Base", "color": "pk_kb"},
]

    for cat in track(DEFAULT_CATEGORIES):
        cat_id = kb.create_category(
            project_id=proj_id, name=cat["name"], color_id=cat["color"]
        )

        kb.create_action(
            project_id=proj_id,
            event_name="task.create_update",
            action_name="\Kanboard\Action\TaskAssignColorCategory",
            # params={"color_id": cat["color"], "category_id": cat_id},
            params={"color_id": "purple", "category_id": cat_id},
        )

Do note that most of the categories are using “invalid” colors (since I was using a plugin that was allowing me to create custom colors, but I have removed ALL plugins to debug this). The Category Task is using green which IS a valid color, though.

And yes, my tests, that I expect the automatic action to kick in ARE performed in the correct project.

Maybe I need to debug harder, but it’s a bummer that I hit a wall so early in trying to customize Kanban… I’m sure there is something wrong in my current setup, but I just cannot seem to find it!

Thanks for the feedback!

I’m not very familiar with Python, are you sure you don’t have to quote the backslashes?