Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******
- Instructions
- 1. Configure the variables below under "Configuration"
- 2. Set up your inputs. You can modify the configComment however you please but make configRecord just drop in a string for the record ID.
- 3. Test it to see if it works. If it isn't the console outputs the error for you.
- *******/
- let inputConfig = input.config();
- //Configuration
- let configBase = "app---";// You can retrieve these values from the URL of any open table
- let configTable = "tbl---";
- let configRecord = inputConfig.recordID;//Pass a value into here from input variables
- let configComment = "Hello there! This is a comment!";//Modify however you want.
- let configBearerToken = "---";//To generate this, look here: https://airtable.com/create/tokens
- //Variables
- let bodyContent = JSON.stringify({
- 'text': configComment
- });
- let url = 'https://api.airtable.com/v0/' + configBase + '/' + configTable + '/' + configRecord + '/comments';
- //Create the Comment
- let response = await fetch(url, {
- method: 'POST',
- headers: {
- 'Authorization': 'Bearer ' + configBearerToken,
- 'Content-Type': 'application/json',
- },
- body: bodyContent
- });
- console.log(await response.text());
Advertisement
Add Comment
Please, Sign In to add comment