Google Docs connector
The Google Docs connector enables reading documents as Markdown and applying batch updates. This connector is complementary to the Google Drive connector: use Drive to search or list files, then pass the document ID to the actions on this page.
You can create connectors in Stack Management > Connectors.
Google Docs connectors use OAuth 2.0 authorization code — Google signs the user in through Kibana and Kibana stores refreshable tokens.
- OAuth 2.0 authorization code
-
Uses a Web application OAuth client in Google Cloud. In Kibana you provide:
- Client ID and Client Secret: from that OAuth client
- Redirect URI: register Kibana's OAuth callback in Google Cloud (see Get API credentials)
The connector automatically uses the correct Google OAuth endpoints and the required scopes (
https://www.googleapis.com/auth/drive.readonlyandhttps://www.googleapis.com/auth/documents).
You can test connectors when you create or edit the connector in Kibana. The test verifies connectivity by fetching user information from the Google Drive API.
The Google Docs connector has the following actions:
- Read document
-
Read the full content of a Google Doc as Markdown. Returns the document title, Markdown content, total character count, and a web link.
document_id(required): The ID of the Google Doc. Found in the document URL:docs.google.com/document/d/{document_id}/edit.max_characters(optional): Maximum number of characters to return (default 100,000, range 1,000–200,000). If the document is longer, the response includestruncated: trueandnext_offset.offset(optional): Character offset to start reading from (default 0). Passnext_offsetfrom a previous response to page through a long document.
- Update document
-
Apply one or more batch updates to a Google Doc. Supports replacing text, applying text and paragraph styles, managing bullet lists, inserting and deleting tables and table rows, inserting inline images, and managing named ranges.
document_id(required): The ID of the Google Doc to update.requests(required): Array of batch update request objects (1 to 100). Each object must contain exactly one operation key. Multiple requests are applied atomically in order. See the Google Docs batchUpdate reference for the full list of supported operations.
Use
replaceAllTextfor text replacement — it requires no index arithmetic and is the safest approach.
Use the Action configuration settings to customize connector networking, such as proxies, certificates, or TLS settings. You can set configurations that apply to all your connectors or use xpack.actions.customHostSettings to set per-host configurations.
Configure a Web application OAuth client in Google Cloud.
Start in Google Cloud Console.
- In Google Cloud Console, select or create a project. Enable the Google Docs API and Google Drive API for that project (APIs & Services > Library).
- Open APIs & Services > OAuth consent screen.
- Create OAuth Client
- Select Web Application
- The Name can be something like
ElasticorKibana - Under Authorized JavaScript origins, add the base origin of your Kibana deployment (scheme, host, and port only —
for example,
https://my-kibana.example.com). - Under Authorized redirect URIs, add Kibana's connector OAuth callback. The easiest way
is to copy the exact URI shown in the Kibana connector creation form. If you need to
construct it manually, use the pattern below, substituting your public Kibana hostname and
any configured
server.basePath(for example, if Kibana is served athttps://my-kibana.example.com/kibana, use/kibana/api/...instead of/api/...):https://<your-kibana-host>/api/actions/connector/_oauth_callback
- Open APIs & Services > Data Access and add the following scopes:
https://www.googleapis.com/auth/documentshttps://www.googleapis.com/auth/drive.readonly
- Create the client, then copy Client ID and Client secret into the connector in Kibana when you select OAuth 2.0 authorization code. The connector automatically configures the correct Google OAuth endpoints and scopes.