# Ask Question — Wonderchat

> Ask a question to a WonderChat chatbot and receive a response. See the documentation

- Key: `wonderchat-ask-question`
- Type: Action (Write)
- Version: 0.0.1
- App: Wonderchat (`wonderchat`) — https://pipedream.com/apps/wonderchat.md
- This page (HTML): https://pipedream.com/apps/wonderchat/actions/ask-question
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/wonderchat/actions/ask-question/ask-question.mjs

## Description

Ask a question to a WonderChat chatbot and receive a response. [See the documentation](https://docs.wonderchat.io/api-reference/chat)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `chatbotId` | `string` | Yes | The ID of the chatbot you want to chat with. Can be found in the URL or share link of the chatbot. |
| `question` | `string` | Yes | The question you wish to ask your chatbot |
| `chatlogId` | `string` | No | The ID of your current chat session for conversation continuity. Found under the Chatlog Details in the WonderChat UI. |
| `context` | `string` | No | Additional custom context about the chat session (e.g., user information) |
| `contextUrl` | `string` | No | URL of the page the user is on to provide additional context |

## 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": "wonderchat",
      },
    },
  },
)

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: "wonderchat-ask-question",
  arguments: {
    chatbotId: "Chatbot ID",
    question: "Question",
  },
})
```

**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: "wonderchat-ask-question",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    wonderchat: { authProvisionId: "apn_xxxxxxx" },
    chatbotId: "Chatbot ID",
    question: "Question",
  },
})

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": "wonderchat-ask-question",
    "configured_props": {
      "wonderchat": { "authProvisionId": "apn_xxxxxxx" },
      "chatbotId": "Chatbot ID",
      "question": "Question"
    }
  }'
```

---

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