A Carousell.sg automation bot written in Golang
WARNING: NIGHTLY RELEASES ONLY. Expect bugs and possibly breaking changes every update.
Report Bugs · Request Features
- golang
- gorrilla/websocket
- dlclark/regexp2
- dop251/goja
- jarylc/go-chromedpproxy
- Davincible/chromedp-undetected
To get a local copy up and running follow these simple steps.
- Click here to download the latest sample config
- Rename
config.sample.yaml
toconfig.yaml
- Edit
config.yaml
with your configurations (breakdown below)
docker run -it -d \
--name carousell-gobot \
-e TZ=Asia/Singapore \
-e INSTALL_CHROME=1 `# OPTIONAL: install Chromium before start for username & password login support` \
-p 9221:9221 `# OPTIONAL: configured forward port for front-end portal (for 2FA & Captcha entries)` \
-v /path/to/config/folder:/data \
jarylc/carousell-gobot
carousell-gobot:
image: jarylc/carousell-gobot
environment:
- TZ=Asia/Singapore
- INSTALL_CHROME=1 # OPTIONAL: install Chromium before start for username & password login support
ports:
- "9221:9221" # OPTIONAL: configured forward port for front-end portal (for 2FA & Captcha entries)
volumes:
- /path/to/config/folder:/data
- Visit here to view and download the latest build artifacts / Alternatively, build it yourself with instructions below
- Click here to download the latest sample config
- Rename
config.sample.yaml
toconfig.yaml
- Edit
config.yaml
with your configurations (breakdown below) - 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
$ cd /path/to/project/folder
$ go build -ldflags="-w -s"
$ cd /path/to/project/folder
$ GOOS=windows GOARCH=amd64 go build -ldflags="-w -s"
$ cd /path/to/project/folder
$ docker build .
- Go to https://www.carousell.sg/ds/api/1.0/chat/token/?_path=/1.0/chat/token/
- Press
CTRL+SHIFT+E
/⌘+⌥+E
- Refresh the page
- Copy the value of
token
for token as well
- Go to https://www.carousell.sg/ds/api/1.0/chat/token/?_path=/1.0/chat/token/
- Press
CTRL+SHIFT+C
/⌘+⌥+C
- Click on
Network
tab - Refresh the page
- Copy the value of
token
for token as well
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 & remindersfaq
- resend the FAQcontact
- send contact detailsstop
- immediately stop the bot
https://gitlab.com/jarylc/carousell-gobot/-/blob/master/config.sample.yaml
application
- application related configurationsbase_url
- base URL of front-end portal (to be sent to forwarders on 2FA or Captcha requests)portal_listener
- listen address for front-endchrome_listener
- listen address for Chrome remote debugger
carousell
- Carousell related configurationscookie
- either this andtoken
orusername
andpassword
or both are required, entire value inside Cookie header from abovetoken
- either this andcookie
orusername
andpassword
or both are required, retrieved from https://www.carousell.sg/ds/api/1.0/chat/token/?_path=/1.0/chat/token/ after logging inusername
- either this orcookie
andtoken
or both are required, specify username for automatic session renewal (if Docker, make sure to run with envINSTALL_CHROME=1
)password
- either this orcookie
andtoken
or both are required, specify password for automatic session renewal (if Docker, make sure to run with envINSTALL_CHROME=1
)ping_interval
- interval to ping Carousell to check connectivitylow_ball
- percentage of price to be considered low-ball in decimal notation
message_templates
- message templatesfaq
- 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 commandreminder
- 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 commandstate_prune
- number of days to keep items in state after last activityforwarders
- 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)!
-
- for
See the open issues for a list of proposed features (and known issues).
Feel free to fork the repository and submit pull requests.
Distributed under the GNU GENERAL PUBLIC LICENSE V3. See LICENSE
for more information.
Jaryl Chng - git@jarylchng.com
Project Link: https://gitlab.com/jarylc/carousell-gobot/