git clone https://github.com/asta-li/fax-machine.git
This project requires:
Run the following, selecting region us-west2
:
gcloud init
gcloud auth application-default login
Additonally, store the private key for service account telnyx@fax-machine-295219.iam.gserviceaccount.com
in the file gcs_credentials.json
.
See the Creating service account keys for how to create private keys.
These credentials are used for signing URLs.
Set up secure credentials in fax.env
for local development.
Store the same credentials in fax.yaml
for deployment.
Set up secure credentials in payment.env
for local development, use sandbox credentials here
Store the same credentials in payment.yaml
for deployment. use prod credentials here (if deploying to prod server)
Load into the local shell:
source ./variables.env
source ./variables.env && npm run build --prefix ./client && go run ./server
Build the static React frontend and launch the Go server.
From project root:
source ./variables.env
cd client
npm run build
cd ..
go run server/*
Run the client code in development mode.
From project root:
cd client
npm start
Deploy to the web via Google App Engine.
From project root:
cd client
npm run build
cd ..
gcloud app deploy
Golang formatter
gofmt -w server/*.go
Javascript formatter
cd client
prettier src/*.js --write
Javascript linter
eslint src/*.js
Query the fax status endpoint for the given Fax ID.
606bcbe5-a33b-4747-aa05-e691fa09710d
This webhook handles fax status updates from Telnyx:
See https://developers.telnyx.com/docs/api/v2/programmable-fax/Programmable-Fax-Commands
export TEST_RESPONSE='{ "data": { "event_type": "fax.queued", "id": "3691d047-d22a-424d-80ed-fe871981aa6d", "occurred_at": "2020-04-22T19:32:12.538002Z", "record_type": "event", "payload": { "connection_id": "7267xxxxxxxxxxxxxx", "fax_id": "b679398e-8b4c-46bd-8630-6797f1ab5228", "from": "+35319605860", "original_media_url": "http://www.telnyx.com/telnyx-fax/1.pdf", "status": "queued", "to": "+13129457420", "user_id": "a5b1dfa3-fd2e-4e02-8ea4-xxxxxxxxxxxx" } }, "meta": { "attempt": 1, "delivered_to": "http://example.com/webhooks" } }'
curl -X POST -H "Content-Type: application/json" -d "${TEST_RESPONSE}" http://localhost:3000/fax-complete