Knowledge Base > Salesforce > Send SMS & WhatsApp through Salesforce Flow
The Flow builder allows you to automate SMS sending after certain events. When the flow builder identifies the trigger, it will send an SMS automatically through the inwise system.
**This method of sending is beneficial in that your Salesforce account will display sending statistics
Setting the trigger
First, define in the Flow builder which event or trigger would lead to the sending of an SMS. Such as when a contact is registered, a meeting is rescheduled for 3 hours, a purchase is made, a donation is received, a delivery has been sent, etc’.
In order to define the action “Action”, you have to first create the Formula, as follows:
- Click on the “new resource” button
- In the panel that opens, in the “Resource Type” field choose “Formula”.
- In the “Data type” field choose “Text”
- In the field “Formula” field, enter the code (you can add more parameters to this code):
‘{“recordID”: “‘ + {!$Record.Id} + ‘”,”mobileNumber”:”‘ + {!$Record.MobilePhone} + ‘”,”smsText”:”put your text here. \n Add parameters if needed. For example: ‘ + {!$Record.FirstName} + ‘\n’+‘”,”saveToInwiseMessagingHistory”:true}’
**In the case that you receive an error in the formula, please contact us so that we can update the code for you.
Parameters values for the formula
- recordId – Optional. Identify your contact/lead ID. You should use this if you want to save history.
- smsText – Holds the text that you want to send . {!$Record.FirstName} is an example of how to concatenate a parameter. Text can be entered here directly in the formula or it can be taken from a parameter field.
To add a line break (ENTER) – use \n. - mobileNumber –The phone number to which the SMS message will be sent. You can use a hard-coded value, a field name, or any other object you want.
The format can be either international or local. If a local format is used, inwise will append the country prefix defined in the add-on account settings. - saveToInwiseMessagingHistory – Optional. “true” will add a row to the contact/lead’s inwise messaging history (true must be lowercase).
In order to use this feature, it is necessary to activate the messaging history feature in the add-on settings of inwise – You can find more information in the following guide – Settings – adding inwise modules – fast SMS.
The new record will be created in the contact/lead layout in the inwise messaging history section
Meaning of status:
Status | Value | Remark |
sent | The send was valid | |
invalid | Invalid mobile number | The number format is invalid |
rejected | The mobile number is a kosher number | kosher-number |
rejected | The mobile number is defined as unsubscribe in inwise | The mobile phone is unsubscribe in inwise |
When the from sender name is not a valid string according to inwise account | Error log: “Parameter value ‘message.from’ is not allowed.” |
The following parameters are only relevant for version 2.1
- “inwiseAccount” – Optional. If you have more than one inwise account that associated with your SF domain, use this setting to indicate which account will be used to send the SMS message. You can find the account number on the edit screen of the inwise plugin for Salesforce.
- “from” – Optional. CompanyName. If you have more than one sender name in your inwise account, use this setting to indicate from which sender name of the SMS will be send
If you don’t set it, the default sender name from your inwise account will be chosen or the value defined in your salesforce account. - “createTask” – “true”
Optional. “True” will created the contact/lead object. - saveToInwiseActivity – This setting is obsolete, do not use it.
Setting the Action
In the flow builder screen, click on the plus icon (+).
Search “inwise” and choose the action: “Send (apex-inwise__SMS)”
(If you don’t have these options you might not have the latest version of inwise addon version. To receive an updated version, contact our support team).
Mark “Include” in the “Set Input Values” section, then select the formula you previously created.
Choose the formula that you previously created.
That’s it! You have finished setting up, now activate your flow and send it
WhatsApp messages
In order to send WhatsApp messages using the Flow, at step 4 of building the Formula
Example of a formula:
‘{ “recordId”: “‘ +{!$Record.Id}+'”,”content”: “hi”,”template_id”: “22974”,”mobileNumber”: “‘+ {!$Record.MobilePhone}+'”,”