Can Daml Triggers replace Dazl bots on Daml Hub?

I know that there is a basic difference: Dazl bots can communicate with the outside world, Daml Triggers cannot.

Apart from this difference, Daml Triggers can fully replace Dazl bots?

Indeed, Dazl bots and Daml triggers are very similar to each other! For the most part, triggers can replace Dazl bots, and in fact I’d recommend reaching for triggers to solve the problem first, before trying Python automations.

However, the distinction is more subtle than simply communication. In Daml Hub, we actually have two flavors of runnable python automation:

  1. Python “bots”
  2. Integrations

The first kind are simple Python applications, written using the DAZL library, that can subscribe and react to ledger events, exactly like a trigger. However, these bots are actually blocked via network policies from being able to make network requests to the outside world, due to security reasons.

Integrations are similar to bots, as they are also written with Python + DAZL, but the network restriction is loosened. New Integration packages can only be uploaded into Daml Hub by Digital Asset, though afterwards they become available & deployable by anybody. For these reasons, let’s ignore integrations for now.

When it comes to pure DAZL bots vs triggers, what is the difference then, if not network communication?

The only thing I can think of where you’d need to write a DAZL bot is if you need a feature that Daml, as a language, does not natively support.

Here’s a cooked up example: suppose you want your automation to watch a specific contract template A for create events, and then create a separate contract B for each A. Suppose one of the fields of template B expects the sha256 hash of a Text field from contract template A.

A Daml trigger wouldn’t work, because Daml doesn’t provide a sha256 hashing function. Therefore, the Python bot would be the better option here. (Correction: This example is actually doable with a Daml trigger! Thx @cocreature. I’m actually struggling to come up with a different example, which just goes to show that triggers cover quite a lot of bases out of the box :wink: )


  • Use Triggers wherever possible
  • Fall back to a Python + DAZL bot if pure Daml can’t support the use-case
  • Use an integration if you need to talk to the outside world
  • Coming soon: we’re working on a generic HTTP integration if there is no suitable canned integration

Actually Daml has DA.Text.sha256. Your argument still holds ofc in general, you just picked the one thing that works :slight_smile:

1 Like

Thank you!