Interacting with Coda docs from anywhere

Hi everyone,
I created a way to read from and write to Coda docs from anywhere on the web using keyboard shortcuts. Here’s a quick overview.

Coda and Text Blaze · Interacting with Coda docs from anywhere - Watch Video

Let me know what you think and in what other ways you’d like to be able to interact with your Coda docs from anywhere.

Instructions for using this integration are here.

4 Likes

The ability to read and update tasks while also messaging my colleagues at the same time is so awesome. Thanks for taking the time to put this together! :slight_smile:

Can you explain a bit more on how this integration works?

2 Likes

Sure.
Text Blaze is a chrome extension where you can save text templates and insert them anywhere on the web using predefined shortcuts.
These templates can include dynamic features such as placeholders (form fields), formulas and even API calls.
I created a few of these templates (called snippets) that call the Coda API:

  • One template reads data from one of my docs (specifically here a table) and use that data in the template (“here are the open tasks”: ).
  • The other template has form fields that I can fill in when inserting the template. Then the Coda API is called to insert the data from the form fields to my table. When I insert the snippet, it types the following text wherever I am (Gmail in this example): “Hey , a new task for you , due on: ” and it also adds a new task to the table with the same information.

Try it out. It’s pretty cool.

Also, shoutout to @Bill_French who introduced me to wonderful world of Coda <> Text Blaze integrations.

1 Like

Frickin’ awesome!

The alchemy of intelligent, connected, and sometimes structured information gathered with Text Blaze and shared into Coda from any “Interweb” context is very powerful chemistry. Good job!

1 Like

I see a horizon of Text Blaze plugins that fully integrate Coda documents for seamless interchange. An additional area that I have not yet explored is how Coda Packs might intersect with hyper-productive snippets in Text Blaze. Imagine a Coda Pack sharing data into Data Blaze and Text Blaze snippets utilizing that data for yet additional expansions - ergo - Coda can be the source of content and data for other apps by using Text Blaze as the conduit. I think there’s a term for this…

Fingertip API :wink:

I think there are vast opportunities to leverage both platforms and Data Blaze as well.

2 Likes

@Bill_French can Coda packs make an API call?

Yes. Pretty much anything you might imagine can be done with Packs. And, you can drop them into the marketplace and earn revenues when they are installed.

UPDATE: This example pack writes data to Data Blaze. It’s rough and only served as an experiment or two to validate the capability.

/*

   ************************************************************
   Global Technologies Corporation: BackFill
   Copyright (c) 2022 by Global Technologies Corporation
   ALL RIGHTS RESERVED
   ************************************************************

*/

import * as coda from "@codahq/packs-sdk";

export const pack = coda.newPack();

pack.setUserAuthentication({
  type: coda.AuthenticationType.CustomHeaderToken,
  headerName: "Token",
  instructionsUrl: 'https://data-api.blaze.today/account/api-keys'
});

user_field_names=tru

pack.addNetworkDomain("data-api.blaze.today");

interface UpdateRowRequest {
  Topic   : string;
  Content : string;
  CodaID  : string;
  DBID    : string;
}

async function updateRow(context: coda.ExecutionContext, request: UpdateRowRequest): Promise<string> {
  console.log("DBIDu: " + JSON.stringify(request.DBID));
  // const url = "https://data-api.blaze.today/api/database/rows/table/3mlRY16Z7zGc8H4vinjrM4/" + request.DBID + "/?user_field_names=true";
  const url = "https://data-api.blaze.today/api/database/rows/table/3mlRY16Z7zGc8H4vinjrM4/?user_field_names=true";
  console.log("url: " + url);

  const resp = await context.fetcher.fetch(
    {
      url: url, 
      method: "POST",
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Token <token here>'
        },
      body: JSON.stringify(request)
    })
  console.log(resp);
  return resp.body
}

const Topic = coda.makeParameter({
  type: coda.ParameterType.String,
  name: "Topic",
  description: "topic",
});
const Content = coda.makeParameter({
  type: coda.ParameterType.String,
  name: "Content",
  description: "content",
});
const CodaID = coda.makeParameter({
  type: coda.ParameterType.String,
  name: "CodaID",
  description: "Coda Row ID",
});
const DBID = coda.makeParameter({
  type: coda.ParameterType.String,
  name: "DBID",
  description: "Data Blaze ID",
});

pack.addFormula({
  name: "BackFill",
  description: "Create data blaze row.",
  parameters: [
    Topic,
    Content,
    CodaID,
    DBID
  ],
  resultType: coda.ValueType.String,
  execute: async function ([Topic, Content, CodaID, DBID], context) {

    console.log("CodaID: " + CodaID);
    CodaID = CodaID + "&view=modal";

    let result = "";
    const request = {
      Topic,
      Content,
      CodaID,
      DBID
    }
    console.log("request: " + JSON.stringify(request));
    if (CodaID.toString().indexOf("/r") > -1) {
      result = await updateRow(context, request);
      console.log(result);
    }
    return result
  },
});
1 Like