AlexaPi 

Part 2

Twilio is a developer platform for communications. Software teams use Twilio APIs to add capabilities like voice, video, and messaging to their applications. SendGrid has a Web API that allows customers to retrieve information about their account such as statistics, bounces, spam reports.

Setup Twilio API:

To start a project with Twilio SIGNUPS. After signing up click on TRIAL  "create a new project" . In order to send SMS for specific event you should have twilio phone number, to do so click on "All Products & Services"  then "Phone Number" click on "Buy a Number"" search"  it will list phone number. After selecting  a phone number click on "Console Dashboard " to list your project info. Make sure the code saved as mobile_services.py inside flask folder that you created it in part one. as following images. copy sid , token and your new phone number you will find it under Twilio Dashboard.You will be provided with all sources code in part 3. 


from twilio.rest import Client 

def sms():

    account_sid = 'YOUR_SID' 

    auth_token = 'YOUR_TOKEN' 

    client = Client(account_sid, auth_token) 

    message = client.messages.create( 

                                  from_='YOUR_New_Phone_number',  

                                  body='WARNING: The Temperature is 80°c (113°F)!',

                                  to='receiver_phone_number'

                                    )


Setup SendGrid API: 

To start a project with SendGrid SIGNUPS . After signing up  open Terminal or Command promote  inside flask folder type the following command  "mkdir  email" =>"cd  email" =>"npm init --yes"=>"npm install @sendgrid/mail" . Make sure the code saved as email.js inside email folder. You should have SendGrid API keys, to do so click on "setting"  "API keys" "create API key " select restricted access and then scroll down  check on "Mail send" to give it access. make sure to copy API keys and paste it on email.js file.  as following images. You will be provided with all sources code in part 3. 


const sgMail = require('@sendgrid/mail');

sgMail.setApiKey("YOUR_API_KEY");

const msg = {

  to: 'example@gmail.com',

  from: 'example@gmail.com',

  subject: 'Customer Support',

  text: 'Water Leak Issue is Solved!',

  html: '<strong>Whom It May Concern:<br><br><br>Water Leak Issue is Solved!</br></br></br> <br><br><br>Customer Support,</br></br></br> <br>(470)441-7927</br></strong>',

      };

sgMail.send(msg);