-
Install Go
-
Initialize a Go project in a new directory:
go mod init
-
Install the Temporal Go SDK
-
Download the Temporal CLI
-
Start a local Temporal service in a new terminal window:
temporal server start-dev
-
Sign up for Twilio SMS
-
Create
.env
file inserver
directory and set Twilio phone number:TWILIO_PHONE_NUMBER="+1XXXXXXXXXX"
-
Create
.env
file inworker
directory and set Twilio auth tokens:TWILIO_ACCOUNT_SID="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
TWILIO_AUTH_TOKEN="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-
Sign up for access to Metro real-time API through Swiftly, using the agency key
la-metro-rail
. -
In the
.env
file inworker
directory, set the API key:SWIFTLY_API_KEY="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-
Clone the repository:
git clone https://github.com/Chloe2330/sms-los-angeles.git
-
Start the server:
cd server
go run main.go
-
Start the worker:
cd worker
go run main.go
cd sms-los-angeles
/subscribe
to daily messages, start workflow execution
curl -X POST \
http://localhost:4000/subscribe \
-H 'Content-Type: application/json' \
-d '{
"phonenumber": "+1XXXXXXXXXX"
}'
/unsubscribe
from daily messages, cancel workflow execution
curl -X DELETE 'http://localhost:4000/unsubscribe?phonenumber=1XXXXXXXXXX'
/details
to query information about an existing workflow
curl 'http://localhost:4000/details?phonenumber=1XXXXXXXXXX'