# Automation Rules are not triggered by external API actions

**URL:** <https://community.fibery.io/t/automation-rules-are-not-triggered-by-external-api-actions/4979>\
**Category:** Bugs & Issues\
**Tags:** automations, api\
**Created:** [August 18, 2023, 4:38pm UTC](https://community.fibery.io/t/automation-rules-are-not-triggered-by-external-api-actions/4979 "2023-08-18T16:38:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [August 18, 2023, 4:38pm UTC](https://community.fibery.io/t/automation-rules-are-not-triggered-by-external-api-actions/4979/1 "2023-08-18T16:38:53Z")

</div>

When I create/update entities via the API (curl), the relevant Rules are not triggered.

Am I missing something, or is this intentional?

---

<div class="post-metadata">

**Author:** ![Sergey\_Truhtanov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sergey_truhtanov/32/13986_2.png) [@Sergey\_Truhtanov](https://community.fibery.io/u/Sergey_Truhtanov)\
**Post date:** [August 31, 2023, 7:27am UTC](https://community.fibery.io/t/automation-rules-are-not-triggered-by-external-api-actions/4979/2 "2023-08-31T07:27:49Z")

</div>

Rules should be triggered regardless the way of change (API, UI, etc.).

I suggest to check that other rules are executing well(no rule queue overload in your workspace at the moment). Then probably check that you actually do the change that is expected in trigger. If you make an API call that changes nothing, rule will not be triggered.

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [August 31, 2023, 3:29pm UTC](https://community.fibery.io/t/automation-rules-are-not-triggered-by-external-api-actions/4979/3 "2023-08-31T15:29:37Z")

</div>

@Sergey_Truhtanov  
**There appears to be a bug here:**

This Rule does **not** trigger when an external API call creates a “Trigger” entity with Name containing “Create”:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/4/42162c92aef5046e5c9b082d4643a3f1177205ae.png)

This Rule will only trigger on **entity creation** if I remove the “Name contains” filter.

It is easy to reproduce reliably - the following script correctly creates entities, but the Rule is never triggered, even if the entity Name contains “Create”. The Rule will trigger only if the Name filter is removed.

```auto
#!/usr/bin/env bash

declare cmd=$*

#declare FiberyAPIkey='...'
#declare fiberyUrl=https://xxxxx.fibery.io/api/commands

cmd=${cmd//\\/\\\\} # Escape backslashes
cmd=${cmd//\"/\\\"} # Escape dquotes
date=$(date)
cmd='[{"command": "fibery.entity/create","args": {
"type": "MISC/Trigger", "entity": {
"MISC/Name": "'$date'",
"MISC/Command": "'$cmd'"
}}}]'

if result=$( curl --silent -X POST "$fiberyUrl" -H "Authorization: Token $FiberyAPIkey" -H 'Content-Type: application/json' -d "$cmd"
    ) && [[$result =~ '{"success":true']]; then
    echo "SUCCESS - $date"
else
    echo -n "FAILED - $date : "; echo "$result" | sed 's/.*"message":"//; s/\\n/\n/g; s/\\t/\t/g; s/","data":{/\n/'
fi

```

---

<div class="post-metadata">

**Author:** ![Sergey\_Truhtanov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sergey_truhtanov/32/13986_2.png) [@Sergey\_Truhtanov](https://community.fibery.io/u/Sergey_Truhtanov)\
**Post date:** [September 2, 2023, 9:31am UTC](https://community.fibery.io/t/automation-rules-are-not-triggered-by-external-api-actions/4979/4 "2023-09-02T09:31:13Z")

</div>

Will try to reproduce and fix, thanks for details.  
Will write here when the issue will be resolved

---

<div class="post-metadata">

**Author:** ![Sergey\_Truhtanov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sergey_truhtanov/32/13986_2.png) [@Sergey\_Truhtanov](https://community.fibery.io/u/Sergey_Truhtanov)\
**Post date:** [September 4, 2023, 8:10am UTC](https://community.fibery.io/t/automation-rules-are-not-triggered-by-external-api-actions/4979/5 "2023-09-04T08:10:52Z")

</div>

Hello.  
I’ve checked he issue and it works as expected, filter is applied correctly.  
But I’ve remembered one specific behavior of rule filters. I think we’ve discussed it in some other topic in community.

_ **Rule Filter is executed on the actual data at the moment of Rule execution.** _

There are 2 possible behaviors for Rule Filters: either like above, or execute Rule Filters on an entity, that was on the moment of a change.

Second option is much more complex. In Filter you may use Fields, that are not part of a change, that triggered a Rule. Also Filter allows to operate on related collections, and we may even allow formula expressions there in future. So we decided to stick with operating on current data for now.

This may lead to unexpected results. Imagine you’ve created an entity and have a Rule that changes it’s Name. Then you have a rule that subscribes to entity creation, and it won’t be executed, as new Name will not satisfy a Filter.

Also note, at the moment we don’t allow to change order of a Rule, they should be executed in the same order you see them on UI (so sorted by creation date).

If you are sure this is not the case for you, please confirm, I’ll dig deeper.

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [September 4, 2023, 1:35pm UTC](https://community.fibery.io/t/automation-rules-are-not-triggered-by-external-api-actions/4979/6 "2023-09-04T13:35:51Z")

</div>

Thanks for looking into this @Sergey_Truhtanov🙏

My apologies – this was a stupid error on my part, checking the wrong field (Name vs Command) 😢
