CONNECT APP
Build with Twist
Communication
- OAuth
MCP
Give your agent Twist tools
Every Twist action is exposed as an MCP tool on Pipedream's remote server. Point a client at it with your end user's ID and Connect resolves that user's Twist account for each tool call — you store no tokens.
// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{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": "twist",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// e.g. run Add Comment:
const result = await mcp.callTool({
name: "twist-add-comment",
arguments: {
thread_id: "Thread id",
content: "Content",
},
})# access_token: mint a short-lived token with the Connect SDK — see the MCP guide
headers = {
"Authorization": f"Bearer {access_token}",
"x-pd-project-id": "{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": "twist",
}
async with streamablehttp_client("https://remote.mcp.pipedream.net/v3", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
# e.g. run Add Comment:
result = await session.call_tool("twist-add-comment", {
"thread_id": "Thread id",
"content": "Content",
})API PROXY
Call the Twist API directly
For an endpoint with no pre-built tool, the Connect proxy forwards your request to the Twist API with the connected user's credentials attached. You store no tokens and write no refresh logic.
const resp = await pd.proxy.get({
externalUserId: "{external_user_id}", // any stable ID for this user in your system
accountId: "apn_xxxxxxx",
url: "https://api.twist.com/api/v3/users/get_session_user",
})
// Any allowed Twist endpoint works here. Pipedream attaches the
// connected account's credentials to the outgoing request.# The path segment is the target URL, URL-safe base64 encoded:
# https://api.twist.com/api/v3/users/get_session_user
curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9hcGkudHdpc3QuY29tL2FwaS92My91c2Vycy9nZXRfc2Vzc2lvbl91c2Vy?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
-H "Authorization: Bearer {access_token}" \
-H "x-pd-environment: production"SDK
Run Twist actions from your backend
Connect a user's Twist account once, then run Add Comment on their behalf from your own code — TypeScript, Python, or plain HTTP.
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: "twist-add-comment",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
twist: { authProvisionId: "apn_xxxxxxx" },
thread_id: "Thread id",
content: "Content",
},
})from pipedream import Pipedream
pd = Pipedream(
client_id="{oauth_client_id}",
client_secret="{oauth_client_secret}",
project_id="{project_id}",
project_environment="production",
)
result = pd.actions.run(
id="twist-add-comment",
external_user_id="{external_user_id}", # any stable ID for this user in your system
configured_props={
"twist": {"authProvisionId": "apn_xxxxxxx"},
"thread_id": "Thread id",
"content": "Content",
},
)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": "twist-add-comment",
"configured_props": {
"twist": { "authProvisionId": "apn_xxxxxxx" },
"thread_id": "Thread id",
"content": "Content"
}
}'TOOLS
Twist actions
On-demand operations your product or agent can configure and run on behalf of a connected user.
-
Add Comment
actionAdds a new comment to a thread.Writev0.2.3 -
Add Message To Conversation
actionAdds a message to an existing conversation.Writev0.1.3 -
Add Thread
actionAdds a new thread to a channel.Writev0.2.3 -
Get Current User
actionGets the associated user for access token used in the request.Read-onlyv0.1.2 -
Get Thread
actionGets a thread object by id.Read-onlyv0.1.2 -
Get Workspace User By Email
actionGets a workspace user by email.Read-onlyv0.1.2 -
Get Workspace Users
actionGets a list of users for the given workspace id.Read-onlyv0.1.2
-
New Channel (Instant)
triggerEmit new event for any new channel added in a workspace See the docs hereInstantv0.0.2 -
New Comment (Instant)
triggerEmit new event for any new comment in a workspace See the docs hereInstantv0.0.2 -
New Event (Instant)
triggerEmit new event for any new updates in a workspace See the docs hereInstantv0.0.2 -
New Group (Instant)
triggerEmit new event for any new group added in a workspace See the docs hereInstantv0.0.1 -
New Group User (Instant)
triggerEmit new event for any new user added to a workspace group See the docs hereInstantv0.0.1 -
New Message (Instant)
triggerEmit new event for any new message in a workspace See the docs hereInstantv0.0.2 -
New Thread (Instant)
triggerEmit new event for any new thread in a workspace See the docs hereInstantv0.0.2
- App slug
- twist
- Authentication
- OAuth
- Categories
- Communication
- Actions
- 7
- Triggers
- 7
- API proxy
- Available
OAuth scopes
These are the scopes Pipedream's managed Twist OAuth client requests when one of your users connects an account. Supply your own OAuth client to request a different set.
- user:write
- user:read
- workspaces:write
- workspaces:read
- channels:remove
- channels:write
- channels:read
- threads:remove
- threads:write
- threads:read
- comments:remove
- comments:write
- comments:read
- groups:remove
- groups:write
- groups:read
- messages:remove
- messages:write
- messages:read
- reactions:remove
- reactions:write
- reactions:read
- search:read
- attachments:write
- attachments:read
- notifications:write
- notifications:read