Back to Gatsby

README

examples/functions-twilio-text/README.md

2.20.02.5 KB
Original Source
<p align="center"> <a href="https://www.gatsbyjs.com/?utm_source=starter&utm_medium=readme&utm_campaign=gatsby-functions-beta"> </a> </p> <h1 align="center"> Gatsby Functions Twilio Example </h1>

🚀 Quick start

  1. 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:

    You'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.

  2. 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

    shell
    cd examples/functions-twilio-text
    npm install
    npm run develop
    
  3. 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!

  4. Deploy

You can deploy this example on Gatsby Cloud by copying the example into a new repo and connecting that to Gatsby Cloud.