To show you how an automated text message can be set up in Textey, let’s look at an example using the Process Builder.
In this example, let's consider a process where when a Lead record is created and has a specific Lead Source, an automated message is sent out using a predefined template. We have a template called Web Sign Up already created which will be used for this particular example. Before we move on to setting up the process, let’s take a quick look at the template that we created.
Create an SMS template
- Click on SMS Templates tab.
- In the list of templates, click on the Web Sign Up template.
- On the Details tab, you will find template code that will need to be added at a later point in the Process Builder example.
Set up Process Builder
Next let’s look at how to set up the Process Builder in Salesforce.
- Go to Setup > Process Automation > Process Builder.
- Click New to create a new process with Process Name as Web Sign Up-SMS. This process is set to start when a record changes.
- Next, you can create the Process with Lead as the Object and the process being set to start when a record is created.
- Then, you can add criteria for the action group. The following fields will be populated.
- Leads Source equals Web
- Phone does not equal blank
- Criteria Name: Lead Source = Web
- Criteria for Executing Actions: Conditions are met
- Set Conditions:
- Conditions: All of the Conditions are met (AND)
- Click Save.
Each time a Lead record gets created, we need the process to be set up such that an immediate action has to be taken. Let’s see how that is done.
- Click Add Action.
- To send a text message through Textey, the following field data needs to be entered.
- Action Type: Apex
- Action Name: Send SMS to Lead
- Apex Class: Send Textey Message
- This pre-populates a few Apex variables options under Set Apex Variables.
- From Phone: Select the Type as String.
This is the phone number from which we will send the text message.You can add a 10-digit phone number and should be one that is already set up in Salesforce through the Textey application.
- Owner Id: Select the Type as Field Reference.
This refers to the Salesforce user who owns the record when the SMS record is created in Salesforce. Set the owner of the text message record to whoever owns the Lead record when it is created, i.e. the [Lead].OwnerId.
- Parent Id: Select the Type as Field Reference.
This is the record that the SMS Message record is connected to. In this example, we have a Lead created which triggers an outbound message. So we need the text message record in Salesforce to be related to the Lead. When you look at the Lead in Salesforce, you will see the message as sent to that particular person. Set the Parent ID as the [Lead].Id.
- To Phone: Select the Type as Field Reference.
This is the phone number to which we are sending the text message. Set this as the phone number that gets created on the Lead record, i.e [Lead].Phone.
- We also need to add another row for the Template Code. For this, click on Add Row.
- Enter the following details.
- Field: Template Code
- Type: String
- Value: Copy the code of the template that we created earlier under SMS Templates. This code will tell Textey what the outbound text message should say.
- Click Save.
- Now, activate the process by clicking Activate.
Test the Automated Message Process
Now that the Process is set up, let’s test this out with a real-time scenario.
- Go to the Leads tab.
- Click New and create a new Lead with a real phone number that you can check.
- Select the Lead Source as Web.
- Click Save.
- You will receive a text message on the phone number associated with the Lead. You can also view the message on the Textey messenger component and in the history of the Lead.