Need to know what's wrong with json

I am using Http request and using json body as
$@“{{”“templateId”“: ““xyz””,”“saveAsActivity”" : true,““orgWideEmailAddressId”” :““sas””,““treatTargetObjectAsRecipient”” :false,““targetObjectId”” : ““asa””,““whatId”” : ““asa””, ““toAddresses”” : [““xyx@gmail.com””], ““entityAttachments”” : [““0986223dshg””]}}"

when I run the project the response that I get is “EmailResponseMake sure that senderId, recipientMobile, smsTemplateId or messageText are populated”, I have already hardcoded those values in json format. json validation doesn’t gives any error as such.

Hi @Shailendra_Sajwan1

Try with below Json data

{
  "templateId": "xyz",
  "saveAsActivity": true,
  "orgWideEmailAddressId": "sas",
  "treatTargetObjectAsRecipient": false,
  "targetObjectId": "asa",
  "whatId": "asa",
  "toAddresses": ["xyx@gmail.com"],
  "entityAttachments": ["0986223dshg"]
}

Hope it helps!!

this json doesn’t validate, the json that I uploaded validates

@Shailendra_Sajwan1
Okay May I Know what you want to extract from it

I am sending this json as a request body of http request to send an email, I am providing values of fields in json to send an email. I am not extracting anything form json

Did you understand my requirement?

@Shailendra_Sajwan1,

It’s the issue of escaping sequences. Here is how you should format it in UiPath, ensuring proper escape sequences for double quotes

$@"{{
  ""templateId"": ""xyz"",
  ""saveAsActivity"": true,
  ""orgWideEmailAddressId"": ""sas"",
  ""treatTargetObjectAsRecipient"": false,
  ""targetObjectId"": ""asa"",
  ""whatId"": ""asa"",
  ""toAddresses"": [""xyx@gmail.com""],
  ""entityAttachments"": [""0986223dshg""]
}}"

Thanks,
Ashok :slight_smile:

Still getting the same response “message”: “EmailResponseMake sure that senderId, recipientMobile, smsTemplateId or messageText are populated” after using what you have mentioned

I do not know what HTTP request you are doing, but from the response it seems that you do not provide some required values…

Cheers

@Shailendra_Sajwan1,

The API endpoint expecting these fields in json which are missing from your json.

senderId, recipientMobile, smsTemplateId or messageText

Thanks,
Ashok :slight_smile:

If request with the same JSON body passes in Postman then problem is not JSON body…
Check other parts of the HTTP request: headers, authorization.

Also there might be in Postman some pre-request scripts at environment level that modify the request.

Cheers

1 Like

issue is resolved, issue was with the header and url

1 Like

Thanks the issue is resolved

1 Like