Replace placeholders
Function: Replace placeholders
This action helps you customize text by replacing specific markers (called placeholders) with dynamic information. Imagine you have a standard message, and you want to insert a customer's name, an order number, or a date into it. This action makes that process easy and automated.
Input
- Text:
The main body of text where you want to make replacements. Placeholders within this text should be enclosed in double curly braces, like
\{\{placeholderName\}\}. - Placeholders:
A collection of key-value pairs. Each 'key' in this collection should match a placeholder name found in your "Text" (e.g., if your text has
\{\{customerName\}\}, thencustomerNamewould be a key here). The 'value' associated with each key is the actual data you want to insert into the text.
Output
- Result: The name of the variable where the modified text (with all placeholders replaced by their corresponding values) will be stored. By default, this variable is named "RESULT".
Execution Flow
Real-Life Examples
Here are some practical ways you can use the "Replace placeholders" action:
Example 1: Personalizing an Email Greeting
You want to send a personalized welcome email to new customers.
- Inputs:
- Text: "Hello {{customerName}}, welcome to our service! Your account ID is {{accountId}}."
- Placeholders:
customerName: "Alice Smith"accountId: "CUST-7890"
- Result: The variable named "RESULT" will contain: "Hello Alice Smith, welcome to our service! Your account ID is CUST-7890."
Example 2: Generating a Dynamic Invoice Description
You need to create a detailed description for an invoice that includes specific order details.
- Inputs:
- Text: "Invoice for Order #{{orderNumber}} placed on {{orderDate}}. Total amount due: {{totalAmount}}."
- Placeholders:
orderNumber: "INV-2023-001"orderDate: "2023-10-26"totalAmount: "$150.75"
- Result: The variable named "RESULT" will contain: "Invoice for Order #INV-2023-001 placed on 2023-10-26. Total amount due: $150.75."
Example 3: Crafting a Standard SMS Notification
You want to send an SMS reminder for an upcoming appointment.
- Inputs:
- Text: "Reminder: Your appointment with {{doctorName}} is scheduled for {{appointmentTime}} at {{clinicAddress}}. Please arrive 15 minutes early."
- Placeholders:
doctorName: "Dr. Emily White"appointmentTime: "3:30 PM"clinicAddress: "456 Oak Avenue"
- Result: The variable named "RESULT" will contain: "Reminder: Your appointment with Dr. Emily White is scheduled for 3:30 PM at 456 Oak Avenue. Please arrive 15 minutes early."