> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runmorph.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Docs

> Open-Source Google Docs Connector

<Card title="Google Docs" icon={<svg width="24" height="24" viewBox="0 0 62 62" xmlns="http://www.w3.org/2000/svg" fill="none"><mask id="A" maskUnits="userSpaceOnUse" x="15" y="9" width="32" height="44"><path d="M46.815 9H15v44h31.815V9z" fill="#fff"/></mask><g mask="url(#A)"><mask id="B" maskUnits="userSpaceOnUse" x="15" y="9" width="32" height="44" mask-type="alpha"><path d="M34.885 9H17.983C16.342 9 15 10.35 15 12v38c0 1.65 1.342 3 2.983 3h25.85c1.64 0 2.983-1.35 2.983-3V21L34.885 9z" fill="#fff"/></mask><g mask="url(#B)"><path d="M34.885 9H17.983C16.342 9 15 10.35 15 12v38c0 1.65 1.342 3 2.983 3h25.85c1.64 0 2.983-1.35 2.983-3V21l-6.96-5-4.971-7z" fill="#4285f4"/></g><mask id="C" maskUnits="userSpaceOnUse" x="15" y="9" width="32" height="44" mask-type="alpha"><path d="M34.885 9H17.983C16.342 9 15 10.35 15 12v38c0 1.65 1.342 3 2.983 3h25.85c1.64 0 2.983-1.35 2.983-3V21L34.885 9z" fill="#fff"/></mask><g mask="url(#C)"><path d="M35.757 20.123l11.058 11.12V21l-11.058-.878z" fill="url(#I)"/></g><mask id="D" maskUnits="userSpaceOnUse" x="15" y="9" width="32" height="44" mask-type="alpha"><path d="M34.885 9H17.983C16.342 9 15 10.35 15 12v38c0 1.65 1.342 3 2.983 3h25.85c1.64 0 2.983-1.35 2.983-3V21L34.885 9z" fill="#fff"/></mask><g mask="url(#D)"><path d="M22.954 41h15.908v-2H22.954v2zm0 4h11.931v-2H22.954v2zm0-14v2h15.908v-2H22.954zm0 6h15.908v-2H22.954v2z" fill="#f1f1f1"/></g><mask id="E" maskUnits="userSpaceOnUse" x="15" y="9" width="32" height="44" mask-type="alpha"><path d="M34.885 9H17.983C16.342 9 15 10.35 15 12v38c0 1.65 1.342 3 2.983 3h25.85c1.64 0 2.983-1.35 2.983-3V21L34.885 9z" fill="#fff"/></mask><g mask="url(#E)"><path d="M34.885 9v9c0 1.657 1.335 3 2.983 3h8.948L34.885 9z" fill="#a1c2fa"/></g><mask id="F" maskUnits="userSpaceOnUse" x="15" y="9" width="32" height="44" mask-type="alpha"><path d="M34.885 9H17.983C16.342 9 15 10.35 15 12v38c0 1.65 1.342 3 2.983 3h25.85c1.64 0 2.983-1.35 2.983-3V21L34.885 9z" fill="#fff"/></mask><g mask="url(#F)"><path d="M17.983 9C16.342 9 15 10.35 15 12v.25c0-1.65 1.342-3 2.983-3h16.902V9H17.983z" fill="#fff" fill-opacity=".2"/></g><mask id="G" maskUnits="userSpaceOnUse" x="15" y="9" width="32" height="44" mask-type="alpha"><path d="M34.885 9H17.983C16.342 9 15 10.35 15 12v38c0 1.65 1.342 3 2.983 3h25.85c1.64 0 2.983-1.35 2.983-3V21L34.885 9z" fill="#fff"/></mask><g mask="url(#G)"><path d="M43.833 52.75h-25.85c-1.641 0-2.983-1.35-2.983-3V50c0 1.65 1.342 3 2.983 3h25.85c1.64 0 2.983-1.35 2.983-3v-.25c0 1.65-1.342 3-2.983 3z" fill="#1a237e" fill-opacity=".2"/></g><mask id="H" maskUnits="userSpaceOnUse" x="15" y="9" width="32" height="44" mask-type="alpha"><path d="M34.885 9H17.983C16.342 9 15 10.35 15 12v38c0 1.65 1.342 3 2.983 3h25.85c1.64 0 2.983-1.35 2.983-3V21L34.885 9z" fill="#fff"/></mask><g mask="url(#H)"><path d="M37.867 21c-1.648 0-2.983-1.343-2.983-3v.25c0 1.657 1.335 3 2.983 3h8.948V21h-8.948z" fill="#1a237e" fill-opacity=".1"/></g></g><defs><linearGradient id="I" x1="41.287" y1="21.077" x2="41.287" y2="31.244" gradientUnits="userSpaceOnUse"><stop stop-color="#1a237e" stop-opacity=".2"/><stop offset="1" stop-color="#1a237e" stop-opacity=".02"/></linearGradient></defs></svg>}>
  The Google Docs connector enables easy and secure data synchronization between your application and your customers' Google Docs accounts through unified data models.
</Card>

## Authorization

<Accordion title="OAuth" defaultOpen={false} icon="key-skeleton" iconType="duotone">
  The Google Docs connector uses OAuth for secure authentication. When creating a connection, the required OAuth scopes are automatically configured based on your specific operations needs (e.g. `genericContact::create`, `genericUser::list`).<br /><br />
  ✓ Automatic token refresh handling<br />
  ✓ Proactive insufficient permissions detection<br /><br />

  [View our step-by-step integration guide](./../api-reference/intro)

  **Whitelabel**

  <Check>
    **Supported** <br />
    You can choose to provide your own set of `clientId` and `clientSecret` for this
    connector from the Morph Cloud dashboard; allowing a fully whitelabled experience
    for your end-customers.
  </Check>
</Accordion>

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { Morph } from "@runmorph/cloud";

  const morph = Morph({ publicKey: "pk_demo_xxxxxxxxxxxxxxx", secretKey: "sk_demo_xxxxxxxxxxxxxxx"}); 

  // create a new connection
  const connection = morph.connections({ connectorId: "google-docs", ownerId: "demo" });
  await connection.create({ operations:[ "genericContact::list" ]});

  // auhtorize the connection
  const { auhtorizationUrl } = await connection.authorize();

  // redirect the user to the auhtorizationUrl
  ```

  ```tsx React theme={null}
  import { Morph, Connect } from "@runmorph/atoms";

  // generate sessionToken from server →  morph.sessions().create(...);

  export default function ConnectionPage({ sessionToken }) {
    return (
      <Morph.Provider>
        <Connect
          sessionToken={sessionToken}
          connectionCallbacks={{
            onError: (error) => alert(error.message)
          }}
        />
      </Morph.Provider>
    );
  }
  ```

  ```python Python theme={null}
  morph = Morph(api_key="pk_demo_xxxxxxxxxxxxxxx", api_secret="sk_demo_xxxxxxxxxxxxxxx")

  # create a new connection
  connection = morph.connections(connector_id="google-docs", owner_id="demo")
  connection.create(operations=[ "genericContact::list" ])

  # authorize the connection
  auth_result = connection.authorize()
  authorization_url = auth_result["authorization_url"]

  # redirect the user to the authorization_url
  ```

  ```ruby Ruby theme={null}
  morph = Morph.new(api_key: "pk_demo_xxxxxxxxxxxxxxx", api_secret: "sk_demo_xxxxxxxxxxxxxxx")

  # create a new connection
  connection = morph.connections(connector_id: "google-docs", owner_id: "demo")
  connection.create(operations: [ "genericContact::list" ])

  # authorize the connection
  auth_result = connection.authorize
  authorization_url = auth_result[:authorization_url]

  # redirect the user to the authorization_url
  ```

  ```php PHP theme={null}
  $morph = new Morph([
    'api_key' => 'pk_demo_xxxxxxxxxxxxxxx',
    'api_secret' => 'sk_demo_xxxxxxxxxxxxxxx'
  ]);

  // create a new connection
  $connection = $morph->connections([
    'connector_id' => 'google-docs',
    'owner_id' => 'demo'
  ]);
  $connection->create(['operations' => ['genericContact::create','genericUser::list']]);

  // auhtorize the connection
  $authResult = $connection->authorize();
  $authorizationUrl = $authResult['authorization_url'];

  // redirect the user to the auhtorizationUrl
  ```

  ```go Go theme={null}
  morph := morph.New(&morph.Config{
      publicKey:    "pk_demo_xxxxxxxxxxxxxxx",
      secretKey: "sk_demo_xxxxxxxxxxxxxxx",
  })

  // create a new connection
  connection := morph.Connections(&morph.ConnectionConfig{
      ConnectorId: "google-docs",
      OwnerId:    "demo",
  })
  connection.Create(&morph.CreateConfig{
      Operations: []string{"genericContact::create", "genericUser::list"},
  })

  // authorize the connection
  authResult, _ := connection.Authorize()
  authorizationUrl := authResult.AuthorizationUrl

  // redirect the user to the authorization URL
  ```
</CodeGroup>

<br />

<Accordion title="Try a live demo of Google Docs connection ✨">
  <Check>
    **Live Demo** <br />
    Select a connector below to experience our seamless authentication flow and see
    how easy it is to connect third-party services.
  </Check>

  <iframe src="https://atoms-playground.vercel.app/temp/connectors/google-docs?theme=light" width="100%" height="370px" className="block dark:hidden" />

  <iframe src="https://atoms-playground.vercel.app/temp/connectors/google-docs?theme=dark" width="100%" height="370px" className="hidden dark:block" />
</Accordion>

## Models

### Generic

<AccordionGroup>
  <Accordion title="User" defaultOpen={false} icon="users-medical">
    <p>
      The Google Docs connector seamlessly integrates with our unified `genericUser` model, enabling you to manage Users with rich data including `firstName`, `lastName`, `email` and other key details <br />
    </p>

    **API Reference**

    <table className="mt-0">
      <tr>
        <td className="py-1 px-2">
          <span className="px-1 py-0.5 rounded-md leading-tight font-bold bg-green-400/20 text-green-700 dark:bg-green-400/20 dark:text-green-400">GET</span>
        </td>

        <td className="py-1 px-2">`/resources/genericUser`</td>
        <td className="py-1 px-2">[List and Search Google Docs Users](./../api-reference/models/user/list-user)</td>
      </tr>

      <tr>
        <td className="py-1 px-2">
          <span className="px-1 py-0.5 rounded-md  leading-tight font-bold bg-green-400/20 text-green-700 dark:bg-green-400/20 dark:text-green-400">GET</span>
        </td>

        <td className="py-1 px-2">`/resources/genericUser/:id`</td>
        <td className="py-1 px-2">[Retrieve a Google Docs User](./../api-reference/models/user/retrieve-user)</td>
      </tr>

      <tr>
        <td className="py-1 px-2">
          <span className="px-1 py-0.5 rounded-md  leading-tight font-bold bg-blue-400/20 text-blue-700 dark:bg-blue-400/20 dark:text-blue-400">POST</span>
        </td>

        <td className="py-1 px-2">`/resources/genericUser`</td>
        <td className="py-1 px-2">[Create a Google Docs User](./../api-reference/models/user/create-user)</td>
      </tr>

      <tr>
        <td className="py-1 px-2">
          <span className="px-1 py-0.5 rounded-md leading-tight font-bold bg-orange-400/20 text-orange-700 dark:bg-orange-400/20 dark:text-orange-400">PATCH</span>
        </td>

        <td className="py-1 px-2">`/resources/genericUser/:id`</td>
        <td className="py-1 px-2">[Update a Google Docs User](./../api-reference/models/user/update-user)</td>
      </tr>

      <tr>
        <td className="py-1 px-2">
          <span className="px-1 py-0.5 rounded-md leading-tight font-bold bg-red-400/20 text-red-700 dark:bg-red-400/20 dark:text-red-400">DEL</span>
        </td>

        <td className="py-1 px-2">`/resources/genericUser/:id`</td>
        <td className="py-1 px-2">[Delete a Google Docs User](./../api-reference/models/user/delete-user)</td>
      </tr>
    </table>

    **Custom Fields**

    <Check>
      **Supported** <br />
      The Google Docs connector supports our `Field Mapping` feature, enabling you or your customers to seamlessly map Google Docs User custom fields to the unified user model. This allows for flexible data synchronization while maintaining data consistency across all connectors.
    </Check>

    <br />

    [view User model details](./../models/genericUser)
  </Accordion>

  <Accordion title="Workspace" defaultOpen={false} icon="network-wired">
    <p>
      The Google Docs connector seamlessly integrates with our unified `genericWorkspace` model, enabling you to manage Workspaces with rich data including `name` and other key details <br />
    </p>

    **API Reference**

    <table className="mt-0">
      <tr>
        <td className="py-1 px-2">
          <span className="px-1 py-0.5 rounded-md leading-tight font-bold bg-green-400/20 text-green-700 dark:bg-green-400/20 dark:text-green-400">GET</span>
        </td>

        <td className="py-1 px-2">`/resources/genericWorkspace`</td>
        <td className="py-1 px-2">[List and Search Google Docs Workspaces](./../api-reference/models/workspace/list-workspace)</td>
      </tr>

      <tr>
        <td className="py-1 px-2">
          <span className="px-1 py-0.5 rounded-md  leading-tight font-bold bg-green-400/20 text-green-700 dark:bg-green-400/20 dark:text-green-400">GET</span>
        </td>

        <td className="py-1 px-2">`/resources/genericWorkspace/:id`</td>
        <td className="py-1 px-2">[Retrieve a Google Docs Workspace](./../api-reference/models/workspace/retrieve-workspace)</td>
      </tr>

      <tr>
        <td className="py-1 px-2">
          <span className="px-1 py-0.5 rounded-md  leading-tight font-bold bg-blue-400/20 text-blue-700 dark:bg-blue-400/20 dark:text-blue-400">POST</span>
        </td>

        <td className="py-1 px-2">`/resources/genericWorkspace`</td>
        <td className="py-1 px-2">[Create a Google Docs Workspace](./../api-reference/models/workspace/create-workspace)</td>
      </tr>

      <tr>
        <td className="py-1 px-2">
          <span className="px-1 py-0.5 rounded-md leading-tight font-bold bg-orange-400/20 text-orange-700 dark:bg-orange-400/20 dark:text-orange-400">PATCH</span>
        </td>

        <td className="py-1 px-2">`/resources/genericWorkspace/:id`</td>
        <td className="py-1 px-2">[Update a Google Docs Workspace](./../api-reference/models/workspace/update-workspace)</td>
      </tr>

      <tr>
        <td className="py-1 px-2">
          <span className="px-1 py-0.5 rounded-md leading-tight font-bold bg-red-400/20 text-red-700 dark:bg-red-400/20 dark:text-red-400">DEL</span>
        </td>

        <td className="py-1 px-2">`/resources/genericWorkspace/:id`</td>
        <td className="py-1 px-2">[Delete a Google Docs Workspace](./../api-reference/models/workspace/delete-workspace)</td>
      </tr>
    </table>

    **Custom Fields**

    <Check>
      **Supported** <br />
      The Google Docs connector supports our `Field Mapping` feature, enabling you or your customers to seamlessly map Google Docs Workspace custom fields to the unified workspace model. This allows for flexible data synchronization while maintaining data consistency across all connectors.
    </Check>

    <br />

    [view Workspace model details](./../models/genericWorkspace)
  </Accordion>
</AccordionGroup>

## Custom

<Check>
  **Supported** <br />
  Can't find the unified model you need? The Google Docs connector supports your own custom model.
</Check>

## Webhooks

<Accordion title="Events Subscription" defaultOpen={false} icon="webhook" iconType="duotone">
  The Google Docs connector supports real-time event subscriptions, allowing you to
  receive instant notifications when records are created, updated, or deleted.
  Below are the supported models and their corresponding triggers.

  <table className="mt-0">
    <tr>
      <th className="py-1 px-2">Models</th>
      <th className="py-1 px-2">Created</th>
      <th className="py-1 px-2">Updated</th>
      <th className="py-1 px-2">Deleted</th>
      <th className="py-1 px-6">API Reference</th>
    </tr>

    <tr>
      <td className="">`genericUser`</td>

      <td className=" text-center">
        <Icon icon="circle-check" iconType="duotone" />
      </td>

      <td className=" text-center">
        <Icon icon="circle-check" iconType="duotone" />
      </td>

      <td className=" text-center">
        <Icon icon="circle-check" iconType="duotone" />
      </td>

      <td className=" text-center">
        [view event](./../api-reference/models/user/event)
      </td>
    </tr>

    <tr>
      <td className="">`genericWorkspace`</td>

      <td className=" text-center">
        <Icon icon="circle-x" iconType="duotone" color="gray" />
      </td>

      <td className=" text-center">
        <Icon icon="circle-x" iconType="duotone" color="gray" />
      </td>

      <td className=" text-center">
        <Icon icon="circle-x" iconType="duotone" color="gray" />
      </td>

      <td className=" text-center">
        [view event](./../api-reference/models/workspace/event)
      </td>
    </tr>
  </table>
</Accordion>

## Proxy

<Check>
  **Supported** <br />
  The Google Docs connector supports our `Proxy Request` feature, allowing you to directly
  call any endpoints from Google Docs's public API without needing to handle authentication.
  Your customer's token will be automatically set and refreshed as needed, enabling
  quick implementation of custom connector behaviors. [View API Reference](./../api-reference/proxy/proxy-request-to-connector).
</Check>
