A Carousell.sg automation bot written in Golang
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Jaryl Chng 12e8ff7cf6
fix toForward
2 weeks ago
.gitlab update templates and readme 2 2 months ago
carousell fix toForward 2 weeks ago
chrono initial alpha release 2 months ago
constants more reminder details when scheduling deals 2 months ago
data capture SIGTERM for Docker stops 2 months ago
messaging queue system for SendMessage 2 months ago
models bug fixes 2 weeks ago
readme update readme 2 months ago
utils stricter offer detection regex and tests 2 months ago
.dockerignore update build process 2 months ago
.gitignore update build process 2 months ago
.gitlab-ci.yml added security & compliance checks 2 months ago
Dockerfile update build process 2 months ago
LICENSE fix LICENSE 2 months ago
README.md update README 1 month ago
carousell-gobot.iml initial alpha release 2 months ago
carousell-gobot.png initial alpha release 2 months ago
ci-build.sh make ci-build.sh more universal 1 month ago
ci-deploy.sh improve cicd 2 months ago
ci-prepare.sh improve cicd 2 months ago
config.sample.yaml update README 1 month ago
entrypoint.sh initial alpha release 2 months ago
go.mod update dependencies 1 month ago
go.sum update dependencies 1 month ago
main.go merge Carousell SendMessage with forwarders 2 months ago

README.md

Carousell Gobot Logo

Carousell GoBot

A Carousell.sg automation bot written in Golang

WARNING: NIGHTLY RELEASES ONLY. Expect bugs and possibly breaking changes every update.

Docker Hub Image »

Explore the docs »

Report Bugs · Request Features

About The Project

Demo

Initial auto-reply

Initial auto-reply

Low-balling detection

Low-balling detection

Lower official offer detection

Lower official offer detection

Forwarding to other chat services

Forwarding to other chat services

Reminders & Commands

Reminders & Commands Reminders

Built With

Getting Started

To get a local copy up and running follow these simple steps.

1. Prepare configuration file

  1. Click here to download the latest sample config
  2. Rename config.sample.yaml to config.yaml
  3. Edit config.yaml with your configurations (breakdown below)

2a. Docker Run

docker run -it -d \
  --name carousell-gobot \
  -e TZ=Asia/Singapore \
  -v /path/to/config/folder:/data \
  jarylc/carousell-gobot

2b. Docker-compose

carousell-gobot:
    image: jarylc/carousell-gobot
    environment:
      - TZ=Asia/Singapore
    volumes:
      - /path/to/config/folder:/data

Binaries

  1. Visit here to view and download the latest build artifacts / Alternatively, build it yourself with instructions below
  2. Click here to download the latest sample config
  3. Rename config.sample.yaml to config.yaml
  4. Edit config.yaml with your configurations (breakdown below)
  5. Run the binary

Note: you can also specify path to config using -c /path/to/config.yaml and path to state using -s /path/to/state.json

Development

Building native binary

$ cd /path/to/project/folder
$ go build -ldflags="-w -s"

Building for 64-bit Windows

$ cd /path/to/project/folder
$ GOOS=windows GOARCH=amd64 go build -ldflags="-w -s"

Docker build

$ cd /path/to/project/folder
$ docker build .

Usage

Firefox

  1. Go to https://www.carousell.sg/
  2. Press CTRL+SHIFT+E / ⌘+⌥+E
  3. Refresh the page
  4. Firefox Final Step

Chrome

  1. Go to https://www.carousell.sg/
  2. Press CTRL+SHIFT+C / ⌘+⌥+C
  3. Click on Network tab
  4. Refresh the page
  5. Chrome Final Step

Configuration

Sample

https://gitlab.com/jarylc/carousell-gobot/-/blob/master/config.sample.yaml

Breakdown

  • carousell - Carousell related configurations
    • cookie - entire value inside Cookie header from above
    • ping_interval - interval to ping Carousell to check connectivity
    • low_ball - percentage of price to be considered low-ball in decimal notation
  • message_templates - message templates
    • faq - frequently answered questions (optional, leave empty if not required)
    • initial - new chat initial greeting (placeholders available)
      • {{NAME}} - name of sender
      • {{ITEM}} - name of item
    • not_available - chat message on a listing that is sold, reserved or deleted (placeholders available)
      • {{REASON}} - reason why listing is not available anymore
    • offered - official offer using Carousell's offer button (placeholders available)
      • {{OFFER}} - offer value
    • possible_offer - offer value detected from previously sent message (placeholders available)
      • {{OFFER}} - offer value
    • lower_offer - official offer value was decreased from possible offer, buyer being cheeky?
    • low_balled - low-balled (placeholders available)
      • {{PERCENT}} - low-ball percent configured in configuration in percent notation
    • contact - contact details reply for contact command
    • reminder - reminder (placeholders available)
      • `{{HOURS}}' - hours remaining till scheduled time
  • reminders - list of hours to set reminders for on every deal (optional, leave empty if none)
  • command_prefix - prefix to use for the app to detect as a command
  • state_prune - number of days to keep items in state after last activity
  • forwarders - list of forwarders (optional, [] if none)
    • for telegram (guide: https://core.telegram.org/bots):
      • - type: telegram
          token: '1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcde1234' # bot token
          chat_id: 87654321 # chat id
          message_templates:
          standard: |- # standard message
            *Carousell Chat/Offer*
            [{{NAME}} - {{ITEM}}](https://www.carousell.sg/inbox/{{ID}})
            ${{OFFER}}
            {{FLAGS}}
          reminder: |- # reminder message
            *Carousell Deal Reminder*
            [{{ITEM}}](https://www.carousell.sg/inbox/{{ID}})
            Deal ${{OFFER}} in {{HOURS}} hour(s)!
        
    • for discord (webhook only, guide: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks):
      • - type: discord
          webhook_url: 'https://discord.com/api/webhooks/012345678910111213/lrennsXdocFAKEdOWAkpWEBHOOKMrMMcXa_FcmCURLUMNU_STsnbKVTRirmvLccmvkpA' # webhook url
          message_templates:
          standard: |- # standard message
            **Carousell Chat/Offer**
            [{{NAME}} - {{ITEM}}](https://www.carousell.sg/inbox/{{ID}})
            ${{OFFER}}
            {{FLAGS}}
          reminder: |- # reminder message
            **Carousell Reminder**
            [{{ITEM}}](https://www.carousell.sg/inbox/{{ID}})
            Deal ${{OFFER}} in {{HOURS}} hour(s)!
        
    • for slack (webhook only, guide: https://api.slack.com/messaging/webhooks):
      • - type: slack
          webhook_url: 'https://hooks.slack.com/services/T1234GN5678/B1FAKEZNRCM/fPoWEBHOOK2Yyn3oURLOjW4J' # webhook url
          message_templates:
          standard: |- # standard message
            *Carousell Chat/Offer*
            <https://www.carousell.sg/inbox/{{ID}}|{{NAME}} - {{ITEM}}>
            ${{OFFER}}
            {{FLAGS}}
          reminder: |- # reminder message
            *Carousell Reminder*
            <https://www.carousell.sg/inbox/{{ID}}|{{ITEM}}>
            Deal ${{OFFER}} in {{HOURS}} hour(s)!
        

Commands (prefixed with command_prefix configuration)

Currently, only your account can send these commands:

  • sched/schedule/remind/reminder/deal - schedule a deal and set reminders based on reminders configuration
    • arguments: date/day and time (optional)
    • if no arguments, it will read the most recent reply and response
    • uses natural date processing. ELI5: something like a simple AI to detect dates in sentences.
  • cancel/del/delete - cancel deal & reminders
  • faq - resend the FAQ
  • contact - send contact details
  • stop - immediately stop the bot

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Feel free to fork the repository and submit pull requests.

License

Distributed under the GNU GENERAL PUBLIC LICENSE V3. See LICENSE for more information.

Contact

Jaryl Chng - git@jarylchng.com

https://jarylchng.com

Project Link: https://gitlab.com/jarylc/carousell-gobot/