-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Airtable Polling #10
Airtable Polling #10
Conversation
const status = record.get(statusFieldName); | ||
const newStatus = record.getPrior(statusFieldName); | ||
console.log( | ||
`${record.get("Request ID")} moved from ${newStatus} -> ${status}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any ideas about how to stem the tide of hardcoded Airtable column names? Everything I can think of feels over-engineered.
Maybe exporting an object out of the airtable module like:
requestFields = {
requestId: "Request ID",
status: "Status"
}
. . . elsehwhere . . .
record.get(requestFields.requestId)
which is, like, verbose but not magical and will let us at least track this a bit easier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
definitely agree. That's what we're doing with page names in openHome
for the slack app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after this afternoon, i definitely see the need for this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another awesome pull request !!
I love this API, most comments are about documentation
const status = record.get(statusFieldName); | ||
const newStatus = record.getPrior(statusFieldName); | ||
console.log( | ||
`${record.get("Request ID")} moved from ${newStatus} -> ${status}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
definitely agree. That's what we're doing with page names in openHome
for the slack app
We can backfill Slack's UID with ChangeDetector |
I'd love to get this in and be able to play around with it. if you comment out the slack posting part, i think we should merge this ASAP @mab253 thoughts? |
Alrighty, I took out slack and made the changes you suggested. Thanks for the feedback, I was a little foggy when writing some of those comments! |
This is an awesome addition and I can't wait to start working with it. Given urgency, I'm going to merge. After chatting with @mab253 I think she would agree. |
Polling
Creates a new worker that knows how to periodically poll Airtable. This Relies on 2 fields in the Airtable table and provides a 3rd [1]:
Meta
: Stores the last values for the row. This is used to determine what has changed and lets you see what the changes were.Last Modified
: Set up to be an automatic Last Modified field on Airtable's side. This lets us easily poll for changed/new rows by keeping track of the maxLast Modified
we've seen with a small overlap. [2]Last Processed
: Date field that holds the last time this record was processed through the system [2].The basic flow is to:
Notes
AIRTABLE_SYNC=5000 npm start
## Slack ![image](https://user-images.githubusercontent.com/57376/78101461-938d3080-73b5-11ea-8f4c-400f86861006.png)I just sort of ... made something up. The block editor is pretty cool!
Ultimately what do we want the slack message to look like?
We are missing some fields in the airtable that are in the messages that are being manually posted now: name and a public-facing request description (vs. notes).
We can rip out the slack part, I wanted to leave it in for the review you you could see the poller being used.
Having
@display name
in the Volunteers base doesn't seem like enough to mention users without problems because names with spaces are handled poorly, so it looks up the slack user based on email address at the moment. This requires theusers:read.email
scope.If you want to send the message for a single Request you can run:
node ./src/workers/airtable-sync/newDeliveryRequest.js 1
, where in this case 1 is theRequest ID
of the Request.[1]
[2] These need to be set up as With Time / 24HR / UTC in Airtable
Resolves: #5