This is the RMM functionality we have implemented to capture customers response to our Marketing email and send that customer's response to an external API endpoint.

We are trying to send Json payload to an external API endpoint using HTTPPOST2 ampscript function which is implemented in marketing cloud Email. but system is encountering an error with below error , and it is not even reaching to API end point , we are sending customers response to API endpoint using standard RMM Personalization strings

Below is the response we received from HTTPPOST2 ampscript function

"message":"The request content is not valid and could not be deserialized: 
'Unable to translate bytes [B9] at index 355 from specified code page to Unicode.'
."}} " 

Below AMPscript code is implemented in triggered Email , once customer reply to our marketing emails we are triggering emails with below ampscript to send customer's response to endpoint , I can not share Email and email response which causing the issue , but for plain , text email it is working fine we are able to send payload to external API successfully , the issue is with email with some special character or some content not compatible with Json ( not sure)

Below AMPscript code is implemented in triggered Email


set @FirstName = RequestParameter('FirstName')
set @LastName = RequestParameter('LastName')
set @email = RequestParameter('email')
set @SubscriberKey = _RMM_RecipientSubscriberKey
set @Email_Address = _RMM_RecipientEmailAddress
SET @replymsg = _replycontent

set @authurl = "https://staging/SampleEndpoint/"
set @payload = Concat('{"FirstName": "',@FirstName,'","LastName": "',@LastName,'","Email": "',@email,'","replymsg":"',@replymsg,'","SubscriberKey":"',@SubscriberKey,'","Email_Address":"',@Email_Address,'"}')
set @key = "xxxxxxxxx-secret-key"

SET @httppost = HTTPPost2(@authurl,"application/json",@payload,false,@apistatusCode,@respheader,"Key",@key)


Not sure if there is any non JSON format character in Payload ?

  • Please share your script incl. the payload
    – zuzannamj
    Commented Nov 10, 2022 at 12:26
  • @zuzannamj Script and other details are updated , please check
    – JNC
    Commented Nov 10, 2022 at 13:20

1 Answer 1


Two things I noticed in your code:

  1. You have two @ symbols in front of the @payload variable
  2. You have two commas in a row in your payload CONCAT which is likely causing the issue:

You will see the double comma after @replymsg and after @SubscriberKey.

So it should be:

set @payload = Concat('{"FirstName": "',@FirstName,'","LastName": "',@LastName,'","Email": "',@email,'","replymsg": "',@replymsg,'","SubscriberKey": "',@SubscriberKey,'","Email_Address": "',@Email_Address,'"}')

As to your issue with conflicting characters, likely you will want to do some Replaces on your content to handle potential conflicting characters. For instance something like below examples:

Set @replyMsg = Replace(@replyMsg,'"', '\"')

Which would then escape each of your double quotation marks inside of the replyMsg variable which are most likely the major culprit. Outside that would want to shift things along the lines of { and }, [ and ], etc.

  • Hi @Gortonington , Thank you for your reply , those extra commas and extra @ were actually typos , My code is working fine if we use text/plain email as marketing email and once customer reply ( SET @ replymsg = _replycontent RMM String ) "_replycontent" - it capture customer response as well as customer original email content , but causing an issue with special character , content in original marketing email and on that if customer reply.
    – JNC
    Commented Nov 10, 2022 at 13:56
  • @JNC - Correct which is the second part of my answer talking about utilizing the Replace() function in AMPscript. Commented Nov 10, 2022 at 13:59
  • Hi Gortonington , Thank you for suggestion and details. There are some special characters , superscript and subscripts in @replyMsg like ( © , $100K¹ , 2 years² , credit³ , 3 days¹ ) causing this issue . I am thinking to use ReplcaeList ampscript function and replace with Blank value. ReplaceList(@replyMsg,' ', '©', '¹', '²', '³') , but in that case I need to enter every possible special character and subscript and superscript which causing the issue . Do we have any AMPscript function which will convert code page to Unicode ?
    – JNC
    Commented Nov 12, 2022 at 16:59

You must log in to answer this question.

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