This project provides an example of how to create a shortcut and handle state and interaction of it in Bettermode.
-
Create an App and Install It
- Obtain
client_id,client_secret, andwebhook_signing_secret.
- Obtain
-
Setup Webhook domain
- Add a domain for handling webhooks.
- Update webhooks.
-
Create a Shortcut
- Create a shortcut with custom
Name,KeyandInteraction URL. - Set the context to
POST. - Create at least one
State.
- Create a shortcut with custom
-
Create a
.envFileCLIENT_ID=XXXXXXX-XXXXXXXXXXXXXXXXX CLIENT_SECRET=XXXXXXXXXXXXXXXXXXXXXXXX WEBHOOK_SIGNING_SECRET=XXXXXXXXXXXXXXXXXXXXXXXX
-
Fill the shortcut data
- Fill shortcut data in
consts/shortcuts.ts. - The data should be in the following format:
[ { "key": '-- Created Shortcut Key --', "context": '-- Created Shortcut Context --', "states": [ "-- Created State [1] --", ... ], "interactions": [ { ... } ] } ] - Fill shortcut data in
-
Fill in the Blanks in the Project
-
Run the Project
Create a .env file in the root directory of the project and fill it with the following variables:
- Clone the repository:
git clone <https://github.com/AliAghamiriBettermode/CreateReportShortcut>
- Install the dependencies:
npm install
- Run the project:
npm start
- The project will be running on
http://localhost:5001.