Skip to content

Go library to watch an airtable base and run go code once a field is set to a trigger value

License

Notifications You must be signed in to change notification settings

vertoforce/airtablewatcher

Repository files navigation

Airtable Watcher

Go Report Card Documentation

Airtable watcher makes it easy to run backend go code based on an airtable frontend.

The library watches an airtable base and runs a function when a field is changed to the triggerValue.

Example

example

Usage

Set up an airtable base like this one. Then write code to listen for any rows that have the State field set to ToDo.

func printTask(ctx context.Context, watcher *Watcher, tableName string, row *Row) {
    fmt.Printf("Running code on %v", row)
    // Make sure to change state after work is done!
    watcher.SetRow("Tasks", row.ID, map[string]interface{}{"State": "Done"})
}

func Example() {
    tasker, _ := NewWatcher(os.Getenv("AIRTABLE_KEY"), os.Getenv("AIRTABLE_BASE"))
    tasker.PollInterval = time.Second * 5

    // Register function
    tasker.RegisterFunction("Tasks", "State", "ToDo", printTask)

    // Start tasker
    tasker.Start(context.Background())
}

About

Go library to watch an airtable base and run go code once a field is set to a trigger value

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages