This article will describe how to send an application message via API to an external system. 


Sometimes you might want to let Barium Live send information to a another system. This can be useful in variety of different applications. For example in an onboarding application, when you want to add a user to the AD. Or if you want to send specific data to a billing system. This can be done via the Send Application integration.  



In order to use "send application message" it needs to be activated on the contract. Please contact sales@barium.se to activate the function.    


1. Go to Space settings >Business components in your space and press "Add new", then choose "Send Application" 


(Click on image for a better view).


2. Open your process in the modeling tool and add a message intermediate to the process.  Read more about Message intermediate here.



3. Right click on the message intermediate and choose "Configure message" , thereafter choose "Other message". 


 




























(Click on image for a better view).


4. Set a queue name of your liking and add a message. You can as an example retrieve data from a field in a form by typing $form.field$. 

Copy the "Full queue name and past it into the agent.xml file  (See step 5).   



5. Configure the API call. Either by BIA (Barium integration Agent) or a regular API Call.

In this article we will focus on configuration in the BIA (Agent.xml). If you wish to do a regular API call.  You can find the API method for application message here


Example of BIA configuration: 

(Text in red must be configured). 




<?xml version="1.0" encoding="utf-8" ?>

<agent version="1.0">

    <config id="Config1" enabled="true">

        <apiurl>https://live.barium.se/api/v1.0</apiurl>

        <apikey>00000000-0000-0000-0000-000000000000</apikey> <!-- Your private API Key -->

        <apiusername>integration@company.se</apiusername>

        <apipassword>****************</apipassword> <!--Your top secret password -->

        

        <datasources>

            <datasource id="SIGNAL1" adapter="applicationmessage">

                <!--DomainId is the 4 digit number of the space.--> 

                <queryurl>https://live.barium.se/api/v1.1/domains/<domainId>/applicationmessages</queryurl>         

                <method>POST</method>

                <body>

                     <!--Add the copied "Full queue name" from step 4 here.-->

                    { "queueName" : "38c7c39b-abd5-4f81-96f1-2310a3c838d1.test_queue" }    

                </body>

            </datasource>

        </datasources>


        <triggers>

            <trigger id="trg" type="timer">

                <period>0.00:05:00</period> <!-- Set the time how often the queue will be read.-->    

           </trigger>

        </triggers>


        <tasks>

            <task trigger="trg" enabled="true">

                <query id="signal1_queue" datasource="SIGNAL1"></query>

                <foreach queryid="signal1_queue" as="queue_row">

                    <log>Signal received from Barium Live with data: id = $queue_row.id$, name = $queue_row.name$</log>

                </foreach>

            </task>

        </tasks>

    </config>

</agent>