Skip to content

Email to Fax Sample Application Using SendGrid and Twilio

License

Notifications You must be signed in to change notification settings

dccl90/email_to_fax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email to Fax Sample APP

Sample app provides details on how you can utilize the SendGrid Parse Webhook, to receive the content of an email, store the attachment in an S3 bucket and send it as a fax using Twilio.

Requirements

Setting Up

We assume that before you begin, you will have Python and pip installed on your system and available at the command line.

Before you can run this project, you will need to set four system environment variables. These are:

TWILIO_ACCOUNT_SID : Get it from your Twilio Console.
TWILIO_AUTH_TOKEN : Same as above.
TWILIO_NUMBER : A Twilio number that you own, that can be used for making calls and sending messages. You can find a list of phone numbers you control (and buy another one, if necessary) in the console.
S3_FAX_BUCKET : AWS S3 Bucket where the files will be stored

For Mac and Linux, environment variables can be set by opening a terminal window and typing the following three commands - replace all the characters after the = with values from your Twilio account:

export TWILIO_ACCOUNT_SID=ACXXXXXXXXX
export TWILIO_AUTH_TOKEN=XXXXXXXXX
export TWILIO_PHONE_NUMBER=+1XXXXXXXXX
export S3_FAX_BUCKET=BUCKET_NAME

On Windows, the easiest way to set permanent environment variables (as of Windows 8) is using the setx command. Note that there is no =, just the key and value separated by a space:

setx TWILIO_ACCOUNT_SID ACXXXXXXXXX
setx TWILIO_AUTH_TOKEN XXXXXXXXX
setx TWILIO_PHONE_NUMBER +1XXXXXXXXXX
setx S3_FAX_BUCKET=BUCKET_NAME

Running the Application

Clone this repository. Navigate to the folder with the source code on your machine in a terminal window. From there we recommend creating a virtualenv and activating it to avoid installing dependencies globaly on your computer.

virtualenv -p python3 env source env/bin/activate
Install dependencies:
pip install -r requirements.txt
Run the web app: 
python emailApp.py

Testing

Once the application is up and running, and you have set up the inbound parse webhook you can test the application by sending an email to your name where the user portion of the email address is the fax phone number. For example [email protected]

About

Email to Fax Sample Application Using SendGrid and Twilio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages