# Update Ticket — Gorgias

> Updates a predefined ticket in the Gorgias system. See the documentation

- Key: `gorgias_oauth-update-ticket`
- Type: Action (Write)
- Version: 0.0.10
- App: Gorgias (`gorgias_oauth`) — https://pipedream.com/apps/gorgias-oauth.md
- This page (HTML): https://pipedream.com/apps/gorgias-oauth/actions/update-ticket
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/gorgias_oauth/actions/update-ticket/update-ticket.mjs

## Description

Updates a predefined ticket in the Gorgias system. [See the documentation](https://developers.gorgias.com/reference/update-ticket)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `ticketId` | `integer` | Yes | The ID of a ticket Options are loaded from the connected account. |
| `assigneeTeamId` | `integer` | No | The ID of the team assigned to the ticket Options are loaded from the connected account. |
| `assigneeUserId` | `integer` | No | The ID of the user assigned to the ticket Options are loaded from the connected account. |
| `channel` | `string` | No | The channel used to send the message. Defaults to email |
| `closedDatetime` | `string` | No | When the ticket was closed (ISO 8601 format) |
| `customerId` | `integer` | No | The ID of a customer Options are loaded from the connected account. |
| `customerEmail` | `string` | No | The email of the customer linked to the ticket |
| `externalId` | `string` | No | ID of the customer in a foreign system. This field is not used by Gorgias |
| `fromAgent` | `boolean` | No | Whether the first message of the ticket was sent by your company to a customer, or the opposite |
| `isUnread` | `boolean` | No | Whether the ticket is unread for you |
| `language` | `string` | No | The customer's preferred language (format: ISO_639-1) |
| `spam` | `boolean` | No | Whether the ticket is considered as spam or not |
| `status` | `string` | No | The status of the ticket. Default: open |
| `subject` | `string` | No | The subject of the ticket |
| `tags` | `string[]` | No | Tags linked to the ticket |

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

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: "gorgias_oauth-update-ticket",
  arguments: {
    ticketId: 10,
    assigneeTeamId: 10,
  },
})
```

**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: "gorgias_oauth-update-ticket",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    gorgias_oauth: { authProvisionId: "apn_xxxxxxx" },
    ticketId: 10,
    assigneeTeamId: 10,
  },
})

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": "gorgias_oauth-update-ticket",
    "configured_props": {
      "gorgias_oauth": { "authProvisionId": "apn_xxxxxxx" },
      "ticketId": 10,
      "assigneeTeamId": 10
    }
  }'
```

---

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