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
{"error":{
"code":"InvalidRequestContent",
"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 ?