This repository contains a Node.js script to import custom emojis from a YAML file into a Rocket.Chat instance. The script uses the Rocket.Chat API, making it easy to bulk import custom emojis without directly accessing the database. It also supports using a .env
file to store the Rocket.Chat server URL, admin username, and password.
-
Import custom emojis from a remote YAML file
The script allows you to easily import custom emojis from a remote YAML file by providing the file's URL. The YAML file should contain the emoji names and image sources in a well-structured format.
-
Uses the Rocket.Chat API for easy and secure integration
This script interacts with your Rocket.Chat server using the official API, ensuring a secure and straightforward integration process. You will need to provide your admin username and password to authenticate with the API.
-
Command-line interface for user input
The script uses a simple command-line interface to gather required information, such as the YAML file URL, Rocket.Chat server URL, and admin credentials, making it easy to run and configure.
-
Automatic download and upload of custom emoji images
The script takes care of downloading the custom emoji images from the URLs specified in the YAML file and uploading them to your Rocket.Chat server. This automated process simplifies the bulk import of custom emojis.
-
Bulk import support
This script is designed to handle multiple custom emojis at once, allowing you to import a large number of emojis in a single run, saving you time and effort.
-
Support for
.env
file to store server URL and admin credentialsYou can create a
.env
file in the project folder to store your Rocket.Chat server URL, admin username, and password. This helps to keep your credentials secure and simplifies running the script, as you won't need to input these values manually each time. -
Skipping Existing Emojis
This script has been updated to check for existing custom emojis on your Rocket.Chat server before uploading new ones. If an emoji from the YAML file is already present on the server, the script will skip uploading that emoji and print a message to inform you that it has been skipped. This helps to prevent duplicate emojis from being uploaded if you run the script multiple times using the same YAML file.
- Node.js
- npm (usually comes with Node.js)
- A Rocket.Chat instance with admin access
The following Node.js packages are used in this script:
request
: To perform HTTP requests and interact with the Rocket.Chat APIjs-yaml
: To parse YAML filesreadline
: To read user inputs from the command linedotenv
: To load environment variables from a.env
file
-
Clone this repository:
git clone https://github.com/anefzaoui/rocketchat-emoji-bulk-upload.git cd rocketchat-emoji-bulk-upload
-
Install the required dependencies:
npm install
-
Optionally, create a
.env
file in the project directory with the following content:ROCKETCHAT_SERVER_URL=https://your-rocketchat-server-url ADMIN_USERNAME=your-admin-username ADMIN_PASSWORD=your-admin-password
Replace the placeholder values with your actual Rocket.Chat server URL, admin username, and password. The script will use these values if they are set in the
.env
file, otherwise, it will prompt the user to input them.Note: There is a
.env.example
file included in this repository that you can use as a template. Simply rename it to.env
and fill in your information. -
Run the script:
node import-custom-emojis.js
-
If you haven't provided the necessary information in the
.env
file, follow the prompts and provide the required information:- URL for the YAML file containing the custom emojis
- Rocket.Chat server URL
- Rocket.Chat admin username
- Rocket.Chat admin password
The script will then fetch the YAML file, parse it, and start downloading and uploading the custom emojis to your Rocket.Chat instance. The process may take some time, depending on the number of custom emojis and their file sizes. After all emojis are uploaded, the script will display a success message.
- animals
- clippy
- fika
- frontend
- harrypotter
- mario
- occupy
- officespace
- omnom
- futurama
- food
- skype
- starwars
- startups
- businessfish
- hipchat
- twitch
- parrotparty (Parrot Paint)
- Finland
- pokemongo: items
- Pokémon Go: Pokémon (Prefixed
pokemon-*
) - politipack
- nekoatsume
- octicons
- pokemon
- devicon (Devicon)
- hamsterdance (snipe/emojipacks)
- avengers
- Shiba Stickers (from Messenger)
- gamedevmoji
- AWS simple icons
Emoji packs from slackmojis.com
- Uncategorized
- Facebook Reaction
- Logo
- Meme
- MLB
- NBA
- NFL
- NHL
- NYC Subway
- Party Parrot
- Pokemon
- Retro Game
- Scrabble Letters
- Skype
- Star Wars
- Turntable.fm
- Yoyo
If you'd like to contribute to this project, feel free to submit a pull request or open an issue. Your feedback and suggestions are always welcome!
This project is licensed under the MIT License. See the LICENSE
file for details.
This script is provided as-is, with no guarantees or warranties. Use it at your own risk. Always make a backup of your data before making any changes to your Rocket.Chat instance.