# Rappels

> Index de la documentation : https://wahasend.com/docs/fr/llms.txt · Tout en un fichier : https://wahasend.com/docs/fr.md · URL de base de l'API : https://app.wahasend.com/api/v1

Un rappel est un message à une personne à une heure donnée, une fois ou chaque jour, semaine ou mois (le mensuel garde le jour du mois ; le 31 devient le dernier jour des mois plus courts). Vérifié toutes les 30 secondes. Inclus dans **Notify** (fonction `reminders`). Statuts : `scheduled`, `processing`, `done`, `failed`, `cancelled`.

<a id="reminder-list"></a>

### Lister les rappels

`GET /api/v1/reminders`

Les prochains d'abord (le plus proche en tête), puis les autres (dernier changement en tête).

- Débloqué par: Notify (`reminders`) + Developer ou Connect pour une clé d'API
- Clé du compte seulement

**Paramètres de requête**

| Champ | Type | Obligatoire | Description |
| --- | --- | --- | --- |
| `status` | string | non | `scheduled`, `processing`, `done`, `failed` ou `cancelled`. |
| `search` | string | non | Partie du numéro ou du libellé (100 caractères max). |
| `page` | number | non | Par défaut 1. |
| `limit` | number | non | Par défaut 50, max 100. |

**Exemple**

curl:

```bash
curl "https://app.wahasend.com/api/v1/reminders?status=scheduled&limit=20" \
  -H "X-API-Key: $WAHASEND_API_KEY"
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/reminders?status=scheduled&limit=20', {
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY },
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.get(
    "https://app.wahasend.com/api/v1/reminders?status=scheduled&limit=20",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
)
print(r.json())
```

**Réponse 200**

```json
{
  "success": true,
  "total": 1,
  "page": 1,
  "limit": 20,
  "reminders": [
    {
      "id": "a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28",
      "ownerId": "2c7d0e19-4b8a-4f63-9e21-7a5c3d9b1f08",
      "containerId": null,
      "label": "Rent — flat 3",
      "phone": "+22212345678",
      "message": "Hello {{name}}, your rent of {{amount}} is due tomorrow.",
      "variables": {
        "name": "Aïcha",
        "amount": "45 000 MRU"
      },
      "sendAt": "2026-11-01T09:00:00.000Z",
      "firstSendAt": "2026-10-01T09:00:00.000Z",
      "repeat": "monthly",
      "status": "scheduled",
      "batchId": null,
      "sendCount": 1,
      "lastSentAt": "2026-10-01T09:00:03.412Z",
      "lastMessageId": "4f0c6a1e-2b7d-4c1a-9e35-7d8f2a6b1c90",
      "lastError": null,
      "createdAt": "2026-09-28T14:02:11.000Z",
      "updatedAt": "2026-10-01T09:00:03.500Z",
      "lastMessageStatus": "read"
    }
  ]
}
```

<a id="reminder-create"></a>

### Créer un rappel

`POST /api/v1/reminders`

Programme un message, éventuellement répété. Les `{{variables}}` du texte sont remplies à l'envoi.

- Débloqué par: Notify (`reminders`) + Developer ou Connect pour une clé d'API
- Clé du compte seulement

**Corps de la requête**

| Champ | Type | Obligatoire | Description |
| --- | --- | --- | --- |
| `phone` | string | oui | Numéro international ; espaces, tirets, points et parenthèses sont retirés. |
| `message` | string | oui | 1 à 4096 caractères, avec des `{{variables}}` possibles. |
| `sendAt` | string (ISO 8601) | oui | Premier envoi, avec `Z` ou un décalage (`2026-10-01T09:00:00+00:00`). 5 minutes dans le passé au plus. |
| `repeat` | "none" \| "daily" \| "weekly" \| "monthly" | non | Par défaut `none`. |
| `label` | string \| null | non | Votre note, 255 caractères max. |
| `variables` | object (string → string) | non | 50 valeurs max (clés ≤ 100, valeurs ≤ 1000 caractères). |
| `containerId` | uuid \| null | non | Numéro d'envoi ; `null` = votre numéro par défaut. |

**Exemple**

curl:

```bash
curl -X POST https://app.wahasend.com/api/v1/reminders \
  -H "X-API-Key: $WAHASEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "phone": "+22212345678",
  "message": "Hello {{name}}, your rent of {{amount}} is due tomorrow.",
  "sendAt": "2026-10-01T09:00:00Z",
  "repeat": "monthly",
  "label": "Rent — flat 3",
  "variables": {
    "name": "Aïcha",
    "amount": "45 000 MRU"
  }
}'
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/reminders', {
  method: 'POST',
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "phone": "+22212345678",
    "message": "Hello {{name}}, your rent of {{amount}} is due tomorrow.",
    "sendAt": "2026-10-01T09:00:00Z",
    "repeat": "monthly",
    "label": "Rent — flat 3",
    "variables": {
      "name": "Aïcha",
      "amount": "45 000 MRU"
    }
  }),
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.post(
    "https://app.wahasend.com/api/v1/reminders",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
    json={
        "phone": "+22212345678",
        "message": "Hello {{name}}, your rent of {{amount}} is due tomorrow.",
        "sendAt": "2026-10-01T09:00:00Z",
        "repeat": "monthly",
        "label": "Rent — flat 3",
        "variables": {
            "name": "Aïcha",
            "amount": "45 000 MRU",
        },
    },
)
print(r.json())
```

**Réponse 201**

```json
{
  "success": true,
  "reminder": {
    "id": "a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28",
    "phone": "+22212345678",
    "sendAt": "2026-10-01T09:00:00.000Z",
    "repeat": "monthly",
    "status": "scheduled",
    "…": "…"
  }
}
```

**Erreurs possibles**

- [`VALIDATION_ERROR`](https://wahasend.com/docs/fr/errors.md#validation_error) (400): Validation failed. Check the details for specific field errors.
- [`NOT_FOUND`](https://wahasend.com/docs/fr/errors.md#not_found) (404): Not found.

<a id="reminder-import"></a>

### Importer en masse

`POST /api/v1/reminders/import`

Un seul modèle pour 5000 lignes max (numéro + heure chacune). Les lignes dans le passé sont sautées et listées, pas refusées.

- Débloqué par: Notify (`reminders`) + Developer ou Connect pour une clé d'API
- Clé du compte seulement

**Corps de la requête**

| Champ | Type | Obligatoire | Description |
| --- | --- | --- | --- |
| `message` | string | oui | 1 à 4096 caractères, avec des `{{variables}}` possibles. |
| `repeat` | "none" \| "daily" \| "weekly" \| "monthly" | non | Par défaut `none`. |
| `containerId` | uuid \| null | non | Numéro d'envoi. |
| `rows` | array | oui | 1 à 5000 lignes. |
| `rows[].phone` | string | oui | Numéro international, 8 à 20 caractères (`+22212345678`). Les identifiants `@lid` ne sont pas acceptés ici. |
| `rows[].sendAt` | string (ISO 8601) | oui | Avec `Z` ou un décalage. |
| `rows[].label` | string \| null | non | 255 caractères max. |
| `rows[].variables` | object (string → string) | non | Valeurs de cette ligne. |

**Exemple**

curl:

```bash
curl -X POST https://app.wahasend.com/api/v1/reminders/import \
  -H "X-API-Key: $WAHASEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "message": "Hello {{name}}, see you at {{time}}.",
  "rows": [
    {
      "phone": "+22212345678",
      "sendAt": "2026-10-02T08:00:00Z",
      "variables": {
        "name": "Aïcha",
        "time": "10:00"
      }
    },
    {
      "phone": "+22287654321",
      "sendAt": "2026-10-02T08:00:00Z",
      "variables": {
        "name": "Moussa",
        "time": "11:30"
      }
    }
  ]
}'
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/reminders/import', {
  method: 'POST',
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "message": "Hello {{name}}, see you at {{time}}.",
    "rows": [
      {
        "phone": "+22212345678",
        "sendAt": "2026-10-02T08:00:00Z",
        "variables": {
          "name": "Aïcha",
          "time": "10:00"
        }
      },
      {
        "phone": "+22287654321",
        "sendAt": "2026-10-02T08:00:00Z",
        "variables": {
          "name": "Moussa",
          "time": "11:30"
        }
      }
    ]
  }),
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.post(
    "https://app.wahasend.com/api/v1/reminders/import",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
    json={
        "message": "Hello {{name}}, see you at {{time}}.",
        "rows": [
            {
                "phone": "+22212345678",
                "sendAt": "2026-10-02T08:00:00Z",
                "variables": {
                    "name": "Aïcha",
                    "time": "10:00",
                },
            },
            {
                "phone": "+22287654321",
                "sendAt": "2026-10-02T08:00:00Z",
                "variables": {
                    "name": "Moussa",
                    "time": "11:30",
                },
            },
        ],
    },
)
print(r.json())
```

**Réponse 201**

```json
{
  "success": true,
  "created": 2,
  "batchId": "e5c1a9f3-2d7b-4b8e-a6f0-8c3d1e5b9a72",
  "skipped": []
}
```

**Erreurs possibles**

- [`VALIDATION_ERROR`](https://wahasend.com/docs/fr/errors.md#validation_error) (400): Validation failed. Check the details for specific field errors.
- [`NOT_FOUND`](https://wahasend.com/docs/fr/errors.md#not_found) (404): Not found.

<a id="reminder-update"></a>

### Modifier un rappel

`PUT /api/v1/reminders/:id`

N'importe quel champ de la création. Un nouveau `sendAt` réactive un rappel terminé, échoué ou annulé.

- Débloqué par: Notify (`reminders`) + Developer ou Connect pour une clé d'API
- Clé du compte seulement

**Paramètres de chemin**

| Champ | Type | Obligatoire | Description |
| --- | --- | --- | --- |
| `id` | uuid | oui | Identifiant du rappel. |

**Corps de la requête**

| Champ | Type | Obligatoire | Description |
| --- | --- | --- | --- |
| `phone` | string | non | Numéro international. |
| `message` | string | non | 1 à 4096 caractères. |
| `sendAt` | string (ISO 8601) | non | Nouvelle heure ; réactive le rappel. |
| `repeat` | "none" \| "daily" \| "weekly" \| "monthly" | non | Nouvelle répétition. |
| `label` | string \| null | non | 255 caractères max. |
| `variables` | object (string → string) | non | Remplace les valeurs. |
| `containerId` | uuid \| null | non | Numéro d'envoi. |

**Exemple**

curl:

```bash
curl -X PUT https://app.wahasend.com/api/v1/reminders/a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28 \
  -H "X-API-Key: $WAHASEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "sendAt": "2026-10-03T09:00:00Z"
}'
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/reminders/a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28', {
  method: 'PUT',
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "sendAt": "2026-10-03T09:00:00Z"
  }),
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.put(
    "https://app.wahasend.com/api/v1/reminders/a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
    json={
        "sendAt": "2026-10-03T09:00:00Z",
    },
)
print(r.json())
```

**Réponse 200**

```json
{
  "success": true,
  "reminder": {
    "id": "a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28",
    "sendAt": "2026-10-03T09:00:00.000Z",
    "status": "scheduled",
    "…": "…"
  }
}
```

**Erreurs possibles**

- [`VALIDATION_ERROR`](https://wahasend.com/docs/fr/errors.md#validation_error) (400): Validation failed. Check the details for specific field errors.
- [`NOT_FOUND`](https://wahasend.com/docs/fr/errors.md#not_found) (404): Not found.
- [`FORBIDDEN_ACTION`](https://wahasend.com/docs/fr/errors.md#forbidden_action) (400): This action is not allowed.

<a id="reminder-cancel"></a>

### Annuler

`POST /api/v1/reminders/:id/cancel`

Arrête un rappel `scheduled` (il reste dans la liste en `cancelled`).

- Débloqué par: Notify (`reminders`) + Developer ou Connect pour une clé d'API
- Clé du compte seulement

**Paramètres de chemin**

| Champ | Type | Obligatoire | Description |
| --- | --- | --- | --- |
| `id` | uuid | oui | Identifiant du rappel. |

**Exemple**

curl:

```bash
curl -X POST https://app.wahasend.com/api/v1/reminders/a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28/cancel \
  -H "X-API-Key: $WAHASEND_API_KEY"
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/reminders/a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28/cancel', {
  method: 'POST',
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY },
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.post(
    "https://app.wahasend.com/api/v1/reminders/a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28/cancel",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
)
print(r.json())
```

**Réponse 200**

```json
{
  "success": true,
  "reminder": {
    "id": "a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28",
    "status": "cancelled",
    "…": "…"
  }
}
```

**Erreurs possibles**

- [`NOT_FOUND`](https://wahasend.com/docs/fr/errors.md#not_found) (404): Not found.
- [`FORBIDDEN_ACTION`](https://wahasend.com/docs/fr/errors.md#forbidden_action) (400): This action is not allowed.

<a id="reminder-delete"></a>

### Supprimer

`DELETE /api/v1/reminders/:id`

Supprime définitivement le rappel.

- Débloqué par: Notify (`reminders`) + Developer ou Connect pour une clé d'API
- Clé du compte seulement

**Paramètres de chemin**

| Champ | Type | Obligatoire | Description |
| --- | --- | --- | --- |
| `id` | uuid | oui | Identifiant du rappel. |

**Exemple**

curl:

```bash
curl -X DELETE https://app.wahasend.com/api/v1/reminders/a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28 \
  -H "X-API-Key: $WAHASEND_API_KEY"
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/reminders/a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28', {
  method: 'DELETE',
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY },
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.delete(
    "https://app.wahasend.com/api/v1/reminders/a7e3c5d1-9b2f-4e6a-8c04-5d1f3b7e9a28",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
)
print(r.json())
```

**Réponse 200**

```json
{
  "success": true
}
```

**Erreurs possibles**

- [`NOT_FOUND`](https://wahasend.com/docs/fr/errors.md#not_found) (404): Not found.
