Connecting Dialogflow to JAICF project
The platform makes it easy to integrate a conversational user interface into your mobile app, web application, device, and so on. In this article, we are looking at connecting Telegram for a JAICF project using Dialogflow.
To connect the Dialogflow channel to the JAICF project, please follow these steps:
Prepare the project
Before connecting a channel, prepare the JAICF project in advance:
- Specify the following in the dependencies of
build.gradle.kts
file:
dependencies {
// ...
implementation("com.just-ai.jaicf:jaicp:$jaicfVersion")
implementation("com.just-ai.jaicf:google-actions:$jaicfVersion")
}
$jaicfVersion
with the latest framework version.- Configure depending on the connection method to the platform:
-
long polling
— the bot will connect to the Just AI server when interacting with the platform. Simple solution, convenient for local development, and debugging.For this method, specify
ActionsFulfillmentDialogflow()
in theJaicpPoller.kt
file:
package com.just-ai.jaicf.template.connections
fun main() {
JaicpPollingConnector(
templateBot,
accessToken,
channels = listOf(
ChatApiChannel,
ChatWidgetChannel,
TelephonyChannel,
ActionsFulfillmentDialogflow()
)
).runBlocking()
}
-
webhook
— the bot will receive messages from the platform using the specified link. Must be configured to connect JAICP Cloud.For this method, specify
ActionsFulfillmentDialogflow()
in theJaicpServer.kt
file:
package com.just-ai.jaicf.template.connections
fun main() {
JaicpServer(
botApi = templateBot,
accessToken = accessToken,
channels = listOf(
ChatApiChannel,
ChatWidgetChannel,
TelephonyChannel,
ActionsFulfillmentDialogflow()
)
).start(wait = true)
}