A JSON endpoint to send Chatfuel user attributes to a Google Sheet.
This app is intended for use in AWS Lambda. General setup:
- Configure this app as an AWS Lambda
- Set requisite env vars (see below)
- Expose via a web gateway
- Set up in Chatfuel as a JSON API card
- Configure this as a POST endpoint
- Send through and Chatfuel attributes you wish. Each attribute will be added to a new column in the doc.
- Add a query param to the url to let the endpoint know which sheet to send to. Eg.
?id=123
where 123 is the id of the sheet, as found in the url.
Environment vars for this app are configured from two sources:
- client_secret.json file from the Google Developers Console. For instructions on setting this up, see step 1 of the Node quickstart docs.
- Once you have the secrets set, run the auth script to get an access token:
node util/auth.js
Variable name | Description |
---|---|
SHEETS_CLIENT_ID | Client ID as found in client_secret.json |
SHEETS_PROJECT_ID | Project ID as found in client_secret.json |
SHEETS_CLIENT_SECRET | Client Secret as found in client_secret.json |
SHEETS_ACCESS_TOKEN | Value as printed by the auth script. |
SHEETS_REFRESH_TOKEN | Value as printed by the auth script. |
SHEETS_TOKEN_TYPE | Value as printed by the auth script. |
SHEETS_EXPIRY_DATE | Value as printed by the auth script. |
It is intended that you can throw any variables you like at this endpoint and they will be saved as columns in a sheet.
It is worth noting that Google Docs has a limit of 400k cells in a sheet. Therefore this is not an appropriate tool for larger-scale or long-term data gathering.