# Issue with virtual calendar and hosting url

**URL:** <https://forums.nylas.com/t/issue-with-virtual-calendar-and-hosting-url/946>\
**Category:** Question and Answers\
**Created:** [October 17, 2025, 8:59am UTC](https://forums.nylas.com/t/issue-with-virtual-calendar-and-hosting-url/946 "2025-10-17T08:59:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Habari1447](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@Habari1447](https://forums.nylas.com/u/Habari1447)\
**Post date:** [October 17, 2025, 8:59am UTC](https://forums.nylas.com/t/issue-with-virtual-calendar-and-hosting-url/946/1 "2025-10-17T08:59:23Z")

</div>

Hello,

I’m trying to build something for my customer, I’m working with dart and GCP with node

When my user is created, here is the flow

```auto
const functions = require("firebase-functions");

const admin = require("firebase-admin");

const axios = require("axios");

if (!admin.apps.length) admin.initializeApp();

function generateSlug(name, uid) {

    if (!name) return `${uid}-booking`;

    return (

        name

            .toLowerCase()

            .normalize("NFD")

            .replace(/[\u0300-\u036f]/g, "")

            .replace(/[^a-z0-9]+/g, "-")

            .replace(/^-+|-+$/g, "")

            .substring(0, 50) +

        `-${uid.slice(0, 6)}`

    );

}

exports.onUserCreated = functions

    .region("europe-west1")

    .auth.user()

    .onCreate(async (user) => {

        const firestore = admin.firestore();

        const nylasApiKey =

            "***";

        try {

            console.log("🆕 New user:", user.uid, user.email);

            // 1️⃣ Create Virtual Calendar Grant

            const grantResp = await axios.post(

                "https://api.eu.nylas.com/v3/grants",

                {

                    provider: "virtual-calendar",

                    name: user.displayName || "User Calendar",

                    settings: { email: user.email },

                    scope: ["calendar"],

                },

                { headers: { Authorization: `Bearer ${nylasApiKey}` } }

            );

            const grantId = grantResp.data.data.id;

            console.log("✅ Grant created:", grantId);

            // 2️⃣ Create Virtual Calendar under this Grant

            const calendarResp = await axios.post(

                `https://api.eu.nylas.com/v3/grants/${grantId}/calendars`,

                {

                    name: `${user.displayName || "User"} Calendar`,

                    description: "Primary virtual calendar for scheduling",

                },

                { headers: { Authorization: `Bearer ${nylasApiKey}` } }

            );

            const calendarId = calendarResp.data.data.id;

            console.log("✅ Virtual calendar created:", calendarId);

            // 3️⃣ Generate slug

            const slug = generateSlug(user.displayName, user.uid);

            // 4️⃣ Create Scheduler Configuration (auto-hosted)

            const schedulerResp = await axios.post(

                `https://api.eu.nylas.com/v3/grants/${grantId}/scheduling/configurations`,

                {

                    slug: slug,

                    requires_session_auth: false,

                    round_robin: false, // <-- this fixes the organizer error

                    participants: [

                        {

                            name: user.displayName || "Organizer",

                            email: user.email,

                            is_organizer: true,

                            grant_id: grantId,

                            availability: {

                                calendar_ids: [calendarId],

                                open_hours: [

                                    {

                                        days: [1, 2, 3, 4, 5],

                                        timezone: "Europe/Paris",

                                        start: "09:00",

                                        end: "17:00",

                                        exdates: [],

                                    },

                                ],

                            },

                            booking: { calendar_id: calendarId },

                        },

                    ],

                    availability: {

                        duration_minutes: 30,

                        interval_minutes: 30,

                    },

                    event_booking: {

                        title: "Meeting with " + (user.displayName || "User"),

                    },

                },

                { headers: { Authorization: `Bearer ${nylasApiKey}` } }

            );

            const scheduler = schedulerResp.data.data;

            console.log("✅ Scheduler created:", scheduler.id);

            console.log("🔗 Scheduler data:", scheduler);

            const hostedUrl = `https://book.nylas.com/${slug}`;

            console.log("🔗 Hosted URL:", hostedUrl);

            

            // 5️⃣ Save to Firestore

            await firestore.collection("users").doc(user.uid).set(

                {

                    nylas_grant_id: grantId,

                    nylas_calendar_id: calendarId,

                    nylas_scheduler_id: scheduler.id,

                    nylas_scheduler_slug: slug,

                    nylas_scheduler_url:

                        scheduler.hosted_url || `https://book.nylas.com/${slug}`,

                },

                { merge: true }

            );

            console.log("✅ Nylas setup completed for:", user.uid);

        } catch (err) {

            console.error(

                "❌ Nylas setup error:",

                err.response?.data || err.message

            );

        }

    });

```

And here are the response log

{  
“logs”: [  
{  
“timestamp”: “2025-10-17T08:38:29.330862Z”,  
“level”: “INFO”,  
“message”: “🆕 New user: lxMlbTtXZwNsKhlclnnq1iFVMKg1 \*\*\*@gmail.comgmail.com”  
},  
{  
“timestamp”: “2025-10-17T08:38:30.220065Z”,  
“level”: “INFO”,  
“message”: “✅ Grant created: df10e1b1-7bbf-4dd4-8eb1-6a1591ad6336”  
},  
{  
“timestamp”: “2025-10-17T08:38:30.432640Z”,  
“level”: “INFO”,  
“message”: “✅ Virtual calendar created: 7a707781-aada-4b94-b9f8-16ab538b1cec”  
},  
{  
“timestamp”: “2025-10-17T08:38:30.608522Z”,  
“level”: “INFO”,  
“message”: “✅ Scheduler created: cdd602f5-3491-4f24-888c-9e5eda9c860a”  
},  
{  
“timestamp”: “2025-10-17T08:38:30.611121Z”,  
“level”: “INFO”,  
“message”: “🔗 Hosted URL: [Nylas - Scheduler v3](https://book.nylas.com/lxMlbTtXZwNsKhlclnnq1iFVMKg1-booking%E2%80%9D)  
},  
{  
“timestamp”: “2025-10-17T08:38:34.276445Z”,  
“level”: “INFO”,  
“message”: “✅ Nylas setup completed for: lxMlbTtXZwNsKhlclnnq1iFVMKg1”  
}  
]  
}

With detailed schedulerResp

{  
“id”: “cdd602f5-3491-4f24-888c-9e5eda9c860a”,  
“slug”: “lxMlbTtXZwNsKhlclnnq1iFVMKg1-booking”,  
“participants”: [  
{  
“name”: “Organizer”,  
“email”: “\*\*\*@gmail.com”,  
“is\_organizer”: true,  
“grant\_id”: “df10e1b1-7bbf-4dd4-8eb1-6a1591ad6336”,  
“availability”: {  
“calendar\_ids”: [“7a707781-aada-4b94-b9f8-16ab538b1cec”],  
“open\_hours”: [  
{  
“days”: [1,2,3,4,5],  
“timezone”: “Europe/Paris”,  
“start”: “09:00”,  
“end”: “17:00”,  
“exdates”:   
}  
]  
},  
“booking”: {  
“calendar\_id”: “7a707781-aada-4b94-b9f8-16ab538b1cec”  
}  
}  
],  
“requires\_session\_auth”: false,  
“availability”: {  
“duration\_minutes”: 30,  
“interval\_minutes”: 30  
},  
“event\_booking”: {  
“title”: “Meeting with User”,  
“booking\_type”: “booking”,  
“hide\_participants”: null,  
“disable\_emails”: null  
},  
“scheduler”: {  
“available\_days\_in\_future”: 30,  
“min\_cancellation\_notice”: 0,  
“min\_booking\_notice”: 60,  
“hide\_rescheduling\_options”: false,  
“hide\_cancellation\_options”: false,  
“email\_template”: {  
“booking\_confirmed”: {}  
}  
},  
“appearance”: null,  
“hosted\_url”: “[Nylas - Scheduler v3](https://book.nylas.com/lxMlbTtXZwNsKhlclnnq1iFVMKg1-booking%E2%80%9D)  
}

It’s been few days I can’t get why the hosted URL not working even tho I followed the doc, did someone had similar issue please ?

---

<div class="post-metadata">

**Author:** ![Samuel.R](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@Samuel.R](https://forums.nylas.com/u/Samuel.R)\
**Post date:** [October 21, 2025, 7:45pm UTC](https://forums.nylas.com/t/issue-with-virtual-calendar-and-hosting-url/946/2 "2025-10-21T19:45:52Z")

</div>

Hello @**[Habari1447](https://forums.nylas.com/u/habari1447)**,

Our Support team has reached out to you via email to continue this investigation. Please check your mailbox for our message.

Many thanks,  
Samuel R.  
Support Engineer, Nylas
