Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@amazebot/rocket-bot
Advanced tools
Consume Rocket.Chat message streams and automate method calls.
Consume Rocket.Chat message streams and automate method calls.
Full use-case examples are on the todo list. See below for method usage.
See the main rocket-control
README for general configuration.
Specific configs for this module are as follows (none are required):
Env var | Description |
---|---|
RC_INTEGRATION_ID | Applies message.bot.i to identify sent messages |
RC_JOIN | CSV of room names or IDs to join on login |
RC_STREAM_NAME | Stream name to subscribe to for messages |
RC_STREAM_ROOM | Room or collection for subscription parameters |
RC_IGNORE_DIRECT | Filter direct messages out of aggregated stream |
RC_IGNORE_LIVECHAT | Filter livechat messages out of aggregated stream |
RC_IGNORE_EDITED | Filter edited messages out of aggregated stream |
Provides a high level interface for connection, login and subscribing to message streams in Rocket.Chat. The default driver instance can be required for general usage, to subscribe and respond to the aggregated message stream for a bot user.
const { driver } = require('@amazebot/rocket-bot')
Or use the Driver
class to create multiple driver instances if you need to
connect to different sources, streams or isolate cached method results.
new Driver()
Create a driver instance. It exposes the lower level socket
and api
dependencies as properties to allow more advanced usage.
const { Driver } = require('@amazebot/rocket-bot')
const driver = new Driver()
.login(credentials)
Proxy for Socket login method
By default uses credentials in RC_USERNAME
and RC_PASSWORD
env vars or
package.json: { "rcConfig": { "username": "bot", "password": "pass" } }
driver.login().then(() => console.log('🚀🤖 Logged in!'))
Credentials can also be given at run-time.
driver.login({ username: 'me', password: 'pass' }).then(() => console.log('👍'))
.onMessage(callback, options)
Call a callback on every event in the user's aggregated message stream. The callback arguments use error-first pattern, followed by the message and meta object.
driver.onMessage((err, message, meta) => {
if (!err) console.log({ message, meta })
})
A second argument can be given to override config for ignored messages. e.g.
const callback = (err, message, meta) => console.log(err || message)
driver.onMessage(callback, {
edited: true,
livechat: false,
direct: false
}) // 👆 ignores livechat and DMs, fires on edited (regardless of config)
WARNING: The meta field in streams is unstable, may be deprecated in future. See Issue #12574 and PR #12763.
Please make use of meta conditional to avoid failures on upcoming Rocket.Chat releases and review any changes to message schema for possible updates to
roomType
androomName
attributes.
.subscribe(stream, room)
Lower level method for creating subscription through socket. Can be called
explicitly to create any number of streams for specific rooms, but mainly used
implicitly by onMessage
for the main aggregated message stream.
Returned subscription instance includes an .onEvent
method for adding event
handlers and .unsubscribe
method to cancel the subscription.
A collection of methods provide extra utility for bots that are not yet documented other than in source. Some simply alias socket methods. See the [socket][socket readme] or the codebase for description and usage of the following:
asyncCall
cacheCall
callMethod
userById
getRoomId
getRoomName
getDirectMessageRoomId
joinRoom
leaveRoom
joinRooms
leaveRooms
prepareMessage
sendMessage
sendToRoomId
sendToRoom
sendDirectToUser
editMessage
setReaction
FAQs
Consume Rocket.Chat message streams and automate method calls.
We found that @amazebot/rocket-bot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.