Gravatar Wrapper
Overview
Gravatar Wrapper
Gravatar is Automattic's globally recognized avatar service. Users create a profile once and it follows them across any Gravatar-enabled site, providing a consistent identity including avatar images, display names, job titles, verified accounts, and more.
The Gravatar Wrapper lets you look up public Gravatar profile data directly from Postgres by email address. Query avatar URLs, display names, locations, verified accounts, and contact info with plain SQL and join them against your application data. All queries require an email = condition and return no results without one. It is read-only and works with Supabase Vault for secure API key management. This wrapper is contributed and maintained by Automattic.
Preparation
Before you get started, make sure the wrappers extension is installed on your database:
_10create extension if not exists wrappers with schema extensions;
and then enable the Wasm foreign data wrapper:
_10create foreign data wrapper wasm_wrapper_10 handler wasm_fdw_handler_10 validator wasm_fdw_validator;
Secure your credentials (optional)
By default, Postgres stores FDW credentials inside pg_catalog.pg_foreign_server in plain text. Anyone with access to this table will be able to view these credentials. Wrappers is designed to work with Vault, which provides an additional level of security for storing credentials. We recommend using Vault to store your credentials.
_10select vault.create_secret(_10 '<Gravatar API key>',_10 'Gravatar',_10 'Gravatar API key for Wrappers'_10);
Connecting to Gravatar
We need to provide Postgres with the credentials to access Gravatar, and any additional options. We can do this using the create server command:
With Vault:
_10create server gravatar_server_10 foreign data wrapper wasm_wrapper_10 options (_10 fdw_package_url 'https://github.com/Automattic/gravatar-wasm-fdw/releases/download/v0.2.0/gravatar_fdw.wasm',_10 fdw_package_name 'automattic:gravatar-fdw',_10 fdw_package_version '0.2.0',_10 fdw_package_checksum '5273ae07e66bc2f1bb5a23d7b9e0342463971691e587bbd6f9466814a8bac11c',_10 api_url 'https://api.gravatar.com/v3', -- optional_10 api_key_id '<key_ID>' -- The Key ID from above._10 );
Without Vault:
_10create server gravatar_server_10 foreign data wrapper wasm_wrapper_10 options (_10 fdw_package_url 'https://github.com/Automattic/gravatar-wasm-fdw/releases/download/v0.2.0/gravatar_fdw.wasm',_10 fdw_package_name 'automattic:gravatar-fdw',_10 fdw_package_version '0.2.0',_10 fdw_package_checksum '5273ae07e66bc2f1bb5a23d7b9e0342463971691e587bbd6f9466814a8bac11c',_10 api_url 'https://api.gravatar.com/v3', -- optional_10 api_key '<Gravatar API key>'_10 );
Note: the fdw_package_* options are required and specify the Wasm package metadata. See the Available Versions table above for the full list.
Resources
Details
Third-party integrations and docs are managed by Supabase partners.