Coder Social home page Coder Social logo

assistant-actions-nodejs's People

Contributors

chatasweetie avatar taycaldwell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

assistant-actions-nodejs's Issues

Error "Interaction did not trigger the preview of an action" but sendInteraction() is called

As I see there are some bugs in readme

1, reviewSettings -> previewSettings

async function writePreviewFromDraft(projectId = 'your-project-id') {
  // Create request payload
  const request = {
    parent: `projects/${projectId}`,
    reviewSettings: {sandbox: {value: true}},

see:

                interface IWritePreviewRequest {

                    /** WritePreviewRequest parent */
                    parent?: (string|null);

                    /** WritePreviewRequest previewSettings */
                    previewSettings?: (google.actions.sdk.v2.WritePreviewRequest.IPreviewSettings|null);

2, parent -> project (just in sendIteraction, in writePreview is it parent)

async function sendInteraction(projectId = 'your-project-id', queryText = 'example query text') {
  const request = {
    parent: `projects/${projectId}`,
    input: {query: queryText}
  };

see:

                interface ISendInteractionRequest {

                    /** SendInteractionRequest project */
                    project?: (string|null);

3 So i use this payload for sendInteraction

  const request = {
    // parent: `projects/${projectId}`,
    project: `projects/${projectId}`,
    input: {
      type: 'VOICE',
      query: 'Parler avec audiobooks'
    },
    deviceProperties: {
      surface: 'SMART_DISPLAY',
      location: {
        coordinates: {
          latitude: -90.0,
          longitude: -90.0
        },
        formattedAddress: '1600 Amphitheatre Pkwy, Mountain View, CA 94043',
        zipCode: '94043',
        city: 'Mountain View'
      },
      locale: 'en',
      timeZone: 'America/New_York'
    }

  }

but got

{"code":3,"details":"Interaction did not trigger the preview of an action.","metadata":{"internalRepr":{},"options":{}}}

And I call the writePreviewFromDraft before. What can be the problem?

Interaction did not trigger the preview of an action.

Hey,
i'm wondering how to start a conversation?

here's my code

const { GoogleAuth } = require('google-auth-library')

const auth = new GoogleAuth({
  scopes: ['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/actions.builder']
})

auth.getClient().then(async client => {
  client.request({
    url: `https://actions.googleapis.com/v2/projects/${client.projectId}:sendInteraction`,
    method: 'POST',
    data: {
      input: {
        query: 'Talk to Super Test App',
        type: 'KEYBOARD'
      },
      deviceProperties: {
        surface: 'SMART_DISPLAY',
        location: {
          coordinates: {
            latitude: -90.0,
            longitude: -90.0
          },
          formattedAddress: '1600 Amphitheatre Pkwy, Mountain View, CA 94043',
          zipCode: '94043',
          city: 'Mountain View',
        },
        locale: 'en',
        timeZone: 'America/New_York'
      }
    }
  })
  .then(console.log)
  .catch(console.error)
})

Error

400

{
      message: 'Interaction did not trigger the preview of an action.',
      domain: 'global',
      reason: 'badRequest'
    }

Firebase Terms of Service is not accepted. Navigate to your project's overview page on the Actions Console to accept the Terms of Service.

Sample code

const {ActionsSdkClient} = require('@assistant/actions')

const client = new ActionsSdkClient({
  parent: 'projects/action-builder-test-40291'
})

client.listVersions({parent: 'projects/action-builder-test-40291'}).then(version => console.log)

Log

mish@ushakov action-builder-test % node index.js
(node:39636) UnhandledPromiseRejectionWarning: Error: 9 FAILED_PRECONDITION: Firebase Terms of Service is not accepted. Navigate to your project's overview page on the Actions Console to accept the Terms of Service.
    at Object.callErrorFromStatus (/Users/mish/Downloads/action-builder-test/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
    at Object.onReceiveStatus (/Users/mish/Downloads/action-builder-test/node_modules/@grpc/grpc-js/build/src/client.js:176:52)
    at Object.onReceiveStatus (/Users/mish/Downloads/action-builder-test/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)
    at Object.onReceiveStatus (/Users/mish/Downloads/action-builder-test/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
    at /Users/mish/Downloads/action-builder-test/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:39636) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:39636) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

don't see anything on the overview page, adblocker disabled

Screenshot 2021-04-21 at 15 59 59

List item fields missing from response

Some list item fields are missing when returned via API (although rendered correctly in simulator)

YAML:

Screenshot 2021-07-19 at 16 02 52

Response:

Screenshot 2021-07-19 at 15 56 53

title, description, image.url, image.alt are missing from the response!

"Request contains an invalid argument" error from sendInteraction

It does not work for me. I got an error

{
    "code":3,
    "details":"Request contains an invalid argument.",
    "metadata":{
        "internalRepr":{},
        "options":{}
    }
}

My code is:

const { ActionsTestingClient } = require('@assistant/actions')

async function sendInteraction (projectId, queryText = 'example query text') {
  const request = {
    project: projectId,
    parent: `projects/${projectId}`,
    input: { query: queryText }
  }
  // Create client
  const actionsTestingClient = new ActionsTestingClient({
    credentials: {
      client_email: 'xxx',
      private_key: 'yyy'
    }
  })
  const res = await actionsTestingClient.sendInteraction(request)
  return res[0]
}

sendInteraction('xxx').then(res => {
  console.log(`res ===> ${JSON.stringify(res)}`)
}).catch(err => {
  console.log(err)
  console.log(`err ===> ${JSON.stringify(err)}`)
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.