We're trying to achieve the following workflow with AMPscript and MobileConnect and was wondering if someone could assist.

1. Send an Outbound message (using the Fuel REST MessageContactSend method) with a next keyword to link to a Text Response template.

2. Use a Text Response template (using the next keyword from the Outbound message) that includes AMPScript MSG(0) and NOUN(0) function to check the MO message for the presence of a string and sends a reply based on whether or not the string is present:

%%[ Var @msg  
if (Uppercase([MSG(0).NOUN(0)]) == "yes") then  
Set @msg = "Thank you for consenting to receive messages."
Set @msg = "Invalid response"
endif ]%%  
%%= v(@msg) =%%

3. Use the MSG(O1) function (in the Text Response template) to insert a record into a Data Extension with the response:

SET @message = v([msg(0).nouns])
InsertData("Messages", "message", @message)

This is working fine, but the issue that we are having is that while we can insert the MO response and even the mobile_number into the Data Extension, we cannot seem to insert _subscriberkey. Essentially what I want to achieve is to track individual MO responses to the outbound message. The issue is that mobile_number may not always be unique. That is, if a mobile subscriber receives more than one message, I wan't to identify to which message they are replying to.

I'd also be OK if we could retrieve the original Outbound message using AMPscript, as I can use this to reconcile which message they are replying to.

I note that I can use the getQueueMOHistory API method to retrieve the complete history of the (a) outbound message, (b) the MO Response, and (c) the Text Response:

  "count": 3,
  "createDate": "2015-07-19T14:35:35.51",
  "status": "Active",
  "history": [
      "type": "MT",
      "message": "Would you like to receive communications from us?",
      "date": "2015-07-19T14:35:35.51"
      "type": "MO",
      "message": "yes",
      "date": "2015-07-19T14:36:36.04"
      "type": "MT",
      "message": "Thank you for consenting to receive messages",
      "date": "2015-07-19T14:37:03.88"

So there's obviously a trackable chain here, but is it possible to insert a unique identifier (tokenId from the MessageContactSend method, _subscriberkey or other identifier) using AMPscript into a Data Extension, so I can achieve a similar tracking function?

2 Answers 2


It turns out that _subscriberKey is not available in MobileConnect context, you have to use subscriberId. We can get the subscriberId but even though there is a SubscriberKey field in the SubscriberSMS Data View, that value is empty.


I'm pretty sure the SubscriberKey is the mobile number for SMS Subscribers.

Why not just write your own log by including an InsertData() function in all your messages? Perhaps a Data Extension like this:

Created - default of today's date (primary key) 
Campaign  - some arbitrary, hardcoded value (primary key)
Keyword - hardcoded value (primary key) 
Mobile_Number - (primary key)

This would basically give you a log of all messages and responses, which you could query as needed.

I don't know any way of explicitly tracking conversation threads for a particular mobile number. Those conversations have always been kind of mysterious to me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .