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.

Fixing Segment Destination Insert Functions Client-Side Delivery For Mobile Sources

Issue

Customers using Segment may notice that their Destination Insert Function does not apply payload modifications to all events, often accompanied by the Message sent client side delivery status in the Delivery Overview. 

 

Product

Segment Functions

 

Environment

Segment Console

 

Cause

Destination Insert Functions operate strictly on Segment backend servers and apply exclusively to Cloud Mode data flows. Middlewares can be utilised for device mode connections to update/transform events.

 

Resolution

To ensure every event consistently includes the required properties, you can evaluate the following recommendation:

Ensure the source<>destination is correctly set up in cloud mode, should you see the message 'Message sent client side' you need to evaluate your implementation to ensure the destination is not bundled.

Optional Code Review Tip for Insert Functions When evaluating payload properties in your JavaScript function, ensure you check for both null and undefined. If a property is completely absent from an incoming payload, JavaScript evaluates its value as undefined.

  • Using strict inequality (e.g., if (event.properties.propertyName !== null)) evaluates to true for undefined, which may inadvertently set mapped variables to undefined.
  • Instead, use if (event.properties && event.properties.propertyName != null) to evaluate the property cleanly across all payload variations.

 

Additional Information

Have more questions? Submit a request
Powered by Zendesk