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.
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())
}