|
| 1 | +tools: send_email, sys.http.html2text, sys.write, sys.exec? |
| 2 | + |
| 3 | +Visit https://phoenix.craigslist.org/search/cta?postedToday=1&query=4runner&sort=date to get information about the |
| 4 | +4Runners listed today. |
| 5 | + |
| 6 | +Check the PostgreSQL database and see if any of these vehicles have already been stored. If they have been, ignore them. |
| 7 | +The `psql` command is available. The database connection string is in the environment variable PGURL. The table is |
| 8 | +called "vehicles". If the table doesn't exist yet, create it. The only thing that needs to be stored in the table |
| 9 | +is the URL for each vehicle. Don't add any other fields. |
| 10 | + |
| 11 | +For each vehicle that was not already in the database, store the information about it into the database, and send |
| 12 | +an email with information about those vehicles. If there are no new vehicles, then don't send an email. |
| 13 | + |
| 14 | +--- |
| 15 | +name: send_email |
| 16 | +description: sends an email with the provided contents |
| 17 | +args: contents: the contents of the email to send |
| 18 | +tools: sys.http.html2text, sys.exec? |
| 19 | + |
| 20 | +IMPORTANT: when setting --header or -H on a cURL command, always use double quotes, never single quotes! |
| 21 | +IMPORTANT: when setting --data or -d on a cURL command, always use single quotes, never double quotes! And always escape newlines! (They should look like "\\n") |
| 22 | + |
| 23 | +The SendGrid API key is in the environment variable SENDGRID_API_KEY. |
| 24 | + |
| 25 | +Perform the following actions in this order: |
| 26 | +1. View the contents of https://docs.sendgrid.com/for-developers/sending-email/api-getting-started to learn about the SendGrid API. |
| 27 | +2. Run a cURL command to send an email using the SendGrid API, with the following information: |
| 28 | + to: <email address> (name: <name>) |
| 29 | + from: <email address> (name: <name>) |
| 30 | + reply to: <email address> (name: <name>) |
| 31 | + subject: "4Runner Listings" |
| 32 | + content: $contents |
0 commit comments