# Detect Intent — Google Dialogflow

> Processes a natural language query and returns structured, actionable data as a result, See REST docs and client API

- Key: `google_dialogflow-detect-intent`
- Type: Action (Write)
- Version: 1.0.1
- App: Google Dialogflow (`google_dialogflow`) — https://pipedream.com/apps/google-dialogflow.md
- This page (HTML): https://pipedream.com/apps/google-dialogflow/actions/detect-intent
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/google_dialogflow/actions/detect-intent/detect-intent.mjs

## Description

Processes a natural language query and returns structured, actionable data as a result, [See REST docs](https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.sessions/detectIntent) and [client API](https://googleapis.dev/nodejs/dialogflow/latest/google.cloud.dialogflow.v2beta1.Sessions.html#detectIntent2)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `sessionId` | `string` | Yes | A unique session ID, ID of the session created when a context created can be used, e.g. acb92b1d-0a8c-4369-a5fa-ddd7954b2b46 |
| `queryParams` | `object` | No | Properties of Query Parameters, See client API |
| `queryInput` | `object` | No | Properties of a Query Input, See client API. For example {"text":{"text":"Hi, what are you doing?","languageCode":"en-EN"}} |
| `outputAudioConfig` | `object` | No | Properties of an Output Audio Config, See client API |
| `outputAudioConfigMask` | `object` | No | Properties of a Field Mask, See client API |
| `inputAudioFile` | `string` | No | Provide a file URL or a path to a file in the /tmp directory. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "google_dialogflow",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "google_dialogflow-detect-intent",
  arguments: {
    sessionId: "Session ID",
    queryParams: "Query Params",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "google_dialogflow-detect-intent",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_dialogflow: { authProvisionId: "apn_xxxxxxx" },
    sessionId: "Session ID",
    queryParams: "Query Params",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "google_dialogflow-detect-intent",
    "configured_props": {
      "google_dialogflow": { "authProvisionId": "apn_xxxxxxx" },
      "sessionId": "Session ID",
      "queryParams": "Query Params"
    }
  }'
```

---

- App: https://pipedream.com/apps/google-dialogflow.md · All apps: https://pipedream.com/apps
