Summary
Replacement Codes: Use replacement codes to customise your automation messages, simply type << to bring up the list of available replacement codes.
βCross-Object Properties: Using custom automations you can reference properties from other objects.
Who is this article for?
All Planhat users.
Any user that is using automations to send customised messages.
Series
How to Send Custom Messages Using Automations β¬ οΈ You are here
Article contents
Introduction
Both Templated and Custom Automations include what we call Purple Boxes (for obvious reasons...). These are text fields containing messages to be sent via automations, whether they be sent to a specific Slack channel, email address or the Actions module, as a Planhat notification.
Customise Your Message
You can type any text into these purple boxes, to define exactly what the message should be. However, just like in Custom Automations, you can always use Replacement Codes in these Purple Boxes to insert dynamic quantities such as:
The name of the company owner.
The description of a certain task.
The current and previous health score value.
The name of the filter that an object just entered or left.
...
Simply type << in the Purple Box to see the Replacement Codes immediately available to you.
For example, let's say an end user called "John Smith", associated with the company "Apple" left the "Champion" filter. The Replacement Codes in the message above would read:
John Smith at Apple left the "Champion" filter
See here for how to use Replacement Codes in Purple Boxes across both Templated and Custom Automations (as well as in intermediate Custom Automation steps).
π Tip
If you reference a conversation description in a Slack notification automation (<<object.description>>), by default none of the formatting is carried across which means when the automation fires, you will receive an unformatted chunk of text in Slack. However, if you add three backticks on either side of the placeholder (see image below) the spacing and bullet points are carried through to the notification.
Accessing Cross-Object Properties (Custom Automations Only)
In the example described above, the Replacement Codes are only referring to one object, the end user. That's why both codes have <<object. - >> prefixes.
However, there are many cases in which you would want to reference properties from other, related, objects. That's where you'll need one or more custom GET steps - only possible in a Custom Automation.
Example: Cross-Object Replacement Codes
In this example, we'll demonstrate how to dynamically pull data from three different objects into a single Slack message, with a Custom Automation. We'll start this Custom Automation off by using an "End User" filter (starting object) and gather data from both the End User-related Company and Company-related User objects.
Understand and know which object is your starting object. This is the object where the automation gets triggered. In our example, this will be the End User.
Now you will need to create a new GET step so that you can gather all of the fields for the related object. In our example this will be the related Company:
βNow that you have all of the data from the Company object, you also want to get the "Owner" name (we don't want the Owner ID). For this, we need to create another step using the information that we gathered in Step 1. We want to GET data from the User object:
βNow, through these two GET steps, we've successfully gathered information from three different objects:
Company
End-User
User
β
However, since we would also like to include the Co-Owner of the account, we'll add one final step, almost identical to Step 2, except we're referencing the Co-Owner field:
Now we have all of the data needed from all of the related objects, we'll create our Slack message and reference each of those fields. Our Purple Box might read:
β<<object.name>> at <<Step 1.name>> entered the "<<event.filterName>>" filter. The account Owner is <<Step 2.firstName>> <<Step 2.lastName>> and the Co-Owner is <<Step 3.firstName>> <<Step 3.lastName>>.
... which translates to:
End User Name at End User Company entered the "Filter Name" filter. The account owner is Company Owner Full Name and the Co-Owner is Company Co-Owner Full Name.
... which might end up in a Slack channel as something a little more like:
Brad Pitt at Universal Studios entered the "Champions" filter. The account owner is Martin Scorsese and the Co-Owner is Margot Robbie.