[{"data":1,"prerenderedAt":378},["ShallowReactive",2],{"navigation":3,"page:\u002Freplit":45},{"title":4,"links":5},"API reference",[6,9,12,15,18,21,24,27,30,33,36,39,42],{"title":7,"href":8},"Accounts","\u002Freference\u002Faccounts",{"title":10,"href":11},"Connect","\u002Freference\u002Fconnect",{"title":13,"href":14},"Calendars","\u002Freference\u002Fcalendars",{"title":16,"href":17},"Events","\u002Freference\u002Fevents",{"title":19,"href":20},"Availability","\u002Freference\u002Favailability",{"title":22,"href":23},"Meetings","\u002Freference\u002Fmeetings",{"title":25,"href":26},"Invitations","\u002Freference\u002Finvitations",{"title":28,"href":29},"Webhooks","\u002Freference\u002Fwebhooks",{"title":31,"href":32},"Metadata","\u002Freference\u002Fmetadata",{"title":34,"href":35},"Keys","\u002Freference\u002Fkeys",{"title":37,"href":38},"Sandbox","\u002Freference\u002Fsandbox",{"title":40,"href":41},"Usage","\u002Freference\u002Fusage",{"title":43,"href":44},"Logs","\u002Freference\u002Flogs",{"kind":46,"title":47,"description":48,"sections":49,"doc":68},"guide","Build with Replit","Add Google Calendar and Microsoft Outlook to a Replit app. Connect the Pyas MCP server to Replit, and Replit Agent adds the server routes, the secret and the connect button.",[50,53,56,59,62,65],{"id":51,"title":52},"add-pyas-to-replit","Add Pyas to Replit",{"id":54,"title":55},"ask-for-what-you-want","Ask for what you want",{"id":57,"title":58},"store-the-key","Store the key",{"id":60,"title":61},"what-replit-agent-adds","What Replit Agent adds",{"id":63,"title":64},"receive-webhooks","Receive webhooks",{"id":66,"title":67},"go-live","Go live",{"id":69,"title":47,"body":70,"description":48,"extension":368,"hero":369,"meta":370,"navigation":371,"path":372,"rawbody":373,"sections":49,"seo":374,"stem":375,"v1":376,"__hash__":377},"docs\u002Freplit.md",{"type":71,"value":72,"toc":358},"minimark",[73,77,84,87,102,105,166,169,171,174,180,199,201,208,240,251,253,256,266,280,283,285,296,303,309,323,325],[74,75,47],"h1",{"id":76},"build-with-replit",[78,79,80],"lead",{},[81,82,83],"p",{},"Replit Agent can add Google Calendar and Microsoft Outlook to your app with Pyas. You connect the Pyas MCP server to Replit once. The agent then gets the code for each task from Pyas, and you store a key as a secret. The key stays on the server, and the code works with the sandbox's sample people before anyone connects a real calendar.",[85,86,52],"h2",{"id":51},[81,88,89,90,96,97,101],{},"Select ",[91,92,52],"a",{"href":93,"rel":94},"https:\u002F\u002Freplit.com\u002Fintegrations?mcp=eyJkaXNwbGF5TmFtZSI6IlB5YXMiLCJiYXNlVXJsIjoiaHR0cHM6Ly9tY3AucHlhcy5pby9zYW5kYm94In0%3D",[95],"nofollow",". Replit opens your integration settings with Pyas filled in. Select ",[98,99,100],"strong",{},"Add to Replit",", then sign in.",[81,103,104],{},"Or add it yourself:",[106,107,108,120,133,151],"ol",{},[109,110,111,112,115,116,119],"li",{},"In Replit, open ",[98,113,114],{},"Settings",", then ",[98,117,118],{},"Integrations",".",[109,121,122,123,126,127,115,130,119],{},"Under ",[98,124,125],{},"Your integrations",", select ",[98,128,129],{},"Add custom",[98,131,132],{},"Add personal MCP server",[109,134,135,136,139,140,144,145,139,148,119],{},"For ",[98,137,138],{},"Display name",", enter ",[141,142,143],"code",{},"Pyas",". For ",[98,146,147],{},"MCP Server URL",[141,149,150],{},"https:\u002F\u002Fmcp.pyas.io\u002Fsandbox",[109,152,89,153,156,157,160,161,165],{},[98,154,155],{},"Test & save",". Replit registers itself with Pyas and opens the sign-in. Sign in to Pyas, choose your app, and select ",[98,158,159],{},"Allow",". See ",[91,162,164],{"href":163},"\u002Fai-tools#sign-in","Sign in"," for what each permission allows.",[81,167,168],{},"The Pyas tools are then available to Replit Agent in all of your projects. When a tool needs your confirmation, Replit asks you before it runs.",[85,170,55],{"id":54},[81,172,173],{},"Ask in plain words, for example:",[175,176,177],"blockquote",{},[81,178,179],{},"Add a button that lets people connect their Google or Outlook calendar, and show their events for the next week.",[81,181,182,183,186,187,190,191,194,195,198],{},"The agent checks your setup with ",[141,184,185],{},"setup_status"," and gets the code for each task with ",[141,188,189],{},"get_recipe",". It adds your app's address to the allowed origins with ",[141,192,193],{},"update_app",", and creates a test key with ",[141,196,197],{},"get_test_key",". You confirm the address in Pyas, from the link it gives you. Every response from Pyas ends with the next step, so the agent knows what to do next.",[85,200,58],{"id":57},[81,202,203,204,207],{},"Store the test key as a secret named ",[141,205,206],{},"PYAS_API_KEY",":",[106,209,210,227],{},[109,211,212,213,115,216,219,220,223,224,119],{},"In your project, open ",[98,214,215],{},"Tools",[98,217,218],{},"Secrets",". Select ",[98,221,222],{},"New Secret",", enter the name and the key, and select ",[98,225,226],{},"Add Secret",[109,228,229,230,115,233,115,236,239],{},"When you publish, add it again for the published app: open ",[98,231,232],{},"Publishing",[98,234,235],{},"Adjust settings",[98,237,238],{},"Production app secrets",". Secrets in the editor don't carry over to the published app.",[81,241,242,243,246,247,119],{},"Your server reads the secret as ",[141,244,245],{},"process.env.PYAS_API_KEY",", and it never reaches the browser. A test key works only in your app's ",[91,248,250],{"href":249},"\u002Fsandbox","sandbox",[85,252,61],{"id":60},[81,254,255],{},"The code runs in your app's Express server:",[257,258,264],"pre",{"className":259,"code":261,"language":262,"meta":263},[260],"language-text","server\u002Fpyas.ts                         the Pyas client, and who is signed in\nserver\u002Froutes\u002Fpyas-connect-session.ts  creates a connect session for the button\nserver\u002Froutes\u002Fpyas-events.ts           the person's events for the next 7 days\nserver\u002Froutes\u002Fpyas-book.ts             books the first free 30 minutes tomorrow\nclient\u002FConnectCalendar.tsx             the \"Connect an account\" button\n","text","",[141,265,261],{"__ignoreMap":263},[81,267,268,269,272,273,276,277,119],{},"Each route file exports a router, which the agent mounts in your server with ",[141,270,271],{},"app.use()",". Your pages call the routes with ",[141,274,275],{},"fetch",", for example ",[141,278,279],{},"fetch('\u002Fapi\u002Fpyas\u002Fevents')",[81,281,282],{},"With a test key, the routes use the sandbox's sample person, so the events and booking work right away. The connect button shows a message from Pyas that connecting a real calendar requires a live key. This is expected.",[85,284,64],{"id":63},[81,286,287,288,291,292,295],{},"Ask the agent to receive Pyas webhooks. It adds ",[141,289,290],{},"server\u002Froutes\u002Fpyas-webhooks.ts"," and mounts it before ",[141,293,294],{},"app.use(express.json())",". The route verifies the signature of each delivery against the raw body, which no longer matches once the body is parsed.",[81,297,298,299,302],{},"The agent adds the endpoint to your sandbox with ",[141,300,301],{},"create_webhook",", at your published address:",[257,304,307],{"className":305,"code":306,"language":262,"meta":263},[260],"https:\u002F\u002F\u003Cyour-app>.replit.app\u002Fapi\u002Fpyas\u002Fwebhooks\n",[141,308,306],{"__ignoreMap":263},[81,310,311,312,314,315,318,319,322],{},"Use the published address, not the editor preview's, which can change. Store the signing secret that ",[141,313,301],{}," returns as a secret named ",[141,316,317],{},"PYAS_WEBHOOK_SECRET",", in the editor and in the published app's secrets. See ",[91,320,28],{"href":321},"\u002Fwebhooks"," for the events Pyas sends.",[85,324,67],{"id":66},[106,326,327,346,349,355],{},[109,328,329,330,333,334,337,338,341,342,345],{},"Make ",[141,331,332],{},"currentUserId()"," in ",[141,335,336],{},"server\u002Fpyas.ts"," return the signed-in person's ID from your app's sign-in. Until then, the routes respond with ",[141,339,340],{},"401"," and the code ",[141,343,344],{},"SIGN_IN_REQUIRED"," to every request made with a live key, so people's calendars never mix.",[109,347,348],{},"In the Pyas dashboard, choose a plan and create a live key. Plans, payment and live keys are always done by you, in the dashboard.",[109,350,351,352,354],{},"Replace the ",[141,353,206],{}," secret with the live key, in the editor and in the published app's secrets.",[109,356,357],{},"Add your published address to the app's allowed origins, and add a live webhook endpoint in the dashboard.",{"title":263,"searchDepth":359,"depth":359,"links":360},3,[361,363,364,365,366,367],{"id":51,"depth":362,"text":52},2,{"id":54,"depth":362,"text":55},{"id":57,"depth":362,"text":58},{"id":60,"depth":362,"text":61},{"id":63,"depth":362,"text":64},{"id":66,"depth":362,"text":67},"md",false,{},true,"\u002Freplit","---\ntitle: Build with Replit\ndescription: Add Google Calendar and Microsoft Outlook to a Replit app. Connect the Pyas MCP server to Replit, and Replit Agent adds the server routes, the secret and the connect button.\nsections:\n  - { id: add-pyas-to-replit, title: Add Pyas to Replit }\n  - { id: ask-for-what-you-want, title: Ask for what you want }\n  - { id: store-the-key, title: Store the key }\n  - { id: what-replit-agent-adds, title: What Replit Agent adds }\n  - { id: receive-webhooks, title: Receive webhooks }\n  - { id: go-live, title: Go live }\n---\n\n# Build with Replit\n\n::lead\nReplit Agent can add Google Calendar and Microsoft Outlook to your app with Pyas. You connect the Pyas MCP server to Replit once. The agent then gets the code for each task from Pyas, and you store a key as a secret. The key stays on the server, and the code works with the sandbox's sample people before anyone connects a real calendar.\n::\n\n## Add Pyas to Replit\n\nSelect [Add Pyas to Replit](https:\u002F\u002Freplit.com\u002Fintegrations?mcp=eyJkaXNwbGF5TmFtZSI6IlB5YXMiLCJiYXNlVXJsIjoiaHR0cHM6Ly9tY3AucHlhcy5pby9zYW5kYm94In0%3D). Replit opens your integration settings with Pyas filled in. Select **Add to Replit**, then sign in.\n\nOr add it yourself:\n\n1. In Replit, open **Settings**, then **Integrations**.\n2. Under **Your integrations**, select **Add custom**, then **Add personal MCP server**.\n3. For **Display name**, enter `Pyas`. For **MCP Server URL**, enter `https:\u002F\u002Fmcp.pyas.io\u002Fsandbox`.\n4. Select **Test & save**. Replit registers itself with Pyas and opens the sign-in. Sign in to Pyas, choose your app, and select **Allow**. See [Sign in](\u002Fai-tools#sign-in) for what each permission allows.\n\nThe Pyas tools are then available to Replit Agent in all of your projects. When a tool needs your confirmation, Replit asks you before it runs.\n\n## Ask for what you want\n\nAsk in plain words, for example:\n\n> Add a button that lets people connect their Google or Outlook calendar, and show their events for the next week.\n\nThe agent checks your setup with `setup_status` and gets the code for each task with `get_recipe`. It adds your app's address to the allowed origins with `update_app`, and creates a test key with `get_test_key`. You confirm the address in Pyas, from the link it gives you. Every response from Pyas ends with the next step, so the agent knows what to do next.\n\n## Store the key\n\nStore the test key as a secret named `PYAS_API_KEY`:\n\n1. In your project, open **Tools**, then **Secrets**. Select **New Secret**, enter the name and the key, and select **Add Secret**.\n2. When you publish, add it again for the published app: open **Publishing**, then **Adjust settings**, then **Production app secrets**. Secrets in the editor don't carry over to the published app.\n\nYour server reads the secret as `process.env.PYAS_API_KEY`, and it never reaches the browser. A test key works only in your app's [sandbox](\u002Fsandbox).\n\n## What Replit Agent adds\n\nThe code runs in your app's Express server:\n\n```text\nserver\u002Fpyas.ts                         the Pyas client, and who is signed in\nserver\u002Froutes\u002Fpyas-connect-session.ts  creates a connect session for the button\nserver\u002Froutes\u002Fpyas-events.ts           the person's events for the next 7 days\nserver\u002Froutes\u002Fpyas-book.ts             books the first free 30 minutes tomorrow\nclient\u002FConnectCalendar.tsx             the \"Connect an account\" button\n```\n\nEach route file exports a router, which the agent mounts in your server with `app.use()`. Your pages call the routes with `fetch`, for example `fetch('\u002Fapi\u002Fpyas\u002Fevents')`.\n\nWith a test key, the routes use the sandbox's sample person, so the events and booking work right away. The connect button shows a message from Pyas that connecting a real calendar requires a live key. This is expected.\n\n## Receive webhooks\n\nAsk the agent to receive Pyas webhooks. It adds `server\u002Froutes\u002Fpyas-webhooks.ts` and mounts it before `app.use(express.json())`. The route verifies the signature of each delivery against the raw body, which no longer matches once the body is parsed.\n\nThe agent adds the endpoint to your sandbox with `create_webhook`, at your published address:\n\n```text\nhttps:\u002F\u002F\u003Cyour-app>.replit.app\u002Fapi\u002Fpyas\u002Fwebhooks\n```\n\nUse the published address, not the editor preview's, which can change. Store the signing secret that `create_webhook` returns as a secret named `PYAS_WEBHOOK_SECRET`, in the editor and in the published app's secrets. See [Webhooks](\u002Fwebhooks) for the events Pyas sends.\n\n## Go live\n\n1. Make `currentUserId()` in `server\u002Fpyas.ts` return the signed-in person's ID from your app's sign-in. Until then, the routes respond with `401` and the code `SIGN_IN_REQUIRED` to every request made with a live key, so people's calendars never mix.\n2. In the Pyas dashboard, choose a plan and create a live key. Plans, payment and live keys are always done by you, in the dashboard.\n3. Replace the `PYAS_API_KEY` secret with the live key, in the editor and in the published app's secrets.\n4. Add your published address to the app's allowed origins, and add a live webhook endpoint in the dashboard.\n",{"title":47,"description":48},"replit",null,"baimFfA14fJclwZstH7fMXGM-w5rWnHNjLkkyze5Ba0",1794697270409]