Giter Site home page Giter Site logo

anefzaoui / rocketchat-emoji-bulk-upload Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 0.0 19 KB

Rocket.Chat Emoji Bulk Upload: A Node.js script to easily import custom emojis from a YAML file into a Rocket.Chat instance using the Rocket.Chat API. Automate bulk imports and simplify managing your custom emojis.

JavaScript 100.00%
api automation bulk-upload chat collaboration custom-emoji nodejs rocket-chat rocketchat yaml

rocketchat-emoji-bulk-upload's Introduction

Rocket.Chat Custom Emoji Importer

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.

Features

  • 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 credentials

    You 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.

Requirements

  • Node.js
  • npm (usually comes with Node.js)
  • A Rocket.Chat instance with admin access

Dependencies

The following Node.js packages are used in this script:

  • request: To perform HTTP requests and interact with the Rocket.Chat API
  • js-yaml: To parse YAML files
  • readline: To read user inputs from the command line
  • dotenv: To load environment variables from a .env file

Installation

  1. Clone this repository:

    git clone https://github.com/anefzaoui/rocketchat-emoji-bulk-upload.git
    cd rocketchat-emoji-bulk-upload
  2. Install the required dependencies:

    npm install

Usage

  1. 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.

  2. Run the script:

    node import-custom-emojis.js

  3. 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.

Emoji Packs

Emoji packs from slackmojis.com

Contributing

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!

License

This project is licensed under the MIT License. See the LICENSE file for details.

Disclaimer

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.

rocketchat-emoji-bulk-upload's People

Contributors

anefzaoui avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rocketchat-emoji-bulk-upload's Issues

Error with API

Thanks for this awesome code! I'm on Rocket 6.4.5 am getting the following error. Any ideas?
image

Slack emoji enhancement

Hello,

Very good work :)!

However, for personal needs I wanted to modify part of your code to make it work with the Slack URL (emoji side).

To make your program work with Slack emojis, here is the modification you need to make:

                for (const emoji of emojis) {
                  const url = emoji.src;
                  const name = url.split("/").slice(-2, -1)[0]; // Récupérer le nom depuis l'URL Slack
                  const ext = url.split(".").pop();

If ever, here's what a Slack emoji URL looks like: https://emoji.slack-edge.com/T0XJVJY85/download/f0e45810e2117a78.png

It's interesting to add this feature, surely other people will want to move their emojis from one messaging system to another :D

image

See you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.