EDUCAÇÃO E TECNOLOGIA

Handle Event Trigger using Formulas

Hello All,

In this blog, we will see how to handle event triggers using formulas in Open connectors.

Use Case: To get an email update whenever an message is posted in a specific Slack Channel. We can reuse this formula steps to any events using open connectors.

Step 1: Create Connector Instance

Create and authenticate Slack Instance from Open connectors and enable “Events” to enable Event web hooks.

Step 2: Create Formulas to handle event.

  1. From “Formulas” in open connectors lets create a formula to handle the events triggered by the above connector instance.

  1. Enter a formula name and click “Create”
  2. Create “Variables” so that we can reuse the same formula for various instances.

Type : Connector instance

  1. Click on the “trigger” to add trigger details and Select “Event Trigger”. In the Connector Instance Variable, select the variable we created in previous step. Click “Save” and “confirm”.

  1. In next step, we must collect the data related to the event trigger . To collect data, we must connect to the connector and get the data for that “particular event”. Add Step and select “Connector API Request”.
    1. Give Appropriate name for the step
    2. Select the connector variable created and above step
    3. As we are collecting data for the trigger, we can select “GET”.
    4. For Connector resource URL, We can get the URL from the “API Docs” of the connector instance.
    5. As we want to events related a specific channel, we can choose the appropriate URL.
    6. The connector instance url should be as shown in image below.   
    7. Save step and add it to the formula flow.
  1. Create a “Variable” to pass the required email IDs for the mail.

            Type “ String”

  1. We will use Java script step to send email to the required contacts.

Data       : Pick data from the “getEventData” step.

Subject   : Create variable to use expressions to dynamically decide the subject.

               IDs          : use the variable created in above step.

The final formula will have 3 steps.

Step 3 : Create Formula Instance

Once all the required steps are added in the formula, we must create Formula instance to allow the formula to run .   Assign the Slack Instance to the Connector variable and add the required email details to email variable.

Step 4 : Debug

We can debug our formula using the “Try it out” option.

  1. Select the “Instance” and “Trigger” details to run the data. We can view the trigger details from “Event Logs” option under “Activity”.
  1. Click “Run” to see the data flow and we can see the various variables associated with the flow too.

Now, we will get an email notification whenever someone post a message in our specific channel.

Note : An app should be created in SLACK and Event API should be enabled to push data from SLACK to the Web Hook URL mentioned in the Open Connector instance.