Notifying the vendor and AP team about the payment completion

At the time of writing, GCP uses SendGrid to send emails. SendGrid is a trusted email delivery system that is used across the globe to send transnational and marketing emails. It is a very powerful cloud-based solution that takes out all the complexity of maintaining an email infrastructure. In this section, we will learn how to send emails using SendGrid. It comes with a free subscription of 12,000 emails.

The following are the steps to enable the SendGrid API:

  1. Search for Cloud Messaging from the home page.
  2. Enable the SendGrid API.

Now let's see how to configure and send emails from SendGrid.

The following is the sample Python code that can be used to send emails from SendGrid. The code is very simple and self-explanatory. You just have to make sure that you are using the right API key:

# using SendGrid's Python Library - https://github.com/sendgrid/sendgrid-python
import sendgrid

sg = sendgrid.SendGridClient("YOUR_SENDGRID_API_KEY")
message = sendgrid.Mail()

message.add_to("[email protected]")
message.set_from("[email protected]")
message.set_subject("Sending with SendGrid is Fun")
message.set_html("and easy to do anywhere, even with Python")
sg.send(message)

The preceding code is used to configure the SendGrid client, recipient, sender, subject, and the message in the email body.

Now you have an understanding of how to process an invoice in an automated fashion. Next, we will have a quick look at how to create a conversational interface for AIP.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.103.183