> This is a page from the ElevenLabs documentation. For an index of the documentation, fetch https://elevenlabs.io/docs/llms.txt.

# Provisionnement et intégration

Ces exemples s’appuient sur le [guide de démarrage](/docs/fr/reception-ai/reception-api/quickstart). Ils utilisent le même client, Bright Smile Dental, et chaque appel au Workspace transmet son ID dans `xi-workspace-id`.

## Provisionner des Workspaces

### Provisionner en une requête

Lorsque vous ne disposez pas encore des informations sur l’entreprise, créez le Workspace, abonnez-le, invitez le propriétaire et terminez l’intégration en un seul appel. La réceptionniste est créée à partir du seul nom de l’entreprise ; renseignez donc le profil de l’entreprise ensuite. Transmettez une `idempotency_key` afin qu’une nouvelle tentative après un délai d’expiration ne puisse pas créer un second Workspace.

```python
from elevenlabs import ElevenLabs, ProvisionResellerWorkspaceSubscription, TeamInviteRequest

elevenlabs = ElevenLabs()

workspace = elevenlabs.reception.workspaces.create(
    business_name="Bright Smile Dental",
    subscription=ProvisionResellerWorkspaceSubscription(
        tier_id="smbtier_4401k8r2c6hxe9tq3vz7m5wd1nb0",
    ),
    members=[
        TeamInviteRequest(email="owner@brightsmiledental.com", role="workspace_admin"),
        TeamInviteRequest(email="frontdesk@brightsmiledental.com"),
    ],
    complete_onboarding=True,
    idempotency_key="provision-crm-10482",
)

for result in workspace.member_results:
    if result.outcome == "failed":
        print("Invite failed:", result.email, result.error_status)

if workspace.onboarding_completed_at_unix is None:
    elevenlabs.reception.workspaces.complete_onboarding(workspace.workspace_id)
```

```typescript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

const elevenlabs = new ElevenLabsClient();

const workspace = await elevenlabs.reception.workspaces.create({
  businessName: "Bright Smile Dental",
  subscription: { tierId: "smbtier_4401k8r2c6hxe9tq3vz7m5wd1nb0" },
  members: [
    { email: "owner@brightsmiledental.com", role: "workspace_admin" },
    { email: "frontdesk@brightsmiledental.com" },
  ],
  completeOnboarding: true,
  idempotencyKey: "provision-crm-10482",
});

for (const result of workspace.memberResults ?? []) {
  if (result.outcome === "failed") {
    console.log("Invite failed:", result.email, result.errorStatus);
  }
}

if (workspace.onboardingCompletedAtUnix == null) {
  await elevenlabs.reception.workspaces.completeOnboarding(workspace.workspaceId);
}
```

```bash
curl -X POST "https://api.elevenlabs.io/v1/reception/reseller/workspaces" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "business_name": "Bright Smile Dental",
    "subscription": { "tier_id": "smbtier_4401k8r2c6hxe9tq3vz7m5wd1nb0" },
    "members": [
      { "email": "owner@brightsmiledental.com", "role": "workspace_admin" },
      { "email": "frontdesk@brightsmiledental.com" }
    ],
    "complete_onboarding": true,
    "idempotency_key": "provision-crm-10482"
  }'
```

L’intégration lors de la création est effectuée au mieux : en cas d’échec, `onboarding_completed_at_unix` vaut `null` et vous pouvez réessayer avec `complete_onboarding`.

### Provisionner des clients depuis votre CRM

Dérivez chaque `idempotency_key` de votre propre ID client afin que relancer l’import renvoie les Workspaces déjà créés au lieu d’en créer de nouveaux. La même clé avec un corps différent est rejetée avec `idempotency_key_reused`.

```python
customers = [
    {"crm_id": "10482", "name": "Bright Smile Dental", "owner": "owner@brightsmiledental.com"},
    {"crm_id": "10483", "name": "Harbor Physio", "owner": "hello@harborphysio.com"},
]

workspace_ids = {}
for customer in customers:
    workspace = elevenlabs.reception.workspaces.create(
        business_name=customer["name"],
        subscription=ProvisionResellerWorkspaceSubscription(
            tier_id="smbtier_4401k8r2c6hxe9tq3vz7m5wd1nb0",
        ),
        members=[TeamInviteRequest(email=customer["owner"], role="workspace_admin")],
        idempotency_key=f"provision-crm-{customer['crm_id']}",
    )
    workspace_ids[customer["crm_id"]] = workspace.workspace_id
```

```typescript
const customers = [
  { crmId: "10482", name: "Bright Smile Dental", owner: "owner@brightsmiledental.com" },
  { crmId: "10483", name: "Harbor Physio", owner: "hello@harborphysio.com" },
];

const workspaceIds = new Map<string, string>();
for (const customer of customers) {
  const workspace = await elevenlabs.reception.workspaces.create({
    businessName: customer.name,
    subscription: { tierId: "smbtier_4401k8r2c6hxe9tq3vz7m5wd1nb0" },
    members: [{ email: customer.owner, role: "workspace_admin" }],
    idempotencyKey: `provision-crm-${customer.crmId}`,
  });
  workspaceIds.set(customer.crmId, workspace.workspaceId);
}
```

### Terminer l’intégration des Workspaces encore en configuration

`workspaces.list` indique quels Workspaces n’ont pas terminé l’intégration. Vous pouvez réessayer `complete_onboarding` sans risque, et donc l’exécuter selon une planification.

```python
cursor = None
while True:
    page = elevenlabs.reception.workspaces.list(cursor=cursor, page_size=100)
    for workspace in page.workspaces:
        if workspace.onboarding_completed_at_unix is None:
            elevenlabs.reception.workspaces.complete_onboarding(workspace.workspace_id)
    if not page.has_more:
        break
    cursor = page.next_cursor
```

```typescript
let cursor: string | undefined;
do {
  const page = await elevenlabs.reception.workspaces.list({ cursor, pageSize: 100 });
  for (const workspace of page.workspaces) {
    if (workspace.onboardingCompletedAtUnix == null) {
      await elevenlabs.reception.workspaces.completeOnboarding(workspace.workspaceId);
    }
  }
  cursor = page.hasMore ? page.nextCursor : undefined;
} while (cursor);
```

## Décrire l’entreprise

Ajoutez les établissements, le personnel, les services et les fermetures de l’entreprise avant de terminer l’intégration, afin que la réceptionniste soit créée à partir de ces éléments. Vous pouvez également les ajouter ou les modifier à tout moment par la suite.

> **Warning**
>
> Tant que l’intégration n’est pas terminée, l’assistant de configuration affiché au propriétaire de l’entreprise lorsqu’il se connecte peut
> remplacer ou supprimer ces données. Terminez l’intégration avant que le propriétaire ne se connecte.

### Ajouter un établissement

Chaque établissement possède ses propres horaires. Les jours vont de `0` (lundi) à `6` (dimanche), et un jour sans entrée est fermé.

```python
from elevenlabs import TimeRangeModel, WorkingHours

workspace_id = "8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7"

weekday = [TimeRangeModel(start_hour=8, start_minute=0, end_hour=17, end_minute=0)]
saturday = [TimeRangeModel(start_hour=9, start_minute=0, end_hour=13, end_minute=0)]

location = elevenlabs.reception.locations.create(
    xi_workspace_id=workspace_id,
    name="Mission Street",
    address="2140 Mission St, San Francisco, CA 94110",
    notes="Free parking behind the building.",
    operating_hours=WorkingHours(hours={**{str(day): weekday for day in range(5)}, "5": saturday}),
)
```

```typescript
const workspaceId = "8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7";

const weekday = [{ startHour: 8, startMinute: 0, endHour: 17, endMinute: 0 }];
const saturday = [{ startHour: 9, startMinute: 0, endHour: 13, endMinute: 0 }];

const location = await elevenlabs.reception.locations.create({
  xiWorkspaceId: workspaceId,
  name: "Mission Street",
  address: "2140 Mission St, San Francisco, CA 94110",
  notes: "Free parking behind the building.",
  operatingHours: {
    hours: { "0": weekday, "1": weekday, "2": weekday, "3": weekday, "4": weekday, "5": saturday },
  },
});
```

```bash
curl -X POST "https://api.elevenlabs.io/v1/reception/locations" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "xi-workspace-id: 8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Mission Street",
    "address": "2140 Mission St, San Francisco, CA 94110",
    "notes": "Free parking behind the building.",
    "operating_hours": {
      "hours": {
        "0": [{ "start_hour": 8, "start_minute": 0, "end_hour": 17, "end_minute": 0 }],
        "1": [{ "start_hour": 8, "start_minute": 0, "end_hour": 17, "end_minute": 0 }],
        "2": [{ "start_hour": 8, "start_minute": 0, "end_hour": 17, "end_minute": 0 }],
        "3": [{ "start_hour": 8, "start_minute": 0, "end_hour": 17, "end_minute": 0 }],
        "4": [{ "start_hour": 8, "start_minute": 0, "end_hour": 17, "end_minute": 0 }],
        "5": [{ "start_hour": 9, "start_minute": 0, "end_hour": 13, "end_minute": 0 }]
      }
    }
  }'
```

### Ajouter un membre du personnel

Un membre du personnel d’un établissement suit les horaires de cet établissement, sauf si vous lui attribuez ses propres `working_hours`. `customer_facing_name` est le nom entendu par les appelants ; `name` reste le libellé interne.

```python
hygienist = elevenlabs.reception.staff.create(
    xi_workspace_id=workspace_id,
    name="Maria Lopez (hygienist)",
    customer_facing_name="Maria",
    description="Dental hygienist. Speaks English and Spanish.",
    email="maria@brightsmiledental.com",
    location_id=location.id,
    working_hours=WorkingHours(
        hours={str(day): [TimeRangeModel(start_hour=9, start_minute=0, end_hour=15, end_minute=0)] for day in range(4)},
    ),
)
```

```typescript
const shift = [{ startHour: 9, startMinute: 0, endHour: 15, endMinute: 0 }];

const hygienist = await elevenlabs.reception.staff.create({
  xiWorkspaceId: workspaceId,
  name: "Maria Lopez (hygienist)",
  customerFacingName: "Maria",
  description: "Dental hygienist. Speaks English and Spanish.",
  email: "maria@brightsmiledental.com",
  locationId: location.id,
  workingHours: { hours: { "0": shift, "1": shift, "2": shift, "3": shift } },
});
```

```bash
curl -X POST "https://api.elevenlabs.io/v1/reception/staff" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "xi-workspace-id: 8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Maria Lopez (hygienist)",
    "customer_facing_name": "Maria",
    "description": "Dental hygienist. Speaks English and Spanish.",
    "email": "maria@brightsmiledental.com",
    "location_id": "6a1f0c3e9b2d4f7a8c5e1d0b3a9f6c2e"
  }'
```

### Ajouter des services

Un service possède une ou plusieurs `variants`, chacune ayant sa propre durée et son propre prix ; la première est celle par défaut. Définissez `any_staff_member` sur `false` pour limiter les personnes qui peuvent le fournir.

Lorsque le prix dépend du travail à effectuer, utilisez `pricing_mode="quote"` et ajoutez des `intake_questions`. La réceptionniste les pose et enregistre une demande de devis au lieu d’indiquer un prix.

```python
from elevenlabs import ReceptionIntakeQuestion, ReceptionServiceVariant

elevenlabs.reception.services.create(
    xi_workspace_id=workspace_id,
    name="Cleaning",
    description="Routine cleaning and polish.",
    variants=[
        ReceptionServiceVariant(duration_minutes=45, price=120),
        ReceptionServiceVariant(duration_minutes=60, price=160),
    ],
    any_staff_member=False,
    staff_ids=[hygienist.id],
    buffer_minutes=10,
)

elevenlabs.reception.services.create(
    xi_workspace_id=workspace_id,
    name="Invisalign consultation",
    pricing_mode="quote",
    variants=[ReceptionServiceVariant(duration_minutes=30)],
    intake_questions=[
        ReceptionIntakeQuestion(label="Have you worn braces or aligners before?", kind="choice", options=["Yes", "No"]),
        ReceptionIntakeQuestion(label="What would you like to fix?", required=True),
    ],
)
```

```typescript
await elevenlabs.reception.services.create({
  xiWorkspaceId: workspaceId,
  name: "Cleaning",
  description: "Routine cleaning and polish.",
  variants: [
    { durationMinutes: 45, price: 120 },
    { durationMinutes: 60, price: 160 },
  ],
  anyStaffMember: false,
  staffIds: [hygienist.id],
  bufferMinutes: 10,
});

await elevenlabs.reception.services.create({
  xiWorkspaceId: workspaceId,
  name: "Invisalign consultation",
  pricingMode: "quote",
  variants: [{ durationMinutes: 30 }],
  intakeQuestions: [
    { label: "Have you worn braces or aligners before?", kind: "choice", options: ["Yes", "No"] },
    { label: "What would you like to fix?", required: true },
  ],
});
```

```bash
curl -X POST "https://api.elevenlabs.io/v1/reception/services" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "xi-workspace-id: 8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Cleaning",
    "description": "Routine cleaning and polish.",
    "variants": [
      { "duration_minutes": 45, "price": 120 },
      { "duration_minutes": 60, "price": 160 }
    ],
    "any_staff_member": false,
    "staff_ids": ["3c9e2b7a1f4d4a6e9b0c5d8f2e1a7b4c"],
    "buffer_minutes": 10
  }'
```

### Fermer pour un jour férié

Une fermeture couvre des journées entières, de `start_date` à `end_date`. Utilisez `time_off_type="location"` pour l’entreprise, ou `"staff"` avec l’ID du membre du personnel dans `resource_id` pour l’absence d’une personne.

```python
from elevenlabs import DateModel

elevenlabs.reception.holidays.create(
    xi_workspace_id=workspace_id,
    name="Winter break",
    start_date=DateModel(year=2026, month=12, day=24),
    end_date=DateModel(year=2026, month=12, day=26),
    time_off_type="location",
    location_id=location.id,
)
```

```typescript
await elevenlabs.reception.holidays.create({
  xiWorkspaceId: workspaceId,
  name: "Winter break",
  startDate: { year: 2026, month: 12, day: 24 },
  endDate: { year: 2026, month: 12, day: 26 },
  timeOffType: "location",
  locationId: location.id,
});
```

```bash
curl -X POST "https://api.elevenlabs.io/v1/reception/holidays" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "xi-workspace-id: 8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Winter break",
    "start_date": { "year": 2026, "month": 12, "day": 24 },
    "end_date": { "year": 2026, "month": 12, "day": 26 },
    "time_off_type": "location",
    "location_id": "6a1f0c3e9b2d4f7a8c5e1d0b3a9f6c2e"
  }'
```

### Importer un document

Fournissez à la réceptionniste un document sur lequel s’appuyer pour répondre, tel qu’une FAQ ou une grille tarifaire. Utilisez `knowledge_sources.add_url` pour un site web, comme dans le [guide de démarrage](/docs/fr/reception-ai/reception-api/quickstart).

```python
with open("new-patient-faq.pdf", "rb") as file:
    elevenlabs.reception.knowledge_sources.upload(xi_workspace_id=workspace_id, file=file)
```

```typescript
import fs from "node:fs";

await elevenlabs.reception.knowledgeSources.upload({
  xiWorkspaceId: workspaceId,
  file: fs.createReadStream("new-patient-faq.pdf"),
});
```

```bash
curl -X POST "https://api.elevenlabs.io/v1/reception/knowledge-sources" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "xi-workspace-id: 8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7" \
  -F "file=@new-patient-faq.pdf"
```

## Configurer la réceptionniste

Ces appels nécessitent l’ID de la réceptionniste : `customer_facing_agent_id` de `complete_onboarding`, ou `agent_id` de `receptionists.list`.

### Définir le message d’accueil, les langues et les informations à recueillir

Seuls les paramètres que vous envoyez sont modifiés.

```python
from elevenlabs import ReceptionCustomerFacingConfigPatch

receptionist_id = elevenlabs.reception.receptionists.list(xi_workspace_id=workspace_id)[0].agent_id

elevenlabs.reception.receptionists.update(
    receptionist_id,
    xi_workspace_id=workspace_id,
    config=ReceptionCustomerFacingConfigPatch(
        first_message="Thanks for calling Bright Smile Dental, how can I help?",
        additional_languages=["es"],
        tone_traits=["warm", "concise"],
        details_to_collect=["full name", "date of birth", "insurance provider"],
        additional_instructions="Never give medical advice. Offer the next available appointment instead.",
    ),
)
```

```typescript
const [receptionist] = await elevenlabs.reception.receptionists.list({
  xiWorkspaceId: workspaceId,
});

await elevenlabs.reception.receptionists.update(receptionist.agentId, {
  xiWorkspaceId: workspaceId,
  config: {
    firstMessage: "Thanks for calling Bright Smile Dental, how can I help?",
    additionalLanguages: ["es"],
    toneTraits: ["warm", "concise"],
    detailsToCollect: ["full name", "date of birth", "insurance provider"],
    additionalInstructions:
      "Never give medical advice. Offer the next available appointment instead.",
  },
});
```

```bash
curl -X PATCH "https://api.elevenlabs.io/v1/reception/customer-facing-agents/agent_7101k5zvyjhmfg983brhmhkd98n6" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "xi-workspace-id: 8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "first_message": "Thanks for calling Bright Smile Dental, how can I help?",
      "additional_languages": ["es"],
      "tone_traits": ["warm", "concise"],
      "details_to_collect": ["full name", "date of birth", "insurance provider"],
      "additional_instructions": "Never give medical advice. Offer the next available appointment instead."
    }
  }'
```

### Transférer les appels et ajouter des règles

Une règle de transfert transmet l’appel à une personne lorsque sa `condition` est remplie. Les transferts dépendent du forfait : vérifiez d’abord `is_transfer_allowed` sur la réceptionniste. Une règle indique à la réceptionniste comment se comporter ; une règle `strict` est toujours appliquée, tandis qu’une `suggestion` sert de ligne directrice.

```python
elevenlabs.reception.receptionists.transfer_rules.create(
    receptionist_id,
    xi_workspace_id=workspace_id,
    label="Front desk",
    phone_number="+14155550142",
    condition="The caller has a dental emergency or asks to speak to a person.",
)

elevenlabs.reception.receptionists.rules.create(
    receptionist_id,
    xi_workspace_id=workspace_id,
    title="New patients",
    description="Ask new patients to arrive 15 minutes early to fill in forms.",
)
```

```typescript
await elevenlabs.reception.receptionists.transferRules.create(receptionist.agentId, {
  xiWorkspaceId: workspaceId,
  label: "Front desk",
  phoneNumber: "+14155550142",
  condition: "The caller has a dental emergency or asks to speak to a person.",
});

await elevenlabs.reception.receptionists.rules.create(receptionist.agentId, {
  xiWorkspaceId: workspaceId,
  title: "New patients",
  description: "Ask new patients to arrive 15 minutes early to fill in forms.",
});
```

```bash
curl -X POST "https://api.elevenlabs.io/v1/reception/customer-facing-agents/agent_7101k5zvyjhmfg983brhmhkd98n6/transfer-rules" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "xi-workspace-id: 8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Front desk",
    "phone_number": "+14155550142",
    "condition": "The caller has a dental emergency or asks to speak to a person."
  }'
```

## Inviter l’équipe

Invitez des personnes à tout moment après la création du Workspace. Une invitation en attente occupe une place ; une invitation est donc refusée dès que les membres et les invitations atteignent la taille d’équipe du forfait.

```python
elevenlabs.reception.team.invites.create(
    xi_workspace_id=workspace_id,
    email="office.manager@brightsmiledental.com",
    role="workspace_admin",
)
```

```typescript
await elevenlabs.reception.team.invites.create({
  xiWorkspaceId: workspaceId,
  email: "office.manager@brightsmiledental.com",
  role: "workspace_admin",
});
```

```bash
curl -X POST "https://api.elevenlabs.io/v1/reception/team/invites" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "xi-workspace-id: 8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7" \
  -H "Content-Type: application/json" \
  -d '{ "email": "office.manager@brightsmiledental.com", "role": "workspace_admin" }'
```