Send Email Message from Salesforce Chatter

Hi, I tried to send REST command to Salesforce using the below. How do I relate it to a case? I managed to send the email and received it in my mailbox but it was not related to case. In this case, which field should I use to associate the EmailMessage to the Case?

Using POST to send a simple email message:

/services/data/v52.0/actions/standard/emailSimple

JSON Request body

{
"inputs" : [ {
"emailAddresses" : "Fred@Acme.com",
"emailSubject" : "Note",
"emailBody" : "Message of the day.",
"senderAddress" : "Bill@TheCloud.org"
} ]
}

Thank you.

Hello @athirahhazira ,

Going by your problem statement, you are sending a simple email. The system has no information to state which case that email must be associated with.

There must be some way in the APIs to do that by passing in information regarding the case.

Second, the target system (in this case Salesforce) must be able to identify an incoming email and create a case and then send a response to the sender with a case number in the message.

Do you know if something like that exists on the SF side?

thanks

Hello Athirah,
I don’t know exactly how to connect email with CASE. But I have a video on how to connect FILE to CASE, maybe this logic will help you to solve your issue:

Thanks,
Cristian

Hi Cristian,

Thank you for the video. However it does not resolve the purpose. We would like to send an email from salesforce and relate it to the case ID. Any idea how to achieve this?

Cheers,
Arjun

Base on this Documentation you need add ParentID inside of you JSON:
https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_emailmessage.htm
I think Should be outside of Inputs array.