Below are some examples of how you can use the TypeScript SDK to interact with the Convore API.

Retrieve emails in a thread

convore.messages.listMessages({ conversationId: `conv_dasfsadf1234`})
[
	{
		"subject": "Your expenses are missing information",
		"sender": { "name": "Brex", "handle": { value: "receipts@brex.com", type: "email" }, "role": "from"},
		"recipients": [
			{	"name": "Diane Smith", "handle": { value: "diane@customer.com", type: "email" } , "role": "to" }
		],
		"text_body": "Reply to this email with your receipts attached."
		// ...
	},
	{
		"subject": "RE: Your expenses are missing information"
		"sender": { "name": "Diane Smith", "handle": { value: "diane@customer.com", type: "email" },	"role": "from" },
		"recipients": [
			{ "name": "Brex", "handle": { value: "receipts@brex.com", type: "email" }, "role": "to"}
		]
	  "text_body": "See attached",
		"attachments": [
				{
						"id": "att_1hdafsdfasdf",
						"filename": "receipt.png",
						"content_type": "image/png",
						"size": 200030,
						"link": "https://api.convore.dev/v1/attachments/att_1hdafsdfasdf/download"
				}
		]
		// ...
	}
]

Send a new message to start a conversation.

convore.messages.sendMessage({
	subject: "Your expenses are missing information",
	to: "Diane Smith <diane@customer.com>",
	body: "Reply to this email with your receipts attached."
})

Reply to a message in a conversation.

convore.messages.sendMessage({
	replyToMessageId: "msg_123124134124",
	body: "We found three matching expenses. Looks like the your reciept for Uber is not matching our records. Can you double check?",
})