All Projects → ticketmaster → Actions On Google Kotlin

ticketmaster / Actions On Google Kotlin

Licence: apache-2.0
Unofficial Actions on Google SDK for Kotlin and Java

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to Actions On Google Kotlin

wake-on-lan
Use any SmartThings switch (including a virtual one) to wake up a device on your LAN
Stars: ✭ 20 (-82.76%)
Mutual labels:  google-home
Go Chromecast
cli for Google Chromecast, Home devices and Cast Groups
Stars: ✭ 325 (+180.17%)
Mutual labels:  google-home
Lovelace Themes
Homebrew themes for homeassistant lovelace ui
Stars: ✭ 83 (-28.45%)
Mutual labels:  google-home
Konversation
Konversation is a tool to generate rich and diversified responses to the user of a voice application.
Stars: ✭ 15 (-87.07%)
Mutual labels:  google-home
Google Actions Java Sdk
(Deprecated) Unofficial Google Actions Java SDK - for Android engineers and all Java lovers
Stars: ✭ 280 (+141.38%)
Mutual labels:  google-home
Flask Assistant
Framework for Building Virtual Assistants with Dialogflow and python
Stars: ✭ 358 (+208.62%)
Mutual labels:  google-home
assistant-freebox
Plugin pour contrôler la Freebox Révolution via un Assistant comme Google Home
Stars: ✭ 22 (-81.03%)
Mutual labels:  google-home
Jovo Framework
🔈 The Open Source Voice Layer: Build Voice Experiences for Alexa, Google Assistant, Samsung Bixby, Web Apps, and much more
Stars: ✭ 1,320 (+1037.93%)
Mutual labels:  google-home
Hoobs
Build your Smart Home with HOOBS. Connect over 2,000 Accessories to your favorite Ecosystem.
Stars: ✭ 325 (+180.17%)
Mutual labels:  google-home
Google Actions Php
This library is a helper for google actions / google home apps with php.
Stars: ✭ 19 (-83.62%)
Mutual labels:  google-home
SinricPro Generic
Simple way to control your IOT development boards like ESP8226, ESP32, Arduino SAMD21, Adafruit SAMD21, SAMD51, nRF52, STM32, Teensy, SAM DUE with Amazon Alexa or Google Home
Stars: ✭ 18 (-84.48%)
Mutual labels:  google-home
Sinric
Amazon Alexa Smart home skill / Google Home Action for ESP8266 / ESP32 / Arduino
Stars: ✭ 259 (+123.28%)
Mutual labels:  google-home
Assistantcomputercontrol
Control your computer with your Google Home or Amazon Alexa assistant!
Stars: ✭ 554 (+377.59%)
Mutual labels:  google-home
ultimate-guide-to-voice-assistants
Curation of startups, resources, people, posts etc in the voice-space
Stars: ✭ 55 (-52.59%)
Mutual labels:  google-home
Google Home Notifier Python
A google home notification webservice
Stars: ✭ 90 (-22.41%)
Mutual labels:  google-home
Google-Assistant-Samsung-Smart-TV-Integration
Use Google Assistant as a remote for your Samsung Smart TV. There is no need for a Logitech Harmony device.
Stars: ✭ 26 (-77.59%)
Mutual labels:  google-home
Ghlocalapi
(Unofficial) Google Home local API documentation.
Stars: ✭ 334 (+187.93%)
Mutual labels:  google-home
Assistantjs
TypeScript framework to build cross-platform voice applications (alexa, google home, ...).
Stars: ✭ 100 (-13.79%)
Mutual labels:  google-home
Assistant Plugins
Des plugins pour les Assistant (comme Google Home, Cortana, Alexa)
Stars: ✭ 93 (-19.83%)
Mutual labels:  google-home
Assistant Relay
A Node.js server that allows for sending commands to Google Home/Assistant from endpoints
Stars: ✭ 638 (+450%)
Mutual labels:  google-home

Actions On Google Client Library

This is a port of the official Node.js SDK to Kotlin. This can also be used from Java and any JVM language.

Quick Facts

  • Port of the actions-on-google SDK to Kotlin. Kotlin and Java developers can quickly start building Actions for Google Assistant.
  • Used in production for the Ticketmaster Assistant Action ("Ok Google, ask Ticketmaster to find rock concerts near me.")
  • Closely matches Node.js Client Library API
  • Closely matches implementation of Node.js sdk so code can be maintained easily as features are added
  • All tests ported from nodejs SDK (using Spek framework) & 100% passing
  • Dialogflow and Actions SDK support
  • Conversation Components & Transaction Sample ported
  • Supports v2 of Actions on Google API (if v1 is needed, make an issue please)

V2 Support

The V2 release is available by using:

    compile 'com.tmsdurham.actions:actions-on-google:2.0.2'

The V2 is mostly complete, but may have a few bugs and missing features. All Conversation components and Transaction API are working. Dialogflow & ActionSDK has been tested and working. The API matches the official node.js API very closely. The sample in this repo is a good place to get started. The setup and samples in this readme have not been updated yet. There are a few differerences and additions:

* use action name from Dialogflow instead of intent name.  The official library changed from using the action field, to using the intent name.  There is a PR open on the official SDK for support for action.  If/when this is merged, this library will be updated to match.
* middleware not supported.  Same functionality can be implemented without lib support by wrapping handlers in fuctions.

V2 notes: A common module was used with the intent on targeting multiple platforms (JS & possibly native). These other platforms are purely experimental at this time. A single code base for JVM and JS would be more efficient.

Setup Instructions(V1 - see sample for V2 setup and use)

This library is available on jCenter. If your using gradle simply add the dependency as follows:

Gradle:

repositories {
        jCenter()
    }
}

dependencies {
    compile 'com.tmsdurham.actions:actions-on-google:1.6.0'
}

Maven:

<dependency>
	<groupId>com.tmsdurham.actions</groupId>
	<artifactId>actions-on-google</artifactId>
	<version>1.6.0</version>
	<type>pom</type>
</dependency>

The above artifact should fit the needs of most developers, however, if you are not using java.servlet.http.HttpServlet, or do not want to use Gson for deserialization, you can use the actions-on-google-core lib. For example how to use the core library, reading through the sdk-gson-servlet module.

Gradle:

compile 'com.tmsdurham.actions:actions-on-google-core:1.6.0'. //only if not using Servlets

Maven:

<dependency>
	<groupId>com.tmsdurham.actions</groupId>
	<artifactId>actions-on-google-core</artifactId>		//only if not using Servlets
	<version>1.6.0</version>
	<type>pom</type>
</dependency>

Using Kotlin

fun welcome(app: DialogflowApp) =
    app.ask(app.buildRichResponse()
            .addSimpleResponse(speech = "Hi there!", displayText = "Hello there!")
            .addSimpleResponse(
                    speech = """I can show you basic cards, lists and carousels as well as
                "suggestions on your phone""",
                    displayText = """"I can show you basic cards, lists and carousels as
                "well as suggestions"""")
            .addSuggestions("Basic Card", "List", "Carousel", "Suggestions"))
            
fun normalAsk(app: DialogflowApp) = app.ask("Ask me to show you a list, carousel, or basic card")

fun suggestions(app: DialogflowApp) {
    app.ask(app
        .buildRichResponse()
        .addSimpleResponse("This is a simple response for suggestions")
        .addSuggestions("Suggestion Chips")
        .addSuggestions("Basic Card", "List", "Carousel")
        .addSuggestionLink("Suggestion Link", "https://assistant.google.com/"))
}

val actionMap = mapOf(
    WELCOME to ::welcome,
    NORMAL_ASK to ::normalAsk,
    SUGGESTIONS to ::suggestions)
  

@WebServlet("/conversation")
class WebHook : HttpServlet() {

	override fun doPost(req: HttpServletRequest, resp: HttpServletResponse) {
    	DialogflowAction(req, resp).handleRequest(actionMap)
   }
}

Using Java

@WebServlet("/conversation/java")
public class ConversationComponentsSampleJava extends HttpServlet {
	private static final Logger logger = Logger.getAnonymousLogger();

	Function1<DialogflowApp, Object> welcome = app -> {
    	app.ask(app.buildRichResponse()
            .addSimpleResponse("Hi there from Java!", "Hello there from Java!")
            .addSimpleResponse(
                    "I can show you basic cards, lists and carousels as well as suggestions on your phone",
                    "I can show you basic cards, lists and carousels as well as suggestions")
            .addSuggestions("Basic Card", "List", "Carousel", "Suggestions"), null);
    	return Unit.INSTANCE;
	};

	Function1<DialogflowApp, Object> normalAsk = app ->
   	     app.ask("Ask me to show you a list, carousel, or basic card");

	Function1<DialogflowApp, Object> suggestions = app ->
   	     app.ask(app.buildRichResponse(null)
                .addSimpleResponse("This is a simple response for suggestions", null)
                .addSuggestions("Suggestion Chips")
                .addSuggestions("Basic Card", "List", "Carousel")
                .addSuggestionLink("Suggestion Link", "https://assistant.google.com/"));

	private Map<String, Function1<String, Object>> intentMap = new HashMap() {{
    	put(ConversationComponentsSampleKt.WELCOME, welcome);
    	put(ConversationComponentsSampleKt.NORMAL_ASK, normalAsk);
    	put(ConversationComponentsSampleKt.SUGGESTIONS, suggestions);
	}};

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
     	 DialogflowAction action = new DialogflowAction(req, resp);
   	 	 action.handleRequest(intentMap);
	}
}

Extending to other Platforms

Dialogflow can be integrated with other platforms, such as Facebook Messenger, Slack, etc. Actions-on-Goolge-kotlin can be extended and data for those platforms returned from your webhook. To do this, simply add to the data for your platform using the app.data function. This must be done before calling the ask function.

val app = DialogflowAction(resp, req, gson)
val facebookResponse = //build response with your choice of method
app.data {
	this["facebook"] = facebookMessages
}
app.ask("Hello facebook users!")

The objects in the data object will be passed to the original platform. It may also be used to send custom data back in the response to the /query rest endpoint. More info on this is in the Dialogflow docs.

License

See LICENSE.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].