Skip to content

Commit

Permalink
📝 Update README.md and add sample.config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
prophen committed Jul 6, 2020
1 parent fac864f commit 040ae56
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 26 deletions.
44 changes: 18 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
# To-do list block
# The Done List Block

This example block shows a to-do list based on the records in a table.
Instead of making a list of things to do, this block allows you to document what has already been done. It's a way to remind ourselves that even when it feels like we aren't productive, there are small wins we can recognize throughout the day.

The code shows:
When a done list item is added via the block a message congratulating you on your acheivement is sent by SMS using a Twilio function.

- How to query and display data from your base.

- How to use core Airtable functions like "expand record".
# Instructions to send text messages
Create a Twilio function and update your phone number settings to use the function path as a webhook when a message is received.

- How to use the built-in component library to let the user choose a table.
This is the code to paste in the configuration of your Function.
```
exports.handler = function(context, event, callback) {
context.getTwilioClient().messages.create({
to: '+15555555555', //Enter your phone to receive a text
from: '+15555555555', //Enter your Twilio phone number
body: `"${event.msg}" - That's a win, good job! `
}).then(msg => {
callback(null, msg.sid);
}).catch(err => callback(err));
}
```

- How to store settings in `globalConfig`.

- How to create, update, and delete records in your base.

- How to make your block adapt to the current user's permissions.

## How to run this block

1. Copy
[this base](https://airtable.com/shrKs6a2cQPEK5yzr/tbl1O3LqNL0wSBjfw/viwiJOsjivcJFXAAB?blocks=hide).

2. Create a new block in your new base (see
[Create a new block](https://airtable.com/developers/blocks/guides/hello-world-tutorial#create-a-new-block)),
selecting "To-do list" as your template.

3. From the root of your new block, run `block run`.

## See the block running

![Block updating to-do list as the user changes data](media/block.gif)
Rename sample.config.js, uncomment the code and update it with your own path from the Twilio function.
14 changes: 14 additions & 0 deletions frontend/sample.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* Uncomment and enter the path to your twilio function
I ran out of time but I was planning to add gifs to the text message that gets sent when a task is added using the block
*/

// const twilioConfig = {
// ENDPOINT_URI:
// FROM_PHONE_NUMBER:
// TO_PHONE_NUMBER:
// };

// const GIPHY_API_KEY =

// export { twilioConfig, GIPHY_API_KEY };

0 comments on commit 040ae56

Please sign in to comment.