examples/functions-twilio-text/README.md
Get Twilio Credentials.
Create an account on Twilio. We'll use WhatsApp for this demo as Twilio has a free test sandbox for WhatsApp (where with SMS you must first purchase a phone number). Head to the WhatsApp getting started page to enable your account to use the sandbox.
There are 3 environment variable you'll need to add your project to properly run the starter:
TWILIO_ACCOUNT_SID: Get your Twilio Account SID in the Twilio Console DashboardTWILIO_AUTH_TOKEN: Get your Twilio Auth Token in the Twilio Console DashboardTWILIO_NUMBER: Use the Twilio WhatsApp sandbox number whatsapp:+14155238886You'll want to add these as environment variables when deploying to Gatsby Cloud. Don't forget to add them to the Preview variables if you plan to add a CMS preview integration.
Start developing.
To get started, run npm install to add all necessary packages.
When developing locally, you'll want to include the ENV variables in your .env.development. Read more about how Gatsby handles .env files and environment variables in the Gatsby Docs
cd examples/functions-twilio-text
npm install
npm run develop
Open the code and start customizing!
Your site is now running at http://localhost:8000! You can use the UI on the index page to test the functions or directly access them at http://localhost:8000/api/twilio
When sending messages to WhatsApp numbers, the format you use is whatsapp: + the number e.g. whatsapp:+14004004000
Edit src/pages/index.js to see your site update in real-time!
Deploy
You can deploy this example on Gatsby Cloud by copying the example into a new repo and connecting that to Gatsby Cloud.