Jump to content

Workflow: Amazon Affiliate Link Generator

Recommended Posts

Alfred 2 Amazon Affiliate Links Workflow


Quick Start: Download Here

An Alfred workflow for generating simple Amazon Affiliate links with your own tag.  Designed for anyone who generates a lot of custom links from URLs.  This workflow will clean up all the parameters from an amazon.com URL, and then append the configured tag to it.



Setting Your Affiliate Code


The keyword trigger alink code <your-affiliate-tag> will set a new affiliate code, which all subsequent calls to alink will use.






Generating Links


The keyword trigger alink <an-amazon-product-url> will strip extra junk from the URL (all the query params, which aren't necessary for Amazon product links), and append "tag=your-affiliate-tag" to it, copying the result to the clipboard.



You will get an error message if you haven't set an affiliate code yet (see above), or if the target link is not a valid Amazon link.


Install Notes

Download the compiled workflow directly, or visit the repository for the full source code


I'm happy to take feedback on the installation process.  In theory, I've bundled all the necessary ruby gems in the workflow package proper, so it should be a simple double-click install.  If you do need to install manually, please let me know.  To install manual dependencies, you would run just "sudo gem install addressable", and that should suffice.


This has been tested on OS X 10.13 High Sierra and above, and may work on earlier versions of macOS.  It requires Alfred 3+



Thanks to Bryan McKelvey for the simple Alfredo Ruby Gem (no longer used directly, but code inspired by)

Thanks to phyllisstein for Alleyoop


Release Notes

  • v1.0 (Feb 24, 2014) - Initial release
  • v1.1 (Mar 24, 2018) - Alfred 3 and High Sierra 10.13 support
  •  v1.2 (Oct 27, 2019) - Update for Alfred preferred JSON format, support for macOS 10.15 Catalina


Feedback Wanted: I'd love to hear feedback.  Are you using this workflow?  How?  What improvements would you like?

Edited by wkoffel
Link to comment
  • 1 year later...
On 10/15/2019 at 4:28 PM, MacWorks said:



Provide us a way to throw you a couple of bucks for your efforts. Would love a bit.ly add-on for my custom bit.ly address, as well.



Thanks @MacWorks, please see my latest post, I've updated the workflow, should be fully supported on OS 10.15 now.  No need for bucks, but happy to take some love on Twitter @wkoffel or wherever else.  I never bother to remind others of my workflows outside these forums, but probably should!

Link to comment
  • 2 years later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...