Swappa Alerts


New member
So I've been looking into buying used tech, specifically from Swappa, where users can upload to specific categories. Swappa has a built-in subscription feature which means that you don't have to webscrape in order to stay up to date to get the best deal, but because of many aspects (like only being able to be subscribed through email, getting massive volumes of notifications, and having to open up the link on the email every time in order to view the price), I set out to find a way to deliver these swappa subscription notifications straight to my android device through push notifications instead of having to tap 4-5 times every time a new listing shows up. I'll give a brief overview of how I did it below through the images:

1. Subscribe to Swappa's built-in alerts as shown
2. Filter and forward the emails that you receive on your personal email to the google cloud function trigger using a free email forwarding service called cloudmailin. Cloudmail-in basically sends the email as a JSON to the Google Cloud function.
3. Set up a Google Cloud Function (probably the most difficult and complex part, it took me a while to figure out and learn) to parse the listing ID from the email to form the listing's url. The Google Cloud Function will then send the parsed URL to our MacroDroid webhook as an HTTP Post. I've attached the index.js from my function below, the package.json/package-locked.json should auto-generate after you create the project and install axios.
4. Use the following MacroDroid macros to receive the webhook and parse the relevant information from the URL using some HTTP Requests (you can get more information than just the price using the basic developer inspection tool shown in my 7th SS). I just used some simple regex to parse the price of the listing and store it into a local variable (rn there's a little bug where the pricing is delayed 1 listing)
5. I basically just send myself a notification using those macros with the ability to open up the swappa listing page or url directly if the price of the device seems reasonable.

Hope you found this useful and happy hacking!


  • MacroDroid_24_07_09_19_34.mdr
    190.9 KB · Views: 0
  • 1. subscribe to swappa.png
    1. subscribe to swappa.png
    319.3 KB · Views: 5
  • 2. filter and forward email using cloudmailin.png
    2. filter and forward email using cloudmailin.png
    103.7 KB · Views: 5
  • 3. cloudmailin ex.png
    3. cloudmailin ex.png
    207.7 KB · Views: 5
  • 4. google cloud function implementation.png
    4. google cloud function implementation.png
    288.8 KB · Views: 6
  • 5. index.js ss.png
    5. index.js ss.png
    109.5 KB · Views: 6
  • 7. html parsing.png
    7. html parsing.png
    1.2 MB · Views: 6
  • 8. MacroDroid Functions.png
    8. MacroDroid Functions.png
    194.5 KB · Views: 5
  • 9. Main Swappa Alert Function.png
    9. Main Swappa Alert Function.png
    306.1 KB · Views: 5
  • 10. Swappa notification ex.png
    10. Swappa notification ex.png
    117.9 KB · Views: 5
Last edited: