1

I am building an endpoint to fulfill Google Smart Home Actions requests. I need to build this in ASP.NET Core. Is there a library I can use to wrap Google Smart Home Actions request? I am only seeing libraries for Node.js and Java.

Google Smart Home Actions libraries

WuTang805
  • 17
  • 3

1 Answers1

1

There is not currently a fulfillment library for intent handling with .NET (although we are exploring the idea). However, you can use the Google APIs for .NET client library to communicate with the Home Graph service (used for features such as Request Sync and Report State).

Here is a quick example of what the Home Graph client would look like in C#:

try
{
    // Create authorized client
    GoogleCredential credential = GoogleCredential.FromFile("service-account.json")
        .CreateScoped(new[] { "https://www.googleapis.com/auth/homegraph" });
    var service = new HomeGraphServiceService(
        new BaseClientService.Initializer()
        {
            HttpClientInitializer = credential,
            ApplicationName = "HomeGraphTester",
        });

    // Make Home Graph requests
    var request = new RequestSyncDevicesRequest{
      AgentUserId = "1234"
    };
    var response = service.Devices.RequestSync(request);
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}
devunwired
  • 62,780
  • 12
  • 127
  • 139
  • Thank you! I've tried to look all over for one but no luck :(. I guess I will build my own and use Google APIs for .NET for Request Sync and Report State. – WuTang805 Jul 28 '20 at 18:27