MEP Expression Language
Keywords and Message Details
Keywords
The following variables reference keywords. A keyword is the phrase or alphanumeric string sent in by the end user that routes the user to the specific service.
The two tables below are split by scope type (request and session). Note that the keyword details you can access are the same; however, values accessed using the session scope are accessible throughout an entire session, while values accessed using the request scope exists only for the duration of a specific request within a session. This means that if a session begins a second request then a keyword variable that uses the request scope will return a Null value. For this reason, we recommend that you use the session scope to reference keyword details.
The variables using the session scope are:
Variable |
Description |
Type |
---|---|---|
session.initialKeyword.description
|
Reference the keyword sent by an end user to access a specific service. This function returns the keyword's description. You can reference this variable in the Services tab only. |
String |
session.initialKeyword.keyword |
Reference the keyword sent by an end user to access a specific service. This function returns the keyword identified in the message. If you are using a regular expression capture group to find a keyword in the message, then you must select the Keyword field when you create the keyword, otherwise this variable will return a NULL value. See Using a Regular Expression to Capture a Keyword. You can reference this variable in the Services tab only. |
String |
session.initialKeyword.name |
Reference the keyword sent by an end user to access a specific service. This function returns the keyword identified in the message. This includes a percentage sign at the end of the keyword if the keyword matches "starts with", or a percentage at the start if the keyword matches "ends with". You can reference this variable in the Services tab only. |
String |
The variables using the request scope are:
Variable |
Description |
Type |
---|---|---|
request.keyword.description |
Reference the keyword sent by an end user to access a specific service. This function returns the keyword's description. You can reference this variable in the Services tab only. |
String |
request.keyword.keyword |
Reference the keyword sent by an end user to access a specific service. This function returns the keyword identified in the message. If you are using a regular expression capture group to find a keyword in the message, then you must select the Keyword field when you create the keyword, otherwise this variable will return a NULL value. See Using a Regular Expression to Capture a Keyword. You can reference this variable in the Services tab only. |
String |
request.keyword.name |
Reference the keyword sent by an end user to access a specific service. This function returns the keyword identified in the message. This includes a percentage at the end of the keyword if the keyword matches "starts with", or a percentage sign at the start if the keyword matches "ends with". You can reference this variable in the Services tab only. |
String |
SMS Message Text
The following variables reference the text from SMS messages received by a specific service. These variables are available in the Services tab only.
The two tables below are split by scope type (request and session). The types of details you can access are the same; however, values accessed using the session scope are accessible throughout an entire session, and in this case, it is the initial SMS message that the variables will reference. Values accessed using the request scope exists only for the duration of a specific request within a session, and in this case, the variable will reference the SMS message within the request period. If the request period does not include a received SMS message, then the variable does not reference any value.
The variables using the session scope are:
Variable |
Description |
Type |
---|---|---|
session.initialDefaultMessage |
The text from the first SMS message received in the session. This includes the keyword unless the service is set to ignore the keyword. This is set using the Ignore keyword when processing field in the Create Service and Update Service screens in the MEP UI. You can reference this variable in the Services tab only. |
String |
session.initialMessage.message |
The text, including the keyword, from the first SMS message received in the session. You can reference this variable in the Services tab only. |
String |
session.initialMessage. strippedMessage |
The text, not including the keyword, from the first SMS message received in the session. You can reference this variable in the Services tab only. |
String |
session.initialMessage.smsId
|
The SMS ID for the first SMS message received in the session. This unique ID is generated by the OpenMarket SMS Gateway and is an integer. You can reference this variable in the Services tab only. |
Integer |
session.initialMessage.date |
The time and date that the SMS Gateway received the first message in the session, in the format yyyy-MM-dd hh:mm:ss. For this timestamp, the SMS Gateway uses the current time and date in London, United Kingdom (either GMT or BST, depending on the time of year). You can reference this variable in the Services tab only. |
String |
The variables using the request scope are:
Variable |
Description |
Type |
---|---|---|
request.defaultMessage |
The text from the most recent SMS message received in the session. This includes the keyword unless the service is set to strip the keyword from the message. This is set using the Remove keyword from message field in the Create Service and Update Service screens in the MEP UI. Note that if the request period does not include a received SMS message, then the variable does not reference any value. You can reference this variable in the Services tab only. |
String |
request.message |
The text, including the keyword, from the most recent SMS message received in the session. Note that if the request period does not include a received SMS message, then the variable does not reference any value. You can reference this variable in the Services tab only. |
String |
request.message. strippedMessage
|
The text, not including the keyword, from the most recent SMS message received in the session. Note that if the request period does not include a received SMS message, then the variable does not reference any value. You can reference this variable in the Services tab only. |
String |
request.message.smsId |
The SMS ID for the most recent SMS message received in the session. This unique ID is generated by the OpenMarket SMS Gateway and is an integer. Note that if the request period does not include a received SMS message, then the variable does not reference any value. You can reference this variable in the Services tab only. |
Integer |
request.message.date |
The time and date that MEP received the most recent SMS message in the session, in the format yyyy-MM-dd hh:mm:ss. For this timestamp, the SMS Gateway uses the current time and date in London, United Kingdom (either GMT or BST, depending on the time of year). Note that if the request period does not include a received SMS message, then the variable does not reference any value. You can reference this variable in the Services tab only. |
String |
request.message.ucs2
|
For a UCS-2 encoded text message, this variable return a hexadecimal representation of the message. If the message is a standard GSM 03.38 message, the variable will not be populated. You can reference this variable in the Services tab only. |
String |
Multipart message details
The following variables reference the details of multipart messages received by a service. These variables are valid only when the service uses a routing code that reassembles multipart messages (set using the Reassemble multipart messages check box in the routing code window).
The two tables below are split by scope type (request and session). The types of details you can access are the same; however, values accessed using the session scope are accessible throughout an entire session, and in this case, it is the initial SMS message received by the session that the variables will reference. Values accessed using the request scope exists only for the duration of a specific request within a session, and in this case, it is the most recent SMS message that the variables will reference.
The variables using the session scope are:
Variable |
Description |
Type |
---|---|---|
session.initialMessage. |
Whether the first SMS message received in this session was a multipart message or not. This variable returns true if the SMS message is multipart. You can reference this variable in the Services tab only. |
Boolean |
session.initialMessage. |
References the details of multipart messages received by a service. This variable returns the message text from the first SMS received by the session. The first part of a multipart message is accessed using the variable request.message.part[0].message, while the second part of a multipart SMS message is accessed using the variable request.message.part[1].message, etc. Note that if the first SMS received by the session is not a multipart message, then only the variable request.message.part[0].message will return a value. You can reference this variable in the Services tab only. |
String |
session.initialMessage. |
References the details of multipart messages received by a service. This variable returns the time and date that the SMS Gateway received the specified message part of the first SMS message received in the session. The format is yyyy-MM-dd hh:mm:ss. For this timestamp, the SMS Gateway uses the current time and date in London, United Kingdom (either GMT or BST, depending on the time of year). Note that if the first SMS received by the session is not a multipart message, then only the variable request.message.part[0].date will return a value. You can reference this variable in the Services tab only. |
String |
session.initialMessage. |
References the details of multipart messages received by a service. This variable returns the SMS ID for the specified SMS message part of the first SMS message received by the session. This unique ID is generated by the OpenMarket SMS Gateway. Note that if the first SMS received by the session is not a multipart message, then only the variable request.message.part[0].smsid will return a value. You can reference this variable in the Services tab only. |
Integer |
The variables using the request scope are:
Variable |
Description |
Type |
---|---|---|
request.message.isMultipart |
Whether the most recent SMS message received in this session was a multipart message or not. This variable returns true if the SMS message is multipart. You can reference this variable in the Services tab only. |
Boolean |
request.message. |
References the details of multipart messages received by a service. This variable returns the message text from the most recent SMS received by the session. The first part of a multipart message is accessed using the variable request.message.part[0].message, while the second part of a multipart SMS message is accessed using the variable request.message.part[1].message, etc. Note that if the most recent SMS received by the session is not a multipart message, then only the variable request.message.part[0].message will return a value. You can reference this variable in the Services tab only. |
String |
request.message. |
References the details of multipart messages received by a service. This variable returns the time and date that the SMS Gateway received the specified message part of the most recent SMS message received in the session. The format is yyyy-MM-dd hh:mm:ss. For this timestamp, the SMS Gateway uses the current time and date in London, United Kingdom (either GMT or BST, depending on the time of year). Note that if the most recent SMS received by the session is not a multipart message, then only the variable request.message.part[0].date will return a value. You can reference this variable in the Services tab only. |
String |
request.message. |
References the details of multipart messages received by a service. This variable returns the SMS ID for the specified SMS message part of the most recent SMS message received by the session. This unique ID is generated by the OpenMarket SMS Gateway. Note that if the most recent SMS received by the session is not a multipart message, then only the variable request.message.part[0].smsid will return a value. You can reference this variable in the Services tab only. |
Integer |