Generating Gravatar Image Request URLs

Gravatar is a service that allows users to centrally manage their avatar across several websites. Slate makes use of Gravatar in several places, such as the "Dashboard" tab on a person record. It's possible to retrieve a user's Gravatar (e.g., to display in a portal, to merge into a mailing) by passing in a hash of their email address into an image request, which Gravatar outlines here

Generating the Email Hash

  1. Add a subquery export.
  2. Specify a name, like "email-hash".
  3. Set the output setting to "Formula".
  4. Add an export for the email address.
  5. Use the following formula, replacing "@Email" with the export's name you added in the above step:
    lower(convert(varchar(32), hashbytes('MD5', lower(@Email)), 2))
  6. Click save.

Performing the Image Request

We can now use the hashed email address above to perform the image request.

  1. Add an image.
  2. Set the URL setting to the following URL, replacing "{{email-hash}}" with the name you used in your subquery export:{{email-hash}}
  3. If you want to instruct Gravatar to return something if a Gravatar is not found for the hashed email address, you can modify the URL using the d parameter. The below example returns "mystery-person", or gray avatar:{{email-hash}}?d=mp
  4. If you want to control the size of the Gravatar, you can modify the URL using the s parameter. The proceeding example builds on the last and sizes the Gravatar to 45px by 45px:{{email-hash}}?d=mp&s=45
  5. Click save.
Was this article helpful?
0 out of 1 found this helpful