Article published on the 29th of October, 2025.
This article extends the article about using AI to create entities from an e-mail, which you can find here, as well as the article where we automate setting the Customer field, which you read read about in this article.
Contents
1. Introduction
In this article, we will, as part of a process to create a new case from an e-mail, also create a set of tasks suggested to us by an AI model analyzing the e-mail.
In the previous article, we prompt an AI model to give us structured case metadata based on an analysis of an e-mail. This enables the AI model to take the contents of an e-mail and suggesting metadata for a case, which we can then create in WorkPoint.
We are going to tweak the system prompt letting the AI model know what we need from it, to make it also return a set of tasks for the case, which we will then create as the last step of our WorkPoint Automate process.
2. Editing System Prompt
Currently, we are asking our AI model to return us structured case metadata as well as a suggested reply, based on an unstructured e-mail.
We are doing so by giving the AI model the following system prompt:
{
"input": [
{
"role": "system",
"content": "You are an AI assistant that extracts unstructured case information from an email message (provided as a JSON document from the Microsoft Graph Messages endpoint) formatted in HTML. You must strip the body from HTML and analyze the body content.\n\nYour job is to read the email text and return **only** a JSON object containing two top-level properties: `Case` and `SuggestedReply`. Do not include any other properties or text outside the JSON.\n\n### CASE INFORMATION (inside the `Case` object):\n- `Title`: A short descriptive title summarizing the main purpose of the email.\n- `ccCaseType`: One of `Standard`, `Purchase`, `Complaint`, or `Service & Repair`. Choose the most appropriate type.\n- `wpStartDate`: The current UTC date formatted as `MM/DD/YYYY`.\n- `wpDueDate`: The date **14 days after** `wpStartDate`, formatted as `MM/DD/YYYY`.\n- `wpPriority`: One of `Low`, `Medium`, or `High` based on urgency or tone.\n- `wpRisk`: One of `Low`, `Medium`, or `High` based on the potential impact.\n- `wpBudget`: A suggested numeric budget amount appropriate for the situation.\n- `wpDepartment`: One of `Standard`, `Complaint`, `Purchase`, or `Service & Repair`. Choose the most appropriate department based on the content.\n- `wpDescription`: A concise summary of the email contents.\n\n### SUGGESTED REPLY (in `SuggestedReply`):\nWrite a polite, professional reply addressing the sender’s main concern.\nEnd the reply with:\n- “Best regards, [current user’s name]” if known, otherwise\n- “Best regards, The Northwind Team”.\n\n### OUTPUT FORMAT:\nReturn **only** a JSON object exactly in this structure:\n```\n{\n \"Case\": {\n \"Title\": \"\",\n \"ccCaseType\": \"\",\n \"wpStartDate\": \"\",\n \"wpDueDate\": \"\",\n \"wpPriority\": \"\",\n \"wpRisk\": \"\",\n \"wpBudget\": 0,\n \"wpDepartment\": \"\",\n \"wpDescription\": \"\"\n },\n \"SuggestedReply\": \"\"\n}\n```\n\nDo not include any explanations, comments, or extra fields. Only return this JSON object. Return the JSON object as raw JSON, not as a string. Do not escape characters like \\n or \\\\. Do not wrap the JSON in quotes."
},
{
"role": "user",
"content": "[messageData]"
}
],
"max_output_tokens": 16384,
"model": "gpt-5-mini"
}
Since we want to extend the prompt so that the AI model also returns a set of tasks to create, we tweak the system prompt like this:
{
"input": [
{
"role": "system",
"content": "You are an AI assistant that extracts unstructured case information from an email message (provided as a JSON document from the Microsoft Graph Messages endpoint) formatted in HTML. You must strip the body from HTML and analyze the body content.\n\nYour job is to read the email text and return **only** a JSON object containing three top-level properties: `Case`, `SuggestedReply`, and `Tasks`. Do not include any other properties or text outside the JSON.\n\n### CASE INFORMATION (inside the `Case` object):\n- `Title`: A short descriptive title summarizing the main purpose of the email.\n- `ccCaseType`: One of `Standard`, `Purchase`, `Complaint`, or `Service & Repair`. Choose the most appropriate type.\n- `wpStartDate`: The current UTC date formatted as `MM/DD/YYYY`.\n- `wpDueDate`: The date **14 days after** `wpStartDate`, formatted as `MM/DD/YYYY`.\n- `wpPriority`: One of `Low`, `Medium`, or `High` based on urgency or tone.\n- `wpRisk`: One of `Low`, `Medium`, or `High` based on the potential impact.\n- `wpBudget`: A suggested numeric budget amount appropriate for the situation.\n- `wpDepartment`: One of `Standard`, `Complaint`, `Purchase`, or `Service & Repair`. Choose the most appropriate department based on the content.\n- `wpDescription`: A concise summary of the email contents.\n\n### SUGGESTED REPLY (in `SuggestedReply`):\nWrite a polite, professional reply addressing the sender’s main concern.\nEnd the reply with:\n- “Best regards, [current user’s name]” if known, otherwise\n- “Best regards, The Northwind Team”.\n\n### TASKS (in `Tasks` array):\nSuggest at least two tasks related to the case. Each task must be an object with:\n- `Title`: A short actionable task name.\n- `Body`: A short description of what the task involves.\n- `TaskStatus`: Always set to `Not started`.\n\n### OUTPUT FORMAT:\nReturn **only** a JSON object exactly in this structure:\n```\n{\n \"Case\": {\n \"Title\": \"\",\n \"ccCaseType\": \"\",\n \"wpStartDate\": \"\",\n \"wpDueDate\": \"\",\n \"wpPriority\": \"\",\n \"wpRisk\": \"\",\n \"wpBudget\": 0,\n \"wpDepartment\": \"\",\n \"wpDescription\": \"\"\n },\n \"SuggestedReply\": \"\",\n \"Tasks\": [\n {\n \"Title\": \"\",\n \"Body\": \"\",\n \"TaskStatus\": \"Not started\"\n },\n {\n \"Title\": \"\",\n \"Body\": \"\",\n \"TaskStatus\": \"Not started\"\n }\n ]\n}\n```\n\nDo not include any explanations, comments, or extra fields. Only return this JSON object. Return the JSON object as raw JSON, not as a string. Do not escape characters like \\n or \\\\. Do not wrap the JSON in quotes."
},
{
"role": "user",
"content": "[messageData]"
}
],
"max_output_tokens": 16384,
"model": "gpt-5-mini"
}
In this new prompt, we end by asking the AI model to include an array of tasks, giving each task a title, a body (description), and a task status, which is always set to "Not started".
When calling our gpt-5-mini endpoint, which we set up in the previous article, with this new prompt on an e-mail, it produces an output like the following:
{
"id": "resp_0d12eaf010c7e23f006901de4789788195a9d3d2e57068e351",
"object": "response",
"created_at": 1761730119,
"status": "completed",
"background": false,
"content_filters": null,
"error": null,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": 16384,
"max_tool_calls": null,
"model": "gpt-5-mini",
"output": [
{
"id": "rs_0d12eaf010c7e23f006901de4832bc8195959adc43b16f8d44",
"type": "reasoning",
"summary": []
},
{
"id": "msg_0d12eaf010c7e23f006901de56d68081959197c8ac702919b5",
"type": "message",
"status": "completed",
"content": [
{
"type": "output_text",
"annotations": [],
"logprobs": [],
"text": "{\n \"Case\": {\n \"Title\": \"Repair request for leased BX-5060 unit\",\n \"ccCaseType\": \"Service & Repair\",\n \"wpStartDate\": \"10/29/2025\",\n \"wpDueDate\": \"11/12/2025\",\n \"wpPriority\": \"High\",\n \"wpRisk\": \"Medium\",\n \"wpBudget\": 200,\n \"wpDepartment\": \"Service & Repair\",\n \"wpDescription\": \"Customer Anders Møker requests repair of a leased BX-5060 unit that is faulty. He needs the unit serviced and returned ahead of a convention in two weeks and asks for next steps including any required forms and shipping instructions.\"\n },\n \"SuggestedReply\": \"Dear Anders,\\n\\nThank you for letting me know and I’m sorry to hear the BX-5060 is faulty. We can arrange a return and repair and will prioritise this to meet your upcoming convention. To get started, please provide the unit serial number and your leasing agreement number (or the lease reference), and confirm the preferred shipping address for return of the repaired unit. Once I have that information I will generate an RMA, send you the required form and packing/shipping instructions (and a prepaid label if applicable), and confirm an estimated turnaround time. If you prefer expedited handling, please let me know and I will note that on the repair order.\\n\\nI appreciate the urgency and will work to get this resolved quickly. Please reply with the serial and lease reference when convenient.\\n\\nBest regards, John\",\n \"Tasks\": [\n {\n \"Title\": \"Generate RMA and repair order\",\n \"Body\": \"Create an RMA for the BX-5060, record serial number and lease reference, and set repair priority to meet customer's timeline.\",\n \"TaskStatus\": \"Not started\"\n },\n {\n \"Title\": \"Send shipping instructions and forms\",\n \"Body\": \"Email the customer the RMA form, packing and shipping instructions, and a prepaid shipping label if available.\",\n \"TaskStatus\": \"Not started\"\n },\n {\n \"Title\": \"Schedule expedited repair and update customer\",\n \"Body\": \"Coordinate with service team to reserve repair slot, estimate turnaround time, and notify the customer of expected repair completion and return shipment details.\",\n \"TaskStatus\": \"Not started\"\n }\n ]\n}"
}
],
"role": "assistant"
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"prompt_cache_key": null,
"reasoning": {
"effort": "medium",
"summary": null
},
"safety_identifier": null,
"service_tier": "default",
"store": true,
"temperature": 1,
"text": {
"format": {
"type": "text"
},
"verbosity": "medium"
},
"tool_choice": "auto",
"tools": [],
"top_logprobs": 0,
"top_p": 1,
"truncation": "disabled",
"usage": {
"input_tokens": 4854,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 1394,
"output_tokens_details": {
"reasoning_tokens": 896
},
"total_tokens": 6248
},
"user": null,
"metadata": {}
}
If we format the output text returned by the AI model, we get something like this (note the Tasks array):
{
"Case": {
"Title": "Repair request for leased BX-5060 unit",
"ccCaseType": "Service & Repair",
"wpStartDate": "10/29/2025",
"wpDueDate": "11/12/2025",
"wpPriority": "High",
"wpRisk": "Medium",
"wpBudget": 200,
"wpDepartment": "Service & Repair",
"wpDescription": "Customer Anders Møker requests repair of a leased BX-5060 unit that is faulty. He needs the unit serviced and returned ahead of a convention in two weeks and asks for next steps including any required forms and shipping instructions."
},
"SuggestedReply": "Dear Anders,\n\nThank you for letting me know and I’m sorry to hear the BX-5060 is faulty. We can arrange a return and repair and will prioritise this to meet your upcoming convention. To get started, please provide the unit serial number and your leasing agreement number (or the lease reference), and confirm the preferred shipping address for return of the repaired unit. Once I have that information I will generate an RMA, send you the required form and packing/shipping instructions (and a prepaid label if applicable), and confirm an estimated turnaround time. If you prefer expedited handling, please let me know and I will note that on the repair order.\n\nI appreciate the urgency and will work to get this resolved quickly. Please reply with the serial and lease reference when convenient.\n\nBest regards, John",
"Tasks": [
{
"Title": "Generate RMA and repair order",
"Body": "Create an RMA for the BX-5060, record serial number and lease reference, and set repair priority to meet customer's timeline.",
"TaskStatus": "Not started"
},
{
"Title": "Send shipping instructions and forms",
"Body": "Email the customer the RMA form, packing and shipping instructions, and a prepaid shipping label if available.",
"TaskStatus": "Not started"
},
{
"Title": "Schedule expedited repair and update customer",
"Body": "Coordinate with service team to reserve repair slot, estimate turnaround time, and notify the customer of expected repair completion and return shipment details.",
"TaskStatus": "Not started"
}
]
}
We can now take this Tasks array and use it to create the suggested tasks after creating the case.
3. Editing the "Create case from e-mail" process
Currently, our Create case from e-mail process is configured as follows:
From here, we will add a Create documents, folders and items step at the bottom:
Here, we have added the Create documents, folders and items step, and given it a fitting title and description.
- In the "Step Input" field, we need to provide an array of tasks to create. In this case, we have added the following expression:
[json(AnalyzeEmail.output[1].content[0].text).Tasks]
The json(AnalyzeEmail.output[1].content[0].text) turns that string into a usable object, and we then point to the "Tasks" array for Step Input. This should allow the step to create each task in the Tasks array.
In the Options tab, we configure the settings like so:
Importantly, we point to the Tasks list on the newly created case, and select to overwrite existing tasks, if applicable.
This should be all we need to configure, and we can now save and publish the process and test it out:
- With an e-mail selected, we run the process from Express 365
The AI model now read and analyzes the e-mail:
Once the analysis is complete, we see the suggested metadata in our Entity form:
Next, we click Continue, which takes us through the Create case step, as well as the Create tasks step:
When the process completes, we can see the new case in the WorkPoint solution:
If we go into the case site, and open the Tasks list, we see the tasks suggested by the AI model:
We now successfully tweaked our system prompt for our AI model and implemented the response into the process to create it's suggested tasks.
Comments
0 comments
Please sign in to leave a comment.