options.edited : respond to edited messages.options.livechat : respond to messages in Livechat rooms.options.dm : respond to messages in DMs with the SDK user.options.allPublic : respond to messages on all channels.options.rooms : respond to messages in joined rooms.This is a more user-friendly method for bots to subscribe to a message stream.įires callback after filters run on subscription events.Īccepts options object, that parallels respond filter env variables: Proxy for reactToMessages with some filtering of messages based on config. driver.respondToMessages(callback, options) Third argument is additional attributes, such as roomTypeįor example usage, see the Rocket.Chat Hubot adapter's receive function, which.Once a subscription is created, using driver.subscribeToMessages() this methodĬan be used to attach a callback to changes in the message stream.įires callback with every change in subscriptions. Shortcut to subscribe to user's message stream Resolves with subscription instance (with ID).Accepts parameters for Rocket.Chat streamer. Uses defaults from env ROCKETCHAT_USER and ROCKETCHAT_PASSWORD.Accepts object with username and/or email and password.Unsubscribe, logout, disconnect from Rocket.Chat Can return a promise, or use error-first callback pattern.Options accepts host and timeout attributes.New Message class instances directly if detailed attributes are required. Simple message creation and the message module can also be imported to create The driver.prepareMessage method (documented below) provides a helper for The structure for messages in this package matches that schema, with a The Rocket.Chat message schema can be found here: Run ts-node src/utils/users.ts for a demo of user query outputs. Some common requests for user queries are made available as simple helpers underĪpi.users, such as () which returns the user IDs of all Parameters defining the endpoint, payload and if authorization is required Rocket.Chat REST API calls can be made via api.get or api.post, with Server methods are not fullyĭocumented, most require searching the Rocket.Chat codebase. Next, create easybot.js with the following: const from browsersĪny Rocket.Chat server method can be called via driver.callMethod,ĭriver.cacheCall or driver.asyncCall. In a project directory, add .SDK as dependency: npm install -save Quick StartĪdd your own Rocket.Chat BOT, running on your favorite Linux, MacOS or Windows system.įirst, make sure you have the latest version of nodeJS (nodeJS 8.x or higher). Super Quick Start (30 seconds)Ĭreate your own working BOT for Rocket.Chat, in seconds, at. Application interface for server methods and message stream subscriptions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |