# Notification Template

Notification template is template message to generate mail body when sending a specific mail for each action.

## Create Notification Template

**Example Request**

```
curl --location '{host}/api/v1/notification-templates/' \
--header 'Authorization: Token {Token}' \
--header 'Content-Type: application/json' \
--data '{
    "notification_type": "quotation_created",
    "subject": "quotation_created",
    "template": "Quotation {{ quotation.name }} ({{ quotation.number }}) created."
}'
```

**Example Response (200 OK)**

```json
{
    "id": 8,
    "notification_type": "quotation_created",
    "subject": "quotation_created",
    "template": "Quotation {{ quotation.name }} ({{ quotation.number }}) created.",
    "created_at": "2024-02-01T14:49:27.613403Z",
    "modified_at": "2024-02-01T14:49:27.614573Z"
}
```

**Example Response (400 Bad Request)**

```json
{
    "notification_type": [
        "notification template with this notification type already exists."
    ]
}
```

## List Notification Templates

**Example Request**

```
curl --location '{host}/api/v1/notification-templates/' \
--header 'Authorization: Token {Token}'
```

**Example Response (200 OK)**

```json
{
    "count": 5,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 8,
            "notification_type": "quotation_created",
            "subject": "quotation_created",
            "template": "Quotation {{ quotation.name }} ({{ quotation.number }}) created.",
            "created_at": "2024-02-01T14:49:27.613403Z",
            "modified_at": "2024-02-01T14:49:27.614573Z"
        },
    ],
    ...
}
```

## Get Single Notification Template

**Example Request**

```
curl --location '{host}/api/v1/notification-templates/1/' \
--header 'Authorization: Token {Token}'
```

**Example Response (200 OK)**

```json
{
    "id": 1,
    "notification_type": "quotation_created1",
    "subject": "quotation_created",
    "template": "quotation_created",
    "created_at": "2023-11-15T14:56:16.835914Z",
    "modified_at": "2023-11-15T14:56:16.835923Z"
}
```

**Example Response (404 Not Found)**

```json
{
    "detail": "Not found."
}
```

## Update Notification Template

**Example Request**

```
curl --location --request GET '{host}/api/v1/notification-templates/8/' \
--header 'Authorization: Token {Token}' \
--header 'Content-Type: application/json' \
--data '{
    "notification_type": "quotation_created",
    "subject": "quotation_created",
    "template": "{{ quotation.number }} {{ quotation.name }} {{ quotation.user.email }} updated"
}'
```

**Example Response (200 OK)**

```json
{
    "id": 8,
    "notification_type": "quotation_created",
    "subject": "quotation_created",
    "template": "Quotation {{ quotation.name }} ({{ quotation.number }}) created.",
    "created_at": "2024-02-01T14:49:27.613403Z",
    "modified_at": "2024-02-01T14:49:27.614573Z"
}
```

## Delete Notification Template

**Example Request**

```
curl --location --request DELETE '{host}/api/v1/notification-templates/8/' \
--header 'Authorization: Token {Token}' \
--header 'Content-Type: application/json' \
--data '{
    "notification_type": "quotation_created",
    "subject": "quotation_created",
    "template": "{{ quotation.number }} {{ quotation.name }} {{ quotation.user.email }} updated"
}'
```

**Example Response (204 No Content)**

`204 No Content`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.akinon.com/b2b/notification-template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
