Schedule a reminder message to be sent a specified time after the initial message
This project requires some environment variables to be set. A file named .env is used to store the values for those environment variables. To keep your tokens and secrets secure, make sure to not commit the .env file in git. When setting up the project with twilio serverless:init ... the Twilio CLI will create a .gitignore file that excludes .env from the version history.
In your .env file, set the following values:
| Variable | Description | Required |
|---|---|---|
MESSAGING_SERVICE_SID |
The SID of a valid Messaging Service that is used to send out the scheduled message | Yes |
DELAY_IN_MINUTES |
Configurable time to delay the delivery of the reminder message. Defaults to the minimum of 15 minutes | No |
/respond is protected and requires a valid Twilio signature as well as the following parameters:
| Parameter | Description | Required |
|---|---|---|
From |
The phone number the incoming message was sent from. Gets automatically passed by Twilio | Yes |
- Install the Twilio CLI
- Install the serverless toolkit
twilio plugins:install @twilio-labs/plugin-serverless- Initiate a new project
twilio serverless:init example --template=reminder-message && cd example
- Start the server with the Twilio CLI:
twilio serverless:start
- Open the web page at https://localhost:3000/index.html and enter your phone number to test
ℹ️ Check the developer console and terminal for any errors, make sure you've set your environment variables.
Deploy your functions and assets with either of the following commands. Note: you must run these commands from inside your project folder. More details in the docs.
With the Twilio CLI:
twilio serverless:deploy