Skip to content

Part of the Aselo backend, includes functions hosted on Twilio Functions

License

AGPL-3.0, Unknown licenses found

Licenses found

AGPL-3.0
LICENSE
Unknown
license-header.tpl
Notifications You must be signed in to change notification settings

techmatters/serverless

Folders and files

NameName
Last commit message
Last commit date
Nov 8, 2021
Jan 17, 2025
Feb 2, 2023
Dec 17, 2024
Jan 23, 2025
Jan 15, 2025
Jan 16, 2025
May 28, 2020
May 22, 2024
May 22, 2024
Apr 27, 2023
Mar 22, 2021
Aug 30, 2023
Feb 2, 2023
Feb 2, 2023
Dec 19, 2024
Dec 16, 2024
Feb 2, 2023
Aug 25, 2022
Jul 26, 2024

Repository files navigation

Actions Status

serverless

Repository for serverless functions living on Twilio Functions. Supports the Aselo frontend. See aselo.org or contact Aselo for more information.

git-secrets

In order to prevent sensitive credentials to be leaked, please follow this instructions to setup git-secrets.

  • Install git-secrets in your computer.
  • Go into the repo root folder.
  • Run git secrets --register-aws.
  • Run git config --local core.hooksPath .githooks/.

Local development

1- Clone repository: git clone https://github.com/tech-matters/serverless && cd serverless 2- Install dependencies: npm ci 3- create a .env file with all the .env variables (below is the whole list) or run npm run ssm:local to fetch them from AWS SSM. 4- run typescript compiler (as Twilio ST serves the .js files) and start local server on port 3030: npm run start:local

For help on twilio-run commands run: npm run tr -- help

Environment variables

Variable Name Expected Value
ACCOUNT_SID sid of the Twilio account (under /project/settings)
AUTH_TOKEN auth token of the above account (under /project/settings)
TWILIO_WORKSPACE_SID workspace sid for the taskrouter (under /taskrouter/workspaces, named Flex Task Assignment)
TWILIO_CHAT_TRANSFER_WORKFLOW_SID sid within above workspace (under /taskrouter/workspaces/< above-workspace >/workflows, named Master Workflow)
SYNC_SERVICE_SID sync service sid for use as temporary storage (under /sync/services, named Shared State Service)
SYNC_SERVICE_API_KEY api resource to use above sync client (under /sync/tools, named Shared State Service)
SYNC_SERVICE_API_SECRET api secret of the above resource (no way to acces in Twilio console, ask this to the repo owner)
CHAT_SERVICE_SID programmable chat sid used for chat tasks (under /chat/services, named Flex Chat Service)
S3_BUCKET s3 bucket for ACCOUNT_SID ('docs-bucket' in localstack)
S3_ENDPOINT local transcripts only http://localhost:4566
ASELO_APP_ACCESS_KEY AWS_ACCESS_KEY_ID with access to s3 bucket (can be any string for localstack)
ASELO_APP_SECRET_KEY AWS_SECRET_ACCESS_KEY for ASELO_APP_ACCESS_KEY (can be any string for localstack
HELPLINE_CODE The short (usually 2 character) upper case code used to identify the helpline internally, e.g. ZA, IN, BR.
ENVIRONMENT_CODE The short upper case code used to identify the environment internally, e.g. STG, PROD, DEV

Deployment

To deploy (dev environment): npm run tr:deploy More about deploying

Testing protected apis

In order to test protected apis, we must provide a valid JWT token in the api's body call. The signature JWT must be obtained from within Twilio Flex (recommended: look into the state via redux plugin for chrome). To run locally: 1- npm start 2- Change your Flex plugin serverless endpoint or hit the route via CURL: curl -X GET '<twilio_serverless_api_endpoint_with_uri_params_if_any_and_valid_Token>' Explanation "twilio_serverless_api_endpoint": the function endpoint (e.g. http://localhost:3000/yourFunction?) "with_uri_params_if_any": append to the uri "param1=<value_1>&param2=<value_2>" "and_valid_Token": finally append to the uri "Token=<valid_token>"

tech-matters-serverless-helpers

This are helpers and functions reused across the various serverless functions. They are packed as npm package because it's the easiest way to reuse the code within a Twilio Serverless Toolkit Project and preserve the typing information TS provides.

It's currenty deployed with Gian's npm account, contact him to deploy new versions!

To deploy: once inside the project folder (cd tech-matters-serverless-helpers) 1- npm run build 2- npm publish (must be logged in npm cli)

About

Part of the Aselo backend, includes functions hosted on Twilio Functions

Resources

License

AGPL-3.0, Unknown licenses found

Licenses found

AGPL-3.0
LICENSE
Unknown
license-header.tpl

Stars

Watchers

Forks

Packages

No packages published

Languages