Giter Club home page Giter Club logo

smartsheet-to-webex's Introduction

Smartsheet to Webex

a Node.js webhook that posts messages to Webex as new rows are filled in a SmartSheet.

To run this code, you will need to:

  1. create a SmartSheet, add a form to it, and pick your Smartsheet info (sheet id and access token)
  2. launch the app after entering the required environment variables (check below for an example on Heroku)

UPDATE: the webhook creation and validation by the SmartSheet API are now directly handled from the webhook app, check register.js for details.

All set! please reach to your Smartsheet's form and enter a guess. You'll see your message poping up in your Webex Messaging client. Update the template to reflect the structure of your smartsheet.

Quick start on Glitch

Click Remix on Glitch

Then open the .env file and paste your bot's token, space id, as well as your smartsheet token and sheet id.

You app is all set: the webhook got automatically created from glitch's PROJECT_DOMAIN env variable.

Your app healthcheck is accessible at your application public url.

Go to your smartsheet and start entering new values, then customize the mustache template for your smartsheet columns.

Launch the SmartSheet to Webex app

For Mac, Linux and bash users, open a terminal and type:

git clone https://github.com/CiscoDevNet/smartsheet-to-webex
cd smartsheet-to-webex
npm install
DEBUG=s2wt*,register*,challenge* SMARTSHEET_TOKEN="ka5XXXXXXXXXXXXXXXX" SMARTSHEET_ID="627552342630404" BOT_TOKEN="MmQ5ZTBYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" SPACE_ID="Y2lzY29zZZZZZZZZZZZZZZZZZZZZZZZZ" PUBLIC_URL="https://e4a1e175.ngrok.io" node webhook.js

For Windows users, open a command shell and type:

git clone https://github.com/CiscoDevNet/smartsheet-to-webex
cd smartsheet-to-webex
npm install
set DEBUG=webhook*
set BOT_TOKEN=XXXXXXXXX
set SPACE_ID=YYYYYYYYYYY
...
node webhook.js

And here is an example of environment variables on Heroku:

Heroku env variables

Done, your webhook is live

Let's hit your app's healthcheck! From the command line, type:

curl -X GET http://localhost:8080

To manually register your app as a Smartsheet Webhook

Note: this step is now optional as the registration is automatically performed at launch.

Create a Smartsheet API token from your smartsheet account:

  • login
  • click your avatar, pick "Apps and Integrations..."
  • among your Personal Settings, select "API Access"
  • click the "Generate new access token" button

Now, let's list your smartsheets and look for the identifier of the smartsheet you want to monitor. From the terminal, run the command below:

curl -X GET https://api.smartsheet.com/2.0/sheets \
  -H 'Authorization: Bearer qq0w5090qq0w5090qq0w5090' 

Almost there, create a SmartSheet webhook on the command line by typing:

curl -X POST https://api.smartsheet.com/2.0/webhooks \
  -H 'Authorization: Bearer qq0w5090qq0w5090qq0w5090' \
  -H 'Content-Type: application/json' \
  -d '{ 
    "callbackUrl": "https://e6174831.ngrok.io",
    "events": ["*.*"],
    "name": "From Postman",
    "scope": "sheet",
    "scopeObjectId" : "6275510532630404",
    "version": "1"
}'

Finally, let's validate the newly created webhook above by updating it (as per the Smartsheet specs). Please replace with the webhook id below:

curl -X PUT https://api.smartsheet.com/2.0/webhooks/5481972073031556 \
  -H 'Authorization: Bearer qq0w5090qq0w5090qq0w5090' \
  -H 'Content-Type: application/json' \
  -d '{ "enabled": true }'

That's it, create a new row entry, and check it shows up in the console. Note: update the provided sample with your own custom logic!

smartsheet-to-webex's People

Contributors

objectisadvantag avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.