Plain

Learn how to use Plain with Composio

Overview

SLUG: PLAIN

Description

Plain is a collaborative support platform for B2B support teams, offering a modern, AI-powered interface to consolidate support channels and assist customers efficiently.

Authentication Details

generic_api_key
stringRequired

Connecting to Plain

Create an auth config

Use the dashboard to create an auth config for the Plain toolkit. This allows you to connect multiple Plain accounts to Composio for agents to use.

1

Select App

Navigate to the Plain toolkit page and click “Setup Integration”.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Integration”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using API Key

1from composio import Composio
2from composio.types import auth_scheme
3
4# Replace these with your actual values
5plain_auth_config_id = "ac_YOUR_PLAIN_CONFIG_ID" # Auth config ID created above
6user_id = "0000-0000-0000" # UUID from database/app
7
8composio = Composio()
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 # Replace this with a method to retrieve an API key from the user.
12 # Or supply your own.
13 user_api_key = input("[!] Enter API key")
14
15 connection_request = composio.connected_accounts.initiate(
16 user_id=user_id,
17 auth_config_id=auth_config_id,
18 config={"auth_scheme": "API_KEY", "val": user_api_key}
19 )
20
21 # API Key authentication is immediate - no redirect needed
22 print(f"Successfully connected Plain for user {user_id}")
23 print(f"Connection status: {connection_request.status}")
24
25 return connection_request.id
26
27
28connection_id = authenticate_toolkit(user_id, plain_auth_config_id)
29
30# You can verify the connection using:
31connected_account = composio.connected_accounts.get(connection_id)
32print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Plain toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["PLAIN"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Add Customer To Group

Description

Tool to add a customer to one or more customer groups. use when you have a customer and groups ready.

Action Parameters

customerGroupIdentifiers
arrayRequired
customerId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Customer

Description

Tool to create a customer. use after gathering email and full name to provision a new customer in plain.

Action Parameters

email
Required
email_verified
boolean
external_id
string
full_name
stringRequired
short_name
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Customer Group

Description

Tool to create a new customer group. use when needing to group customers for segmentation. creates a new customer group with specified name, key, color, and optional externalid.

Action Parameters

color
Required
externalId
string
key
stringRequired
name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Thread

Description

Tool to create a new thread. use after obtaining valid customer identifier.

Action Parameters

assignedTo
object
components
array
customerIdentifier
objectRequired
labelTypeIds
array
title
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Customer

Description

Tool to delete a customer from the system. use when you need to remove a customer by their id.

Action Parameters

customer_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete User

Description

Tool to delete a user from the system. use when you need to remove a user by their id after confirming existence.

Action Parameters

user_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Fetch Company

Description

Tool to fetch company details by id. use when you need the full profile of a company, including name, domain, contract value, owner info, and timestamps.

Action Parameters

company_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Fetch Issues

Description

Tool to fetch external issue links for a customer. use when you need to list all issues across a customer's threads.

Action Parameters

customerId
stringRequired
linkFirst
integerDefaults to 50
threadFirst
integerDefaults to 50

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Fetch Tier

Description

Tool to fetch a tier by its id. use when you have a tier id and need its metadata before proceeding. example: "fetch tier with id tier 123".

Action Parameters

tier_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Customers

Description

Tool to fetch a list of customers. use when retrieving multiple customer records with pagination, filtering, or sorting.

Action Parameters

after
string
before
string
filters
object
first
integer
last
integer
sortBy
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Customer By Email

Description

Tool to fetch customer details by email. use after confirming the email exists to retrieve detailed customer information.

Action Parameters

email
Required

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Customer By ID

Description

Tool to retrieve details of a specific customer by their unique id. use after obtaining the customer's id to fetch their complete record.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Thread By ID

Description

Tool to fetch details of a specific thread using its unique identifier. use after confirming the thread id is correct.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get User By ID

Description

Tool to fetch user by id. use when you have a valid user id to retrieve detailed user information.

Action Parameters

user_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Customer Groups

Description

Tool to list all customer groups. use when you need to retrieve group metadata with optional pagination or filters.

Action Parameters

after
string
before
string
filters
object
first
integer
last
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Threads

Description

Tool to list all threads. use when you need to retrieve thread summaries with optional pagination.

Action Parameters

after
string
before
string
first
integer
last
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Tiers

Description

Tool to retrieve a list of tiers with pagination. use when you need to browse available tiers after determining pagination cursors. example: 'list tiers with first=25'.

Action Parameters

after
string
before
string
first
integer
last
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Threads

Description

Tool to retrieve a paginated list of threads. use when you need to list threads with optional status filtering.

Action Parameters

cursor
string
statuses
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Remove Customer From Group

Description

Tool to remove a customer from one or more customer groups. use when you need to revoke memberships.

Action Parameters

customerGroupIdentifiers
arrayRequired
customerId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Send Message

Description

Tool to send a new message within a thread. use after identifying the thread and preparing message content.

Action Parameters

channelSpecificOptions
object
impersonation
object
markdownContent
string
textContent
string
threadId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Company

Description

Tool to update an existing company's details. use when modifying a company's name or domain.

Action Parameters

accountOwnerUserId
string
companyId
stringRequired
contractValue
integer
domainName
stringRequired
name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Thread

Description

Tool to update a thread's title. use when renaming a thread after confirming its id.

Action Parameters

threadId
stringRequired
title
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Upsert Customer

Description

Tool to upsert (create or update) a customer. use when syncing or ensuring a customer record exists before subsequent actions.

Action Parameters

identifier
objectRequired
onCreate
objectRequired
onUpdate
objectRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired