{
  "openapi": "3.0.4",
  "info": {
    "title": "ChatGPT API",
    "description": "Azure OpenAI integrations",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://chatgpt.api.snokam.no"
    }
  ],
  "paths": {
    "/v1.0/protected/extract": {
      "post": {
        "tags": [
          "Extraction"
        ],
        "summary": "Extract structured data from a document or context",
        "description": "Generic AI extraction: supply an instruction, a JSON schema (as a string), and a PDF and/or text context. Returns JSON matching the supplied schema.",
        "operationId": "extractStructured",
        "requestBody": {
          "description": "Instruction, JSON schema, and the PDF and/or text to extract from",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/extractStructuredRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Payload of Object",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "x-ms-summary": "Extracted JSON matching the supplied schema"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/protected/health/{provider}": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Checks an integration's connectivity",
        "operationId": "ChatGptIntegrationHealth",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Payload of IntegrationHealthResult",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/integrationHealthResult"
                }
              }
            },
            "x-ms-summary": "Health result"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/newsletter/summary": {
      "post": {
        "tags": [
          "Newsletter"
        ],
        "summary": "Summarize newsletter of a given topic",
        "description": "Reads last week's newsletter mails and returns summary",
        "operationId": "summarizeNewsletter",
        "parameters": [
          {
            "name": "topic",
            "in": "query",
            "description": "Topic to summarize, e.g. AI",
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "Technology topic"
          },
          {
            "name": "mailbox",
            "in": "query",
            "description": "Override the mailbox the summarizer reads, e.g. fag-feed@snokam.no. Falls back to the environment default.",
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "Shared mailbox to read"
          }
        ],
        "responses": {
          "200": {
            "description": "Summary of the newsletter for the specified topic",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/simpleResponseDto"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "422": {
            "description": "No summary fit to send; the answer holds the reason",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/simpleResponseDto"
                }
              }
            },
            "x-ms-summary": "Rejected"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/newsletter/single-news": {
      "post": {
        "tags": [
          "AI News"
        ],
        "summary": "Get a single AI news item",
        "description": "Fetches one AI news item from recent emails",
        "operationId": "getSingleNews",
        "parameters": [
          {
            "name": "topic",
            "in": "query",
            "description": "Topic to summarize, e.g. AI",
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "Technology topic"
          }
        ],
        "responses": {
          "200": {
            "description": "A single AI news item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/simpleResponseDto"
                }
              }
            },
            "x-ms-summary": "Success"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/protected/question": {
      "get": {
        "tags": [
          "Question"
        ],
        "summary": "Synchronously answer a question using ChatGPT",
        "description": "This function synchronously answers a question using ChatGPT.",
        "operationId": "protectedSyncQuestion",
        "parameters": [
          {
            "name": "input",
            "in": "query",
            "description": "The question input to be answered",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "The question input"
          },
          {
            "name": "addDefaultPrompts",
            "in": "query",
            "description": "If true, default prompts from the Prompts folder will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include Default Prompts"
          },
          {
            "name": "addApiTools",
            "in": "query",
            "description": "If true, API tools will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include API Tools"
          }
        ],
        "responses": {
          "200": {
            "description": "Question answered successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/simpleResponseDto"
                }
              }
            },
            "x-ms-summary": "Success"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/protected/question/async": {
      "get": {
        "tags": [
          "Question"
        ],
        "summary": "Asynchronously answer a question using ChatGPT",
        "description": "This function asynchronously answers a question using ChatGPT.",
        "operationId": "protectedAsyncQuestion",
        "parameters": [
          {
            "name": "input",
            "in": "query",
            "description": "The question input to be answered",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "The question input"
          },
          {
            "name": "addDefaultPrompts",
            "in": "query",
            "description": "If true, default prompts from the Prompts folder will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include Default Prompts"
          },
          {
            "name": "addApiTools",
            "in": "query",
            "description": "If true, API tools will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include API Tools"
          }
        ],
        "responses": {
          "200": {
            "description": "Question answered successfully",
            "x-ms-summary": "Success"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/protected/conversation": {
      "post": {
        "tags": [
          "Conversation"
        ],
        "summary": "Synchronously handle a conversation using ChatGPT",
        "description": "This function synchronously handles a conversation using ChatGPT.",
        "operationId": "protectedSyncConversation",
        "parameters": [
          {
            "name": "addDefaultPrompts",
            "in": "query",
            "description": "If true, default prompts from the Prompts folder will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include Default Prompts"
          },
          {
            "name": "addApiTools",
            "in": "query",
            "description": "If true, API tools will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include API Tools"
          }
        ],
        "requestBody": {
          "description": "List of chat messages",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/inputChatMessage"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Conversation handled successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/simpleResponseDto"
                }
              }
            },
            "x-ms-summary": "Success"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/protected/conversation/async": {
      "post": {
        "tags": [
          "Conversation"
        ],
        "summary": "Asynchronously handle a conversation using ChatGPT",
        "description": "This function asynchronously handles a conversation using ChatGPT.",
        "operationId": "protectedAsyncConversation",
        "parameters": [
          {
            "name": "addDefaultPrompts",
            "in": "query",
            "description": "If true, default prompts from the Prompts folder will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include Default Prompts"
          },
          {
            "name": "addApiTools",
            "in": "query",
            "description": "If true, API tools will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include API Tools"
          }
        ],
        "requestBody": {
          "description": "List of chat messages",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/inputChatMessage"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Conversation handled successfully",
            "x-ms-summary": "Success"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/question": {
      "get": {
        "tags": [
          "Question"
        ],
        "summary": "Synchronously answer a question using ChatGPT",
        "description": "This function synchronously answers a question using ChatGPT.",
        "operationId": "syncQuestion",
        "parameters": [
          {
            "name": "input",
            "in": "query",
            "description": "The question input to be answered",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "The question input"
          },
          {
            "name": "addDefaultPrompts",
            "in": "query",
            "description": "If true, default prompts from the Prompts folder will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include Default Prompts"
          },
          {
            "name": "addApiTools",
            "in": "query",
            "description": "If true, API tools will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include API Tools"
          }
        ],
        "responses": {
          "200": {
            "description": "Question answered successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/simpleResponseDto"
                }
              }
            },
            "x-ms-summary": "Success"
          }
        }
      }
    },
    "/v1.0/question/async": {
      "get": {
        "tags": [
          "Question"
        ],
        "summary": "Asynchronously answer a question using ChatGPT",
        "description": "This function asynchronously answers a question using ChatGPT.",
        "operationId": "asyncQuestion",
        "parameters": [
          {
            "name": "input",
            "in": "query",
            "description": "The question input to be answered",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "The question input"
          },
          {
            "name": "addDefaultPrompts",
            "in": "query",
            "description": "If true, default prompts from the Prompts folder will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include Default Prompts"
          },
          {
            "name": "addApiTools",
            "in": "query",
            "description": "If true, API tools will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include API Tools"
          }
        ],
        "responses": {
          "200": {
            "description": "Question answered successfully",
            "x-ms-summary": "Success"
          }
        }
      }
    },
    "/v1.0/conversation": {
      "post": {
        "tags": [
          "Conversation"
        ],
        "summary": "Synchronously handle a conversation using ChatGPT",
        "description": "This function synchronously handles a conversation using ChatGPT.",
        "operationId": "syncConversation",
        "parameters": [
          {
            "name": "addDefaultPrompts",
            "in": "query",
            "description": "If true, default prompts from the Prompts folder will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include Default Prompts"
          },
          {
            "name": "addApiTools",
            "in": "query",
            "description": "If true, API tools will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include API Tools"
          }
        ],
        "requestBody": {
          "description": "List of chat messages",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/inputChatMessage"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Conversation handled successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/simpleResponseDto"
                }
              }
            },
            "x-ms-summary": "Success"
          }
        }
      }
    },
    "/v1.0/conversation/async": {
      "post": {
        "tags": [
          "Conversation"
        ],
        "summary": "Asynchronously handle a conversation using ChatGPT",
        "description": "This function asynchronously handles a conversation using ChatGPT.",
        "operationId": "asyncConversation",
        "parameters": [
          {
            "name": "addDefaultPrompts",
            "in": "query",
            "description": "If true, default prompts from the Prompts folder will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include Default Prompts"
          },
          {
            "name": "addApiTools",
            "in": "query",
            "description": "If true, API tools will be added to the chat context.",
            "schema": {
              "type": "boolean"
            },
            "x-ms-summary": "Include API Tools"
          }
        ],
        "requestBody": {
          "description": "List of chat messages",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/inputChatMessage"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Conversation handled successfully",
            "x-ms-summary": "Success"
          }
        }
      }
    },
    "/v1.0/public/blob-storage": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Gets blob storage and creates sas token",
        "description": "Generates a sas token for use to upload image and video memories to azure blob storage",
        "operationId": "GetBlobStorage",
        "responses": {
          "200": {
            "description": "Generated token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/azureBlobStorageCredentials"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "401": {
            "description": "User is not authorized",
            "x-ms-summary": "Unauthorized"
          }
        }
      }
    },
    "/v1.0/slack/event": {
      "post": {
        "tags": [
          "Slack"
        ],
        "summary": "Handle a Slack event",
        "description": "This function handles a Slack event.",
        "operationId": "slackEvent",
        "requestBody": {
          "description": "Slack event data",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/slackEvent"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Slack event handled successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/slackEvent"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "204": {
            "description": "No relevant Slack event found",
            "x-ms-summary": "No Content"
          }
        }
      }
    },
    "/v1.0/realtime/get-ephemeral-token": {
      "post": {
        "tags": [
          "Realtime"
        ],
        "summary": "Get ephemeral token for Azure OpenAI realtime session",
        "description": "Returns Azure OpenAI connection details for a realtime session. Use `agent` query param to switch assistant behavior.",
        "operationId": "GetEphemeralToken",
        "parameters": [
          {
            "name": "agent",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "Agent (e.g. 'create-event', 'default')"
          },
          {
            "name": "voice",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "Voice (e.g. 'ash', 'alloy')"
          }
        ],
        "responses": {
          "200": {
            "description": "Payload of RealtimeSession",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/realtimeSession"
                }
              }
            },
            "x-ms-summary": "Session started"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/protected/realtime/usage-report": {
      "post": {
        "tags": [
          "Realtime"
        ],
        "summary": "Report token usage for a realtime session",
        "description": "Records cumulative token totals streamed to the client by the realtime API. Reports are validated against the session registry; unknown, expired or already-recorded reports are acknowledged without recording.",
        "operationId": "ReportRealtimeUsage",
        "requestBody": {
          "description": "Cumulative session token totals",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/realtimeUsageReport"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Payload of RealtimeUsageAck",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/realtimeUsageAck"
                }
              }
            },
            "x-ms-summary": "Report acknowledged"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1.0/realtime/agents": {
      "get": {
        "tags": [
          "Realtime"
        ],
        "summary": "List all available contexts",
        "description": "Lists all predefined context modes for GPT-4o realtime sessions",
        "operationId": "GetAvailableAgents",
        "responses": {
          "200": {
            "description": "Payload of Array of RealtimeAgentsDto",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/realtimeAgentsDto"
                  }
                }
              }
            },
            "x-ms-summary": "Contexts listed"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/followup-email": {
      "post": {
        "tags": [
          "Follow-up Email"
        ],
        "summary": "Generate a follow-up email for a company, and save it as a draft in the pre-configured mailbox",
        "description": "Generates a personalized follow-up email using Salesforce data and external research",
        "operationId": "generateFollowUpEmail",
        "parameters": [
          {
            "name": "companyName",
            "in": "query",
            "description": "The name of the company to generate a follow-up email for",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "Company name"
          }
        ],
        "responses": {
          "200": {
            "description": "The generated follow-up email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/followUpEmailResponse"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "400": {
            "description": "Invalid input parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                }
              }
            },
            "x-ms-summary": "Bad Request"
          },
          "500": {
            "description": "An error occurred while generating the email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                }
              }
            },
            "x-ms-summary": "Internal Server Error"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      },
      "get": {
        "tags": [
          "Follow-up Email"
        ],
        "summary": "Generate follow-up email content for a company",
        "description": "Generates personalized follow-up email content using Salesforce data and external research. Returns the email content without creating a draft.",
        "operationId": "generateFollowUpEmailGet",
        "parameters": [
          {
            "name": "companyName",
            "in": "query",
            "description": "The name of the company to generate a follow-up email for",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "Company name"
          }
        ],
        "responses": {
          "200": {
            "description": "The generated follow-up email content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/emailContentResponse"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "400": {
            "description": "Invalid input parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                }
              }
            },
            "x-ms-summary": "Bad Request"
          },
          "500": {
            "description": "An error occurred while generating the email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                }
              }
            },
            "x-ms-summary": "Internal Server Error"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/followup-email/contact": {
      "post": {
        "tags": [
          "Follow-up Email"
        ],
        "summary": "Generate a follow-up email for a specific contact, and save it as a draft in the pre-configured mailbox",
        "description": "Generates a personalized follow-up email using Salesforce contact data and external research. No email will be sent automatically, but the email will be saved as a draft.",
        "operationId": "generateFollowUpEmailByContact",
        "parameters": [
          {
            "name": "contactId",
            "in": "query",
            "description": "The Salesforce ID of the contact to generate a follow-up email for",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "Contact ID"
          }
        ],
        "responses": {
          "200": {
            "description": "The generated follow-up email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/followUpEmailResponse"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "400": {
            "description": "Invalid input parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                }
              }
            },
            "x-ms-summary": "Bad Request"
          },
          "500": {
            "description": "An error occurred while generating the email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                }
              }
            },
            "x-ms-summary": "Internal Server Error"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      },
      "get": {
        "tags": [
          "Follow-up Email"
        ],
        "summary": "Generate follow-up email content for a specific contact",
        "description": "Generates personalized follow-up email content using Salesforce contact data and external research. Returns the email content without creating a draft.",
        "operationId": "generateFollowUpEmailByContactGet",
        "parameters": [
          {
            "name": "contactId",
            "in": "query",
            "description": "The Salesforce ID of the contact to generate a follow-up email for",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "Contact ID"
          }
        ],
        "responses": {
          "200": {
            "description": "The generated follow-up email content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/emailContentResponse"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "400": {
            "description": "Invalid input parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                }
              }
            },
            "x-ms-summary": "Bad Request"
          },
          "500": {
            "description": "An error occurred while generating the email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                }
              }
            },
            "x-ms-summary": "Internal Server Error"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/followup-email/automated": {
      "post": {
        "tags": [
          "Automated Follow-up"
        ],
        "summary": "Process automated follow-up emails for strategic priority contacts",
        "description": "Processes strategic priority contacts with LastActivity > specified days or null, creating draft emails if no existing drafts exist. This is the same logic that runs daily via CronJob.",
        "operationId": "processAutomatedFollowUpEmails",
        "parameters": [
          {
            "name": "priority",
            "in": "query",
            "description": "The strategic priority to filter contacts. Valid values: A, B, C, D (default: D)",
            "schema": {
              "type": "string"
            },
            "x-ms-summary": "Strategic priority"
          },
          {
            "name": "daysBack",
            "in": "query",
            "description": "Number of days to look back for last activity (default: 90)",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "x-ms-summary": "Days back"
          }
        ],
        "responses": {
          "200": {
            "description": "The processing results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/followUpEmailResponse"
                }
              }
            },
            "x-ms-summary": "Success"
          },
          "500": {
            "description": "An error occurred while processing automated follow-ups",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                }
              }
            },
            "x-ms-summary": "Internal Server Error"
          }
        },
        "security": [
          {
            "Implicit": [
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default"
            ]
          },
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "authorization": {
        "type": "object",
        "properties": {
          "enterprise_id": {
            "type": "object",
            "nullable": true
          },
          "team_id": {
            "type": "string",
            "nullable": true
          },
          "user_id": {
            "type": "string",
            "nullable": true
          },
          "is_bot": {
            "type": "boolean",
            "nullable": true
          },
          "is_enterprise_install": {
            "type": "boolean",
            "nullable": true
          }
        }
      },
      "azureBlobStorageCredentials": {
        "type": "object",
        "properties": {
          "blobUrl": {
            "type": "string"
          },
          "sasToken": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "object",
            "additionalProperties": {
              "type": "object"
            }
          }
        }
      },
      "clientSecret": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "nullable": true
          },
          "expires_at": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          }
        },
        "nullable": true
      },
      "emailContentResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "contactId": {
            "type": "string"
          },
          "salesforceData": {
            "type": "string"
          },
          "externalResearch": {
            "type": "string"
          }
        }
      },
      "errorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": "string"
          }
        }
      },
      "event": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "text": {
            "type": "string",
            "nullable": true
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/file"
            },
            "nullable": true
          },
          "upload": {
            "type": "boolean",
            "nullable": true
          },
          "user": {
            "type": "string",
            "nullable": true
          },
          "display_as_bot": {
            "type": "boolean",
            "nullable": true
          },
          "bot_id": {
            "type": "string",
            "nullable": true
          },
          "ts": {
            "type": "string",
            "nullable": true
          },
          "channel": {
            "type": "string",
            "nullable": true
          },
          "subtype": {
            "type": "string",
            "nullable": true
          },
          "event_ts": {
            "type": "string",
            "nullable": true
          },
          "channel_type": {
            "type": "string",
            "nullable": true
          }
        },
        "nullable": true
      },
      "extractStructuredRequest": {
        "type": "object",
        "properties": {
          "instruction": {
            "type": "string"
          },
          "schema": {
            "type": "string"
          },
          "schemaName": {
            "type": "string"
          },
          "pdfBase64": {
            "type": "string"
          },
          "context": {
            "type": "string"
          }
        }
      },
      "file": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "created": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "timestamp": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "mimetype": {
            "type": "string",
            "nullable": true
          },
          "filetype": {
            "type": "string",
            "nullable": true
          },
          "pretty_type": {
            "type": "string",
            "nullable": true
          },
          "user": {
            "type": "string",
            "nullable": true
          },
          "user_team": {
            "type": "string",
            "nullable": true
          },
          "editable": {
            "type": "boolean",
            "nullable": true
          },
          "size": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "mode": {
            "type": "string",
            "nullable": true
          },
          "is_external": {
            "type": "boolean",
            "nullable": true
          },
          "external_type": {
            "type": "string",
            "nullable": true
          },
          "is_public": {
            "type": "boolean",
            "nullable": true
          },
          "public_url_shared": {
            "type": "boolean",
            "nullable": true
          },
          "display_as_bot": {
            "type": "boolean",
            "nullable": true
          },
          "username": {
            "type": "string",
            "nullable": true
          },
          "url_private": {
            "type": "string",
            "nullable": true
          },
          "url_private_download": {
            "type": "string",
            "nullable": true
          },
          "permalink": {
            "type": "string",
            "nullable": true
          },
          "permalink_public": {
            "type": "string",
            "nullable": true
          },
          "subject": {
            "type": "string",
            "nullable": true
          },
          "to": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/to"
            },
            "nullable": true
          },
          "from": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/from"
            },
            "nullable": true
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "nullable": true
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "nullable": true
          },
          "original_attachment_count": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "plain_text": {
            "type": "string",
            "nullable": true
          },
          "preview": {
            "type": "string",
            "nullable": true
          },
          "preview_plain_text": {
            "type": "string",
            "nullable": true
          },
          "headers": {
            "$ref": "#/components/schemas/headers"
          },
          "has_more": {
            "type": "boolean",
            "nullable": true
          },
          "sent_to_self": {
            "type": "boolean",
            "nullable": true
          },
          "bot_id": {
            "type": "string",
            "nullable": true
          },
          "has_rich_preview": {
            "type": "boolean",
            "nullable": true
          },
          "file_access": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "followUpEmailResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "result": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "contactId": {
            "type": "string"
          }
        }
      },
      "from": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "original": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "headers": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "nullable": true
          },
          "in_reply_to": {
            "type": "string",
            "nullable": true
          },
          "reply_to": {
            "type": "object",
            "nullable": true
          },
          "message_id": {
            "type": "string",
            "nullable": true
          }
        },
        "nullable": true
      },
      "inputChatMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        }
      },
      "integrationHealthResult": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "parameters": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "properties": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/property"
            },
            "nullable": true
          },
          "required": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "nullable": true
      },
      "property": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "realtimeAgentsDto": {
        "type": "object",
        "properties": {
          "context": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "realtimeSession": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "object": {
            "type": "string",
            "nullable": true
          },
          "expires_at": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "input_audio_noise_reduction": {
            "type": "object",
            "nullable": true
          },
          "turn_detection": {
            "$ref": "#/components/schemas/turnDetection"
          },
          "input_audio_format": {
            "type": "string",
            "nullable": true
          },
          "input_audio_transcription": {
            "type": "object",
            "nullable": true
          },
          "client_secret": {
            "$ref": "#/components/schemas/clientSecret"
          },
          "realtime_url": {
            "type": "string",
            "nullable": true
          },
          "session_id": {
            "type": "string",
            "nullable": true
          },
          "include": {
            "type": "object",
            "nullable": true
          },
          "model": {
            "type": "string",
            "nullable": true
          },
          "modalities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "instructions": {
            "type": "string",
            "nullable": true
          },
          "voice": {
            "type": "string",
            "nullable": true
          },
          "output_audio_format": {
            "type": "string",
            "nullable": true
          },
          "tool_choice": {
            "type": "string",
            "nullable": true
          },
          "temperature": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "max_response_output_tokens": {
            "type": "string",
            "nullable": true
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/tool"
            },
            "nullable": true
          }
        }
      },
      "realtimeUsageAck": {
        "type": "object",
        "properties": {
          "accepted": {
            "type": "boolean",
            "nullable": true
          }
        }
      },
      "realtimeUsageReport": {
        "type": "object",
        "properties": {
          "session_id": {
            "type": "string",
            "nullable": true
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "cached_tokens": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          }
        }
      },
      "simpleResponseDto": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string"
          }
        }
      },
      "slackEvent": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "nullable": true
          },
          "team_id": {
            "type": "string",
            "nullable": true
          },
          "context_team_id": {
            "type": "string",
            "nullable": true
          },
          "context_enterprise_id": {
            "type": "object",
            "nullable": true
          },
          "api_app_id": {
            "type": "string",
            "nullable": true
          },
          "event": {
            "$ref": "#/components/schemas/event"
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "event_id": {
            "type": "string",
            "nullable": true
          },
          "event_time": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "authorizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/authorization"
            },
            "nullable": true
          },
          "is_ext_shared_channel": {
            "type": "boolean",
            "nullable": true
          },
          "event_context": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "to": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "original": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "tool": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "parameters": {
            "$ref": "#/components/schemas/parameters"
          },
          "type": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "turnDetection": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "threshold": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "prefix_padding_ms": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "silence_duration_ms": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "create_response": {
            "type": "boolean",
            "nullable": true
          },
          "interrupt_response": {
            "type": "boolean",
            "nullable": true
          }
        },
        "nullable": true
      }
    },
    "securitySchemes": {
      "Implicit": {
        "type": "oauth2",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize",
            "tokenUrl": "https://login.microsoftonline.com/organizations/oauth2/v2.0/token",
            "refreshUrl": "https://login.microsoftonline.com/organizations/oauth2/v2.0/token",
            "scopes": {
              "api://bb21a8d0-366b-4a95-aa59-dbbf708322d1/.default": "Default function scope"
            }
          }
        }
      },
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}