Inbound Messages
  • 13 Jul 2022
  • 2 Minutes to read
  • Dark

Inbound Messages

  • Dark

Before you can begin to receive inbound messages you will first need to ensure that you have authenticated a Salesforce user for Blackthorn Messaging. You won't be able to receive inbound messages into Salesforce until you complete this.

But, what happens when you receive an inbound message to one of your phone numbers? Let's explore the process below.

Inbound Message Routing

When an inbound text message is received, the first step is to create the SMS Message record in Salesforce. We also need to relate the SMS Message record to the appropriate parent record (i.e. a Contact, Lead, Account, etc). There are two methods that Messaging uses to match an inbound message to the appropriate parent record. We’ll explain these two methods in detail.

Existing Conversation

The first attempt to match an inbound message to the correct parent record is to search for an existing conversation between the two phone numbers. Messaging will look for an outgoing message to the sender’s phone number from the phone number that the sender is replying to.

Let’s look at an example to understand this better. You have sent a message to a contact named John Doe. You have sent the message from 555-555-5555 to 555-555-9999 (this is John Doe’s mobile number). John Doe replies from his mobile phone number (555-555-9999) to your phone number (555-555-5555). Messaging will detect the outgoing message from 555-555-5555 and the inbound message will be associated to the John Doe contact record.

Record Search

When an inbound message is received and no existing conversation is detected, Messaging will perform a search of your records to find the sender’s phone number. The inbound message will then be associated to the first record that is found that contains the sender’s phone number. You determine the objects that you want Messaging to search using the Default Search Object setting on the Configuration Settings page.

Let’s look at an example. On the Configuration Settings page, you’ve set the Default Search Object to Contact. An inbound message is received from 555-555-9999, but there has never been an outgoing message sent to that phone number. Messaging will now then search all of your Contact phone number fields looking for a Contact that contains 555-555-9999. The inbound message will be associated to the first record (most recently modified) that contains that phone number.

You can also set multiple objects in the Default Search Object field. The object names need to be separated by a comma. For example, let’s say you’ve set the Default Search Object to "Contact, Lead". Messaging will first search all Contacts for the matching phone number. If no Contacts are matched then the Leads will be searched for a match.

What if there’s no match?

If neither the Existing Conversation nor the Record Search methods find a match for the phone number, then the next step depends on your configuration settings.

  1. If the Auto-Create Leads option is enabled (on the Configuration Settings page), then a new Lead will be created and the inbound SMS Message record will be associated to the new Lead. New Leads are given some default values for the required fields. They are as follows:
    • Last Name: “SMS Lead datetime” (where datetime is the date/time the Lead was created)
    • Company: “SMS Lead”
    • Mobile: the sender’s phone number
  2. If the Auto-Create Leads option is NOT enabled, then the inbound message will create a new SMS Message record but it will not be associated with a parent record.