Pushback function in JAICF
loop-lab opened this issue · 2 comments
loop-lab commented
Hi!
JAICP has function Pushgate for outgoing mailing from chat-bot.
https://help.just-ai.com/docs/ru/JS_API/built_in_services/pushgate/pushgate
I didn't find this function in JAICF. How to make such the function?
Denire commented
@loop-lab There is no built-in pushgate service at this moment. We're planning to add it somewhere in near future.
There are two ways to similar functionality inside your project:
- Using InvocationAPI. This API is documented only is source code, without any articles on help.jaicf.com. Basic usage looks like this:
val channel = TelegramChannel(...)
channel.processInvocation(
InvocationEventRequest(
clientId = "telegram-client-id",
input = "my-event",
requestData = "any custom request data"
), RequestContext.DEFAULT)
After processInvocation
is called, event with name my-event
will be sent to scenario, where it should be processed.
state("my-event", noContext = true) {
activators {
event("my-event")
}
action {
reactions.say("Event my-event is processed")
}
}
But there is no built-in scheduling mechanism for creating or canceling delayed events.
- Using asynchronous calls with coroutines. This works if you need to send some message with delay.
action {
reactions.say("This is start")
CoroutineScope(Dispatchers.IO).launch {
delay(10000)
reactions.say("This is async answer")
}
}
loop-lab commented
Thank you!