# Make a Phone Call — Twilio

> Make a phone call passing text, a URL, or an application that Twilio will use to handle the call. See the documentation

- Key: `twilio-make-phone-call`
- Type: Action (Write)
- Version: 1.0.1
- App: Twilio (`twilio`) — https://pipedream.com/apps/twilio.md
- This page (HTML): https://pipedream.com/apps/twilio/actions/make-phone-call
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/twilio/actions/make-phone-call/make-phone-call.mjs

## Description

Make a phone call passing text, a URL, or an application that Twilio will use to handle the call. [See the documentation](https://www.twilio.com/docs/voice/api/call-resource#create-a-call-resource)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `from` | `string` | Yes | The phone number or alphanumeric sender ID the message is from Options are loaded from the connected account. |
| `to` | `string` | Yes | The destination phone number in E.164 format. Format with a + and country code (e.g., +16175551212). |
| `text` | `string` | No | Plain text for Twilio to speak when the user picks up the phone. For TwiML or SSML, use the URL field instead. Provide exactly one of Text, URL, or Application SID. |
| `url` | `string` | No | The absolute URL that returns the TwiML instructions for the call. Provide exactly one of Text, URL, or Application SID. |
| `applicationSid` | `string` | No | The SID of an Application resource that will handle the call. You can use List Application SID Options to get a list of available options. Provide exactly one of Text, URL, or Application SID. Options are loaded from the connected account. |
| `timeout` | `integer` | No | The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is 60 seconds and the maximum is 600 seconds. |
| `record` | `boolean` | No | Whether to record the call |
| `trim` | `string` | No | Whether to trim any leading and trailing silence from the recording. Only applies when Record is enabled. |
| `recordingTrack` | `string` | No | The audio track to record for the call. Default is both. Only applies when Record is enabled. |
| `recordingCallbackUrl` | `string` | No | The URL that we call when the recording is available to be accessed. Only applies when Record is enabled. |

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

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: "twilio-make-phone-call",
  arguments: {
    from: "From",
    to: "To",
  },
})
```

**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: "twilio-make-phone-call",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    twilio: { authProvisionId: "apn_xxxxxxx" },
    from: "From",
    to: "To",
  },
})

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": "twilio-make-phone-call",
    "configured_props": {
      "twilio": { "authProvisionId": "apn_xxxxxxx" },
      "from": "From",
      "to": "To"
    }
  }'
```

---

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