DAML Bots with DAZL
- andreolfOP 6
Hi DAMLers,
I found out this external blog post on how Knoldus implemented Bots in DAML with the DAZL python library. Good job @Nishchal_Vashisht
Multiple benefits like:
Add support for third-party APIs simply by creating bots that listen to external activity.
Works great with DABL Cloud Service.
Portable and adjustable as per requirements.
Quick response time.The application flow of the Demo looks like this:
Here is the full article:
Knoldus Blogs – 8 Jul 20

Implementing Bots in DAML Application
In this blog, we will explore the Bots in DAML, we will start with basic introduction about Bots than we move to why do we need it and how we can implements Bot
- andreolf 2
@Nishchal_Vashisht great article again
, next step would be to start using DAML Triggers, have you tried that?CCing @cocreature on this one that for sure he will have great insights on how it looks using triggers.
- cocreature 5
Great blogpost @Nishchal_Vashisht! I took the liberty to write up a DAML Trigger version of your example to see how it compares. Very interest to hear your thoughts! Note that it does behave slightly differently (intentionally). In particular, it only archives proposals between the same parties and for the same model and it also makes sure to not try to archive proposals where
queryPartyandcompanyare reversed which would fail.module Trigger where import DA.Action import DA.Foldable import DA.Next.Map (Map) import Daml.Trigger import Main archiveTrigger : Trigger () = Trigger with initialize = \_ -> () updateState = \_ _ () -> () rule = archiveRule registeredTemplates = AllInDar heartbeat = None archiveRule : Party -> ACS -> Time -> Map CommandId [Command] -> () -> TriggerA () archiveRule p acs _ _ _ = do let proposals = getContracts @CarProposal acs let finalAgreements = getContracts @FinalAgreement acs forA_ finalAgreements $ \(_cid, c) -> do -- Only match on agreements where we are the user when (c.user == p) $ do -- Filter out proposals for the same model between the same parties let redundantProposals = filter (\(_, proposal) -> proposal.companyName == c.company && proposal.queryParty == c.user && proposal.carModel == c.model) proposals forA_ redundantProposals $ \(cid, _) -> emitCommands [exerciseCmd cid RejectOffer] [toAnyContractId cid]If you get a chance to try out triggers, let us know how it goes!
- nemanja 4
Great post @Nishchal_Vashisht!
- bartcant 1
Great post indeed. Need to look into myself on what these bots can do
