How can I add Email Correspondence to a Doctype's timeline?

I am trying to add an email to the timeline section, similar to how comments are added. Not sure how to go about it.

To be clear, this email is sent using an external app, that record is being synched into ERPNext and I want to show it under the Lead Doctype.

I want to do something like this

You can easily add a comment with doc.add_comment('Comment', text='Test Comment')

Any ideas how to add an email?

I think this should do it

if not updated:
			_comments.append(
				{
					"comment": get_truncated(doc.content),
					# "comment_email" for Comment and "sender" for Communication
					"by": getattr(doc, "comment_email", None) or getattr(doc, "sender", None) or doc.owner,
					"name": doc.name,
				}
			)

		update_comments_in_parent(doc.reference_doctype, doc.reference_name, _comments)

Turns out you only need to insert a Communication doctype entry

comm = frappe.get_doc({
	'doctype': 'Communication',
	'subject': campaign.title, 
	'communication_medium': 'Email', 
	'sender': campaign.sender, 
	'recipients': doc.email, 
	'content': 'Campaign Subject: ' + campaign.title, 
	'text_content': None, 
	'communication_type': 'Communication', 
	'status': 'Linked', 
	'sent_or_received': 'Sent', 
	'communication_date': now(),  
	'sender_full_name': 'Mailjet',
	'reference_doctype': 'Lead', 
	'reference_name': lead_name, 
	'reference_owner': 'Administrator', 
	'user': 'Administrator', 
	'message_id': '', 
	'email_status': 'Open',
	'has_attachment': 1,
	'docstatus': 1, 
})
comm.insert(ignore_permissions=True)