SMSNET
Guide

Salesforce SMS Integration: Two-Way Texts From a Flow, Replies as Tasks

To text from Salesforce with your own number, connect an Android phone to SMSNET and run the CRM bridge with CRM = "salesforce". A record-triggered Flow calls the bridge with an HTTP Callout, and one SMS goes out. Replies come back as completed Tasks on the matching Contact or Lead, found with a phone search that ignores formatting. STOP ticks a checkbox field. The bridge signs in with OAuth client credentials, so no person's password or session is involved.

Two-way SMS between a customer's phone and Salesforce Diagram in five boxes, left to right: Customer, Your Android phone with your own SIM, SMSNET, the CRM bridge, and Salesforce. The top lane shows an inbound reply travelling from the customer through the phone and SMSNET to the bridge, which writes it as completed task. The bottom lane shows a CRM automation (Record-triggered Flow) calling the bridge, which sends one SMS through SMSNET with an idempotency key, out from the phone to the customer. Badges: phone matched in five spellings, STOP syncs back, failures logged, retries never text twice. Two-way SMS inside Salesforce: replies in, automations out Top lane: a customer replies. Bottom lane: a CRM automation sends. Same thread, same number. Customerany phone Your Androidyour own SIM SMSNETroutes and paces CRM bridgeone small Worker SalesforceCompleted Task IN “Yes, Tuesday 10:00 works” → signed webhook → completed task OUT Record-triggered Flow → POST /crm/… → one SMS, Idempotency-Key SMS SMS Phone matched in 5 spellings STOP / הסר syncs back Failures logged, not lost Retries never text twice
Two-way SMS inside Salesforce: replies become completed Tasks on the Contact or Lead, and a record-triggered Flow leaves as one SMS from your phone.

What lands on the record

Hi Ronen, your proposal is in your inbox. Questions? Just reply to this message.

Wed 14:00 · 1 segment · GSM-7

Looks good. Can you add the extended warranty?

14:26 · 1 segment · GSM-7

Salesforce Task on Ronen Mizrahi: Subject "SMS received", Status Completed, with the reply in the description

Step 1: an app for the bridge

The bridge needs its own identity, separate from any person's login.

  1. Setup → External Client App Manager → New External Client App. Since Spring '26, creating a new Connected App is blocked by default, but an existing Connected App with client credentials works the same way. Enable OAuth settings with the scope api.
  2. Turn on Enable Client Credentials Flow.
  3. In the app's policies, set Run As to an integration user who can read Contacts and Leads and create Tasks.
  4. Copy the consumer key and consumer secret.

In wrangler.toml, set SF_INSTANCE_URL = "https://<your domain>.my.salesforce.com" and SF_CLIENT_ID. Then npx wrangler secret put SF_CLIENT_SECRET. The bridge asks for a token when it needs one, and asks again when it expires.

Step 2: optional opt-out field

Create a Checkbox field with the same API name on both Contact and Lead, for example SMS_Opt_Out__c, and set SF_OPTOUT_FIELD = "SMS_Opt_Out__c". When someone replies STOP (or הסר, once the Hebrew opt-out words are on under Safety → Rules), the bridge sets it to true on whichever object matched.

Step 3: deploy and connect

Download the bridge, set CRM = "salesforce", DEFAULT_COUNTRY_CODE and MESSAGE_TEMPLATE, add SMSNET_API_KEY (test key first) and CRM_TRIGGER_TOKEN, deploy, and point SMSNET's webhook at https://<worker>/smsnet (how).

Step 4: a Flow that texts

  1. Setup → Named Credentials: create one for https://<worker>, with an External Credential that uses No Authentication. The token in the path is the credential, so keep the Named Credential's URL to admins.
  2. Flow Builder → Record-Triggered Flow: for example Opportunity, when Stage Name changes to Proposal/Price Quote.
  3. Add an HTTP Callout action (or invocable Apex if your org uses it) that POSTs to /crm/<CRM_TRIGGER_TOKEN>. The HTTP Callout wizard builds the body's shape from a sample JSON, and you map each field to a value from the record. This is the body the bridge expects:
{
  "phone": "{!$Record.Contact__r.MobilePhone}",
  "first_name": "{!$Record.Contact__r.FirstName}",
  "record_id": "{!$Record.Contact__r.Id}",
  "event_id": "{!$Record.Id}-{!$Record.StageName}",
  "sms_text": "Hi {!$Record.Contact__r.FirstName}, your proposal is in your inbox. Questions? Just reply."
}

Field paths depend on your data model. Use the Opportunity's primary contact role or a lookup you already have. event_id makes the Flow safe to re-run: the same opportunity reaching the same stage again produces the same key, and SMSNET doesn't text twice within 24 hours, the time SMSNET keeps a key. If an opportunity can return to the same stage a day later and should text only once ever, add your own condition to the Flow.

How a reply finds the Contact or Lead

Salesforce indexes phone fields in a normalised form. The bridge runs one SOSL search for the international and the national number:

// salesforce.js (excerpt)
const q = `FIND {${digits} OR ${national}} IN PHONE FIELDS
           RETURNING Contact(Id, Name), Lead(Id, Name WHERE IsConverted = false) LIMIT 1`;

Converted Leads are skipped, so a reply goes to the Contact that the Lead became. The Task is created with WhoId set to the match, Status = Completed and today's date, so it appears in Activity History rather than in someone's open tasks.

Troubleshooting

SymptomCause
Salesforce token answered 400Client credentials flow is off, or Run As is empty
Tasks created but not visibleSharing or page layout for the Run As user. Check with a report on Tasks with subject "SMS received"
A brand new record isn't found for a minuteSearch indexing in Salesforce is asynchronous. A reply within seconds of creating the record can miss it
Flow error on the calloutThe Named Credential URL or the path token is wrong. The bridge answers 404 for a wrong token

FAQ

Do I need a managed package from AppExchange?

No. The bridge uses the standard REST API with an app you create in Setup. Nothing is installed in your org.

Can I use Salesforce Outbound Messages?

They send SOAP, and the bridge reads JSON. Use a Flow HTTP Callout or a few lines of Apex instead.

Will the replies count against API limits?

Each reply uses one search and one insert, so two API calls. A team getting a few hundred replies a day stays far below typical daily allowances.

Can unknown numbers become Leads?

Yes. With CREATE_UNKNOWN = "1", a reply from an unknown number creates a Lead named "SMS +972..." with company "Unknown (from SMS)" for someone to qualify.

This is a spoke of Connect SMS to your CRM. Same bridge: HubSpot, Pipedrive, monday.com. Signature details: Receive SMS webhooks.

Send your first message today

Free plan, no card: 400 messages a month from your own number, with the API, webhooks and MCP included.

Get the app See pricing

Get it on Google Play

Written by , who builds SMSNET. Product facts on this page are checked against the live pricing page and the running API on the date shown above.