Notifications


Whenever you perform any* action on flowthings.io, a notification will be generated in your Flow Inbox:

/<yourname>/:inbox

*The one exception to this is Drops

This helps you keep an audit of how your application has been changed. Even more useful; if you've shared an Application with other users, Notifications will allow you to keep track of what changes they've made.

We can see how this works by creating a new Flow object:

## Create the Flow
curl https://api.flowthings.io/v0.1/alice/flow \
    -H "X-Auth-Token: IlmK7uLSzQvXruJbyGMCfrcU05p52NXp"  \
    -d '{ "path" : "/alice/fitness-tracker" }'

## Retrieve from the /alice/:inbox path
curl https://api.flowthings.io/v0.1/alice/drop/f54932047d4c67eee1cbdbd36 \
       -G -H "X-Auth-Token: IlmK7uLSzQvXruJbyGMCfrcU05p52NXp" \
       --data-urlencode "pretty=true&filter=\"elems.object.id==f54a40cd5d4c65af20a9cb552\""

{
  "head" : {
    "status" : 200,
    "ok" : true,
    "messages" : [ ],
    "errors" : [ ],
    "references" : { }
  },
  "body" : {
    "id" : "d54a40cd5d4c65af20a9cb553",
    "flowId" : "f54932047d4c67eee1cbdbd36",
    "creationDate" : 1420037333604,
    "path" : "/alice/:inbox",
    "elems" : {
      "namespacesAffected" : [ "alice" ],
      "kind" : "NOTIFICATION",
      "action" : "CREATE",
      "user" : {
        "name" : "alice",
        "id" : "i54932047d4c67eee1cbdbd31"
      },
      "object" : {
        "kind" : "FLOW",
        "id" : "f54a40cd5d4c65af20a9cb552"
      }
    }
  }
}%

More Power!


Because Notifications are actually just vanilla Drops, you can manipulate them as you would any other Drop in the system, by creating Tracks from the Inbox to any other Flow.

You could:

  • Create separate Flows for each collaborator, and track what changes each have made individually
  • Filter for particular paths, actions, users, or object types
  • Send an alert whenever someone Tracks from your data

Adjusting Notification Storage


To limit the number of Notifications stored in your Inbox, you can modify the capacity attribute on the Inbox Flow:

## Limit storage of Notifications to the most recent 20
curl https://api.flowthings.io/v0.1/alice/flow/f54932047d4c67eee1cbdbd36 \
    -H "X-Auth-Token: IlmK7uLSzQvXruJbyGMCfrcU05p52NXp"  \
    -d '{ "capacity" : 20 }' \
    -X PUT

## Do not store any Notifications
curl https://api.flowthings.io/v0.1/alice/flow/f54932047d4c67eee1cbdbd36 \
    -H "X-Auth-Token: IlmK7uLSzQvXruJbyGMCfrcU05p52NXp"  \
    -d '{ "capacity" : 0 }' \
    -X PUT