Send Messages from Custom Objects
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
Go to the record page and click Edit Page

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

Go to Setup -> Object manager -> Twilio message -> Fields & relationships -> Click New
Select Datatype as Lookup Relationship and Click Next

Select the custom object, Opportunity in our case and Click next
Provide a name, set visibility in next screens and Save

This will connect our Twilio Message object to the custom object.
Go to Object manager -> Opportunity ->Fields & relationships -> Click New
- Select Datatype as phone field and click on Next button.
- Give the field name & click on Next button.
- Give Field level security to appropriate profiles & click on Next button.
- Add the field to pagelayouts & click on next button.
- Add it to all related lists & click on Save button.

Go to the custom object record page(we will go to Opportunity record for this example) and find the 1:1 messaging component
- Select a field to be used as the recipient's phone number (only field with phone number as data type are supported)
- Select the lookup field we just created on the message object in the previous step, to connect the component to the message object
- Click Save

You can now send and receive messages from the custom object
- Open "Twilio Configuration" tab.
- Navigate to "Inbox" section.
- Add "Opportunity" under "Message Owner and Related Record is Determined in the following Order: " section and rearrange the order.
- Click on Save button.
