-
Notifications
You must be signed in to change notification settings - Fork 1
API : Emitters
In most cases, aido interactions are triggered by the users when they type in a slash command or click on a view. However, you might know situations where the server takes the initiative to trigger an interaction, either through a scheduled task or because of some external event.
For these cases, aido provides you with two emitters, which can be used to emit either a Slash (emulating the user typing /somecommand
in their Slack client), or an Action (emulating the user clicking on a button or submitting a form).
These methods are exposed on the aido object.
emitSlash (function) : Emits a Slash with the following parameters :
-
user (String) : The Slack ID of the user (
UW0TM8
) - command (String) : The slash command to emulate
- text (String) : Any additional text after the slash command
-
transportOptions (Object) :
transportOptions.channel (String) : The ID of a channel where the interactino should occur (
CXXXXXX
) transportOptions.conversationWith (Array) : An array of user Slack IDs. This is used to trigger a multi-party conversation with the indicated users. transportOptions.conversationAs (String) : Can containbot
oruser
. For a multi-party conversation, indicates if the message should be sent asuser
(the administrator who installed the app) orbot
(the bot user of the application).
emitAction (function) : Emits a Slash with the following parameters :
-
user (String) : The Slack ID of the user (
UW0TM8
) - command (String) : The slash command to emulate
-
action (String) : The action to execute (equivalent to the
name
attribute of a pressed button, or theaction
attribute of a submitted form) - args (Object) : Any arguments that should be sent to the action method
-
transportOptions (Object) :
transportOptions.channel (String) : The ID of a channel where the interactino should occur (
CXXXXXX
) transportOptions.conversationWith (Array) : An array of user Slack IDs. This is used to trigger a multi-party conversation with the indicated users. transportOptions.conversationAs (String) : Can containbot
oruser
. For a multi-party conversation, indicates if the message should be sent asuser
(the administrator who installed the app) orbot
(the bot user of the application).
This plugin will expose the emitters on the Slash class, so you can use this.emitSlash(...)
and this.emitAction(...)
in your Slash code.
This plugin creates a /hook
HTTP endpoint on your aido server, which can be used to emit a Slash or an Action through a webhook.
This plugin allows you to create recurring or one-off scheduled tasks to emit Slashes or Actions.