SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Message Sync Job Fails in Twilio for Salesforce Managed Package

Issue

Users of the Twilio for Salesforce managed package may experience repeated “Twilio Sync Job Failed” exception emails, and notice that the Message Sync option under Twilio Configuration becomes unscheduled. This results in messages not syncing properly from the server to Salesforce, impacting business processes. Common error messages reference Salesforce Apex heap size or CPU time limit exceptions.

 

Product

Twilio for Salesforce

 

Environment

Twilio Console

 

Cause

This issue is typically caused by Salesforce Apex governor limits being exceeded during the sync job. The most common root cause is synchronous custom automation (such as record-triggered Flows or Apex triggers) on the TwilioSF_Message__c object. These custom processes consume additional CPU time during message creation, which can push the sync job over Salesforce’s strict limits and cause it to fail. Additionally, running the sync job too frequently (e.g., every 2–5 minutes) can lead to overlapping jobs, causing the system to abort or unschedule the sync process.

 

Resolution

To resolve and prevent sync job failures:

  1. Refactor Custom Logic to Run Asynchronously:
    • Audit any custom Flows or triggers on the TwilioSF_Message__c object.
    • Ensure these are configured to run asynchronously to avoid conflicting with the managed package’s execution limits.
  2. Reduce “Get Message Size” Setting:
    • Go to Setup > Custom Settings > Twilio Public App Config > Manage > Edit.
    • Set the Get Message Size field to a lower value (minimum allowed is 100).
    • Save the changes.
  3. Increase Sync Retrieve Interval:
    • In the Twilio Configuration tab, set the sync frequency to 5–10 minutes to prevent job overlaps and reduce the risk of hitting Salesforce limits.
  4. Skip Lead/Contact Updates (if applicable):
    • If you have heavy triggers on Lead or Contact objects, check the “Skip Lead/Contact update?” box in the Twilio Public App Config custom settings to bypass these updates during sync.
  5. Verify Package Version:
    • Ensure you are using the latest version of Twilio for Salesforce, as recent releases include optimizations for message sync and high-volume handling.
  6. Suppress Failure Notifications (optional):
    • To reduce exception emails, enable the “Stop Sync Job Failure Notification” option in the Twilio Public App Config custom settings.

 

Additional Information 

  • The minimum allowed value for “Get Message Size” is 100; setting it lower is not supported.
  • If your message batches are already below this threshold, focus on optimizing custom automation and Lead/Contact updates.
  • For more details, refer to the Twilio for Salesforce documentation.

For further assistance, please reach out Twilio Support.

Have more questions? Submit a request
Powered by Zendesk