A Matrix media proxy server that enables easy integration of Giphy and Tenor GIFs into Matrix clients. Based on maunium/stickerpicker, this proxy implements the Matrix media API to serve GIFs from Giphy and Tenor while maintaining compatibility with Matrix clients.
- Serves as a Matrix media server for Giphy and Tenor GIFs
- Implements Matrix federation API for seamless integration
- Built-in web interface for serving a GIF search and selection widget
- Supports MSC3860/MSC3916 media download redirects
- Docker support with Traefik integration
- Docker and Docker Compose
- Traefik (for reverse proxy and SSL)
- A domain name with DNS configured
- Giphy API key (get one at https://developers.giphy.com/)
- Tenor API key (get one at https://tenor.com/developer/dashboard)
- Clone this repository:
git clone https://github.com/yourusername/giphytenormatrixproxy.git
cd giphytenormatrixproxy
- Generate a server signing key:
docker build -t giphytenormatrixproxy giphytenormatrixproxy
docker run --rm giphytenormatrixproxy -generate-key
- Create your configuration file:
cp example-config.yaml config.yaml
- Edit
config.yaml
with your settings:
- Set your
server_name
(e.g.,giphy.example.com
) - Add your generated server key
- Insert your Giphy and Tenor API keys
- Configure other options as needed
- Configure environment variables:
cp .env.example .env
- Edit
.env
with your settings:
MATRIX_MEDIA_DOMAIN=mediaproxy.example.com
NETWORK_NAME=matrix
CONFIG_PATH=./config.yaml
Example docker-compose configuration using Traefik:
services:
giphytenormatrixproxy:
image: ${PROXY_IMAGE:-giphytenormatrixproxy}
container_name: ${CONTAINER_NAME:-giphytenormatrixproxy}
build:
context: ${BUILD_CONTEXT:-./matrix/build/giphytenormatrixproxy}
dockerfile: Dockerfile
environment:
TZ: ${TIMEZONE:-UTC}
networks:
- ${NETWORK_NAME:-matrix}
volumes:
- ${CONFIG_PATH:-./matrix/giphytenormatrixproxy/config.yaml}:/data/config.yaml
restart: on-failure
labels:
traefik.enable: true
traefik.http.routers.${CONTAINER_NAME:-giphytenormatrixproxy}.rule: Host(`${MATRIX_MEDIA_DOMAIN}`)
traefik.http.routers.${CONTAINER_NAME:-giphytenormatrixproxy}.entrypoints: websecure
traefik.http.routers.${CONTAINER_NAME:-giphytenormatrixproxy}.tls: true
traefik.http.routers.${CONTAINER_NAME:-giphytenormatrixproxy}.tls.certresolver: ${CERT_RESOLVER:-le}
traefik.http.routers.${CONTAINER_NAME:-giphytenormatrixproxy}.service: ${CONTAINER_NAME:-giphytenormatrixproxy}-service
traefik.http.services.${CONTAINER_NAME:-giphytenormatrixproxy}-service.loadbalancer.server.port: ${PROXY_PORT:-8008}
networks:
matrix:
name: ${NETWORK_NAME:-matrix}
- Start the service:
docker-compose up -d
- 715E Configure your Matrix client to use the proxy:
- Set up
.well-known
delegation for your domain, or - Directly proxy your domain to this service
- Access the web interface at
https://giphy.example.com
To integrate the GIF picker into your Element Matrix client:
- In Element, use the
/devtools
command - Select "Explore Account Data"
- Set the following data for the key
m.widgets
:
{
"stickerpicker": {
"content": {
"type": "m.stickerpicker",
"url": "https://your.domain.here/?theme=$theme",
"name": "Stickerpicker",
"creatorUserId": "@your-user-id:your.domain.here",
"data": {}
},
"sender": "@your-user-id:your.domain.here",
"state_key": "stickerpicker",
"type": "m.widget",
"id": "stickerpicker"
}
}
- Replace
your.domain.here
with your proxy's domain andyour-user-id
with your Matrix ID - After saving, you should now see a GIF button in your message composer
Note: You may need to refresh Element or reload the page for changes to take effect.
See example-config.yaml
for all available configuration options and their descriptions.
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). This is a derivative work based on maunium/stickerpicker, which is also licensed under AGPL-3.0.
For more information, see:
- LICENSE file in this repository
- maunium/stickerpicker original project
- GNU AGPL-3.0 License
Contributions are welcome! Please feel free to submit a Pull Request. Make sure to follow the AGPL-3.0 license requirements when contributing.