At Taplytics, we use these helpers (on top of a few approved default Handlebars helpers) within our Push Notification system.
A quick way around making sure you don't send empty strings inside your notifications. By using default, you can make sure in case data is missing – you'll still send a great notification to your users.
value (any type): Value to return.defaultValue (any type): Value to return, ifvalueisnullorundefined.
(Object): Returns value, unless it's null or undefined. Otherwise, returns defaultValue
The user's first name. This requires you to have sent us information about the user either as a first_name attribute when setting User Attributes or have set a name on the user.
defaultValue (any type): Value to return, if nofirst_nameornameattributes are found on the user.
(Object): Returns user's first_name based on User Attributes. If it doesn't exist, it returns the defaultValue argument (or null if none is provided).
The user's last name. This requires you to have sent us information about the user either as a last_name attribute when setting User Attributes or have set a name on the user.
defaultValue (any type): Value to return, if nolast_nameornameattributes are found on the user.
(Object): Returns user's last_name based on User Attributes. If it doesn't exist, it returns the defaultValue argument (or null if none is provided).
The user's full name. This requires you to have sent us information about the user either as a first_name/last_name attribute when setting User Attributes or have set a name on the user.
defaultValue (any type): Value to return, if nofirst_name/last_nameornameattributes are found on the user.
(Object): Returns user's name based on User Attributes. If it doesn't exist, it returns the defaultValue argument (or null if none is provided).
The user's email. This requires you to have identified the user with an email.
defaultValue (any type): Value to return, if noemailattribute is found on the user.
(Object): Returns user's email based on User Attributes. If it doesn't exist, it returns the defaultValue argument (or null if none is provided).