You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to find a simpler way for bots to register handlers for different events. Right now, a bot consists mainly of a generic event handler. For example:
app.get('/zendesk/oauth',async(req,res)=>{// do something})
I would love it if bots could register event handlers in a similar fashion. The events I think bots can register handlers for are:
Processing any URLs/links found in a post
Processing commands transmitted to a bot, e.g. @botName command param
Processing interactive messaging events, e.g. submitting adaptive card forms
Processing messaging events, e.g. Message4Bot, PostAdded, BotDeleted, etc.
And I would love the registration of these handlers to be similar to express. Here is some pseudocode:
constapp=express();extendApp(app)app.onUrl(function(url,bot,response){// some logicresponse.postCard(adaptiveCard)})app.onCardSubmit("action_name",function(data,response){letvariable=data.form_element_id// some logicresponse.postDialog(dialog)})app.onMessage4Bot(function(event,response){response.postMessage("hello")})app.onBotCommand('command name',function(args,response){letname=args[1]if(something_went_wrong){throwBotError("this message will be displayed in a dialog")}response.postMessage("hello "+name)})
A few things I would like to point out:
The developer need only register callbacks/handlers for all the events we support.
Events handlers all receive a response object of some kind, and the developer uses this response object to perform common actions, e.g. posting messages/dialogs/cards as a response to the event/user
There is a consistent way to transmit errors and for those errors to be communicated to the user
The text was updated successfully, but these errors were encountered:
I would like to find a simpler way for bots to register handlers for different events. Right now, a bot consists mainly of a generic event handler. For example:
In your main index.js file you then register this handler like so:
Express registers handlers like so:
I would love it if bots could register event handlers in a similar fashion. The events I think bots can register handlers for are:
And I would love the registration of these handlers to be similar to express. Here is some pseudocode:
A few things I would like to point out:
The text was updated successfully, but these errors were encountered: