Skip to contentSkip to navigationSkip to topbar
On this page

Send Messages from Custom Objects


(information)

Info

Ability to setup messaging from custom objects is available version 4.129 onwards

Now Twilio for Salesforce allows you to do 1:1 messaging from Opportunity & from any custom object

For this example, we will setup 1:1 messaging on the opportunity object.

But you can do this for any object in Salesforce


Add 1:1 Messaging Component to Page Layout

add-11-messaging-component-to-page-layout page anchor

Go to the record page and click Edit Page

Instruction to Edit Page.

Drag n Drop Twilio - Two Way Messages on your desired position in the page, and Activate & Save it

Page layout.

Setup relationship between Twilio message Object and Custom Object

setup-relationship-between-twilio-message-object-and-custom-object page anchor

Go to Setup -> Object manager -> Twilio message -> Fields & relationships -> Click New

Select Datatype as Lookup Relationship and Click Next

Choose Lookup Relationship.

Select the custom object, Opportunity in our case and Click next

Provide a name, set visibility in next screens and Save

Choose the related object.

This will connect our Twilio Message object to the custom object.


Create a custom field to store the mobile number of opportunity

create-a-custom-field-to-store-the-mobile-number-of-opportunity page anchor

Go to Object manager -> Opportunity ->Fields & relationships -> Click New

  1. Select Datatype as phone field and click on Next button.
  2. Give the field name & click on Next button.
  3. Give Field level security to appropriate profiles & click on Next button.
  4. Add the field to pagelayouts & click on next button.
  5. Add it to all related lists & click on Save button.
Custom field to store the mobile number of opportunity.

Update Component Setting in the Custom Object

update-component-setting-in-the-custom-object page anchor

Go to the custom object record page(we will go to Opportunity record for this example) and find the 1:1 messaging component

  1. Select a field to be used as the recipient's phone number (only field with phone number as data type are supported)
  2. Select the lookup field we just created on the message object in the previous step, to connect the component to the message object
  3. Click Save
1:1 component custom object.

You can now send and receive messages from the custom object


Add opportunity for message ownership & lookup population

add-opportunity-for-message-ownership--lookup-population page anchor
  1. Open "Twilio Configuration" tab.
  2. Navigate to "Inbox" section.
  3. Add "Opportunity" under "Message Owner and Related Record is Determined in the following Order: " section and rearrange the order.
  4. Click on Save button.
Message ownership for opportunity.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.