npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wolt-cibus-loader

v1.2.4

Published

Simple automation tool to load extra Cibus credits to your Wolt account

Downloads

45

Readme

WoltCibusLoader

This project is here to help you and load your cibus extra credits to wolt.

After a few thousands shekels have been lost due to expiery of cibus credits, I decided to autotmate the process (which regardless, is cumbersome and painfull), and save my food money.

NOTE: Unfortunately, wolt login process is not fully automated, and requires user interaction (via telegram bot). This is due to the fact that wolt probably has a bot detection mechanism, which prevent emails to be sent from a non-human source. If you have any ideas on how to bypass and automate this process, please let me know.

Prerequisites

  • Node.js >= 18.x installed.

  • Wolt & Cibus accounts

  • Telegram

    • New bot API token (super easy tutorial)
    • Your telegram user chatId (just message this bot)
  • Google cloud project with the following:

    • Enabled Gmail API
    • OAuth conset screen
    • google-credentials.json file with app credentials in your project root folder
    • token.json file with user access token & refresh token (generated on first run)

    To acheive all of the above, please follow this quickstart guide just up untill "Install the client library"

Installation

npm

npm install wolt-cibus-loader --save

yarn

yarn add wolt-cibus-loader

Usage

First run

import { WoltCibusLoader } from "wolt-cibus-loader";

(async function () {
  try {
    const woltCibusLoader = new WoltCibusLoader({
      woltEmail: process.env.WOLT_EMAIL,
      cibusScraperOptions: {
        username: process.env.CIBUS_USERNAME,
        password: process.env.CIBUS_PASSWORD,
        company: process.env.CIBUS_COMPANY,
      },
      telegramBot: {
        token: process.env.TELEGRAM_BOT_TOKEN,
        userChatId: Number(process.env.TELEGRAM_USER_CHAT_ID),
      },
      allowCreditCardCharge: false,
      dryRun: true,
      shouldReedemCode: true,
    });
    const orderConfirmationNumber = await woltCibusLoader.loadRemainingCibusBalanceToWolt();
    console.log(
      `Successfully loaded remaining Cibus balance to Wolt. Order confirmation number: ${orderConfirmationNumber}`
    );
  } catch (e: any) {
    console.error(`Error loading remaining Cibus balance to Wolt: ${e.message}`);
  }
})();

In order to authorize the app to access your gmail account, and save the credentials for future use, the first run should be done manually.

make sure google-credentials.json is present in your root directory.

You will first be notified by the telegram bot to initiate email login in wolt. After the email is sent, you should click the "ack" button in the telegram message. (Do not open the email or click the link that is sent to you, the whole point is to automate this process).

After aknowledging, you will be prompted to login to your Gmail account, and allow the app to access your email. Once you have done that, the app will save the credentials and you will be able to run the app with minimal user interaction.

*You will notice a token.json file created in your root directory, this file contains the user access token and refresh token, and will be used for future runs, and user interaction will not be needed. You should keep this file safe and not share it with anyone.

IMPORTANT: Don't forget to add the token.json and google-credentials.json to your .gitignore file!

Subsequent runs

Just remove the dryRun option, and you are good to go.

Docker

Feel free to use the example main.ts & Dockerfile to create a docker image and use it as you please.

API

WoltCibusLoader

Constructor

new WoltCibusLoader(config: WoltCibusLoaderConfig)

WoltCibusLoaderConfig

| Name | Type | Default | Description | | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | woltEmail | string (required) | - | Wolt user email. | | cibusScraperOptions | CibusScraperOptions (optional) | undefined | Options for the cibus scraper in order to get current balance and login to the cibus website. | | balanceToLoad | number (optional) | undefined | Cibus balance to load to Wolt. If not provided, the balance will be fetched from the cibus website. | | allowCreditCardCharge | boolean (optional) | false | Whether to find a gift card with price higher than the balance, charging the remaining balance with a credit card.This is useful if you have a credit card assosiated to your cibus account, and you want to avoid remaining balance in Cibus. | | maxCreditCardCharge | number (optional) | 50 | The max amount to charge with the credit card.If no gift card is found in the given price range, the first lower price gift card will be used. | | shouldReedemCode | boolean (optional) | true | Whether the code should be retrieved from the gift card mail and redeemed automatically. | | getWoltLoginMagicLink | function (optional) | undefined | Function that returns the magic link from the login email received. This or telegramBot must be provided. | | telegramBot | { token : string, userChatId : number} | undefined | Telegram bot details. This or getWoltLoginMagicLink must be provided. | | puppeteerLaunchOptions | PuppeteerLaunchOptions | undefined | Puppeteer launch options to be passed to the puppeteer.launch function. | | dryRun | boolean | false | If true, the flow will be executed without actually submitting the order, it will only log the submitted details. |

Methods

loadRemainingCibusBalanceToWolt(): Promise<string>
  • Main method to load the remaining cibus balance to wolt.

License

The MIT License