Using EL in Services

Whether you are augmenting an existing service, or creating one from scratch, you will find expressions useful in shaping the service flow and customizing it for your users.

Many of the default handlers and templates in the Services tab already contain expressions. For example, if you create a service using the Voting template, then MEP takes your initial input and turns this into a series of handlers that use expressions. When designing your service, you should be aware of the built-in handlers which make it easy to perform simple operations that you might otherwise use EL to do. For example, it is simpler to use the time branching handlers available in MEP than use EL to do the same task.

You can enter expressions into many of the editable fields of handlers. For example, in the message body of a Send > SMS or Send > Email handler, you can add expressions to return dynamic values back to an end user, such as:

Your mobile number is ${user.identifiers.msisdn}.

The expression ${user.identifiers.msisdn} is the value of the end user’s mobile number.

Special handlers exist to create and update expressions, and you can view and edit variables related to a service within the Service editor.

Handlers commonly linked with expressions

The following handlers are commonly used in conjunction with expressions:

  • Set Variables — use to create and update custom variables
  • Branch on Expression — use to change the flow of a service
  • HTTP Poke — use to push data to another system
  • Get External Data — use to fetch data from another system

Set Variables handler

The Set Variables handler enables you to create custom variables as part of a service. This handler will also update the variable's value whenever it is triggered in the service.

For instructions on using this handler, see Create a Custom Variable in a Service.

Branch on Expression handler

This handler is designed to change the flow of a service depending on the outcome of an expression. The expression in the handler must resolve to a Boolean value (either true or false).

For instructions on using this handler, see Branch a Service Based on an Expression.

HTTP Poke handler

The HTTP Poke handler enables MEP to push data to an external platform. Expressions are commonly used to reference data in a URL sent to the external platform. Since the URL and GET parameters are fully customisable, you can use the handler to send a diverse range of data, from the text contents of an SMS, to an end user's profile, to event notifications generated during the execution of a service such as a new user joining a subscription.

For an example use of this handler, see Forward an End User's Message to Your Platform.

The HTTP Poke handler enables MEP to push data to an external platform. Expressions are commonly used to reference data in a URL sent to the external platform. Since the URL and parameters are fully customisable, you can use the handler to send a diverse range of data, from the text contents of an SMS, to an end user's profile, to event notifications generated during the execution of a service such as a new user joining a subscription. The handler supports the POST, PUT, GET, and DELETE methods and also allows you to add a Header and Body to an HTTP request.

Get External Data handler

The Get External Data handler can fetch data from an external platform when a service is triggered. Data retrieved by this handler is stored as variables, allowing it to be processed further by other handlers.

Like the HTTP Poke handler, the GET parameters and URL are fully customizable, so you can set MEP to fetch any data from your external platform in response to a service being triggered. This also means that the handler can push data to the external platform in its request; for example, you could customize the request to send user specific data which then determines the data sent back.

For instructions on using this handler, see Retrieve External Data as Variables.

The Get External Data handler can fetch data from an external platform when a service is triggered. Data retrieved by this handler is stored as variables, allowing it to be processed further by other handlers.

Like the HTTP Poke handler, the GET parameters and URL are fully customizable, so you can set MEP to fetch any data from your external platform in response to a service being triggered. This also means that the handler can push data to the external platform in its request; for example, you could customize the request to send user specific data which then determines the data sent back. The handler supports the POST, PUT, GET, and DELETE methods and also allows you to add a Header and Body to an HTTP request.