Msg()

Returns the content of a mobile-originated (MO) message. A mobile-originated message is a message sent from the mobile device of a subscriber to your SMS phone number. Compare MO messages to mobile-terminated (MT) messages, which are messages that you send to a subscriber’s mobile device.

You can only use this AMPscript function in MobileConnect. You can’t use this function in email messages, landing pages, or other content types.

Important

Availability 

Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No

Syntax 

1Msg(0)

The Msg() function accepts one parameter. The only accepted value for the parameter is 0.

Usage 

This function returns the complete content of a message that was sent to you by a subscriber (an MO message).

1%%[
2  Var @incoming_message
3  Set @incoming_message = Msg(0)
4]%%
5
6<p>%%=v(@incoming_message)=%%</p>

If an MO message contains the text “OFFER John Smith”, the example code returns the entire body of the message.

See Also