This Function will forward incoming SMS messages to an email address using the SparkPost API.
You will need a SparkPost account and an API key to use this Function.
If you are testing out with SparkPost you can use their sandbox domain to send test emails. To do so you should set your FROM_EMAIL_ADDRESS
to "anything@sparkpostbox.com" and set options.sandbox
to true
.
This code example includes the sandbox
option. Ensure you set it to false
or remove it when you change to use your own domain.
This Function expects three environment variables to be set.
Variable | Meaning |
---|---|
SPARKPOST_API_KEY |
Your SparkPost API key |
TO_EMAIL_ADDRESS |
The email address to forward the message to |
FROM_EMAIL_ADDRESS |
The email address that SparkPost should send the email from |
This Function depends on one npm module. You should add the following dependencies in your Functions configuration page.
Dependency | Version |
---|---|
got |
^6.7.1 |