Channels
Esta página aún no se encuentra traducida al español.
Overview
Channels are workspaces where users can get task information, change task states, submit surveys, summon bots, chat with other users, and share files.
Channels exist within either regular or workflow groups.
These are just some of the most basic API requests. For a complete list of endpoints, consult our API documentation on Swagger.
Get Channels
Returns all channels within the company.
GET /channelsEndpoint URL
https://www.cotalker.com/api/v2/channels
Headers
Header | Description | Required | Values |
---|---|---|---|
Authorization | Sends your access token to make an API request. Click here to see how to obtain an access token. | Required | Bearer $ACCESS_TOKEN |
Query Parameters
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
search | Returns channels that match the keywords in the search field array. | string | Optional | |
limit | Limits the amount of channels returned in the response. | number | Optional | By default, the limit is set to 10. |
page | Makes the response display data from the indicated page number. | number | Optional | Best used in combination with the "limit" parameter. |
count | Adds the counter field with the total amount of channels within the company. | boolean | Optional | |
orderBy | Orders the channels by ascendeing or descending order according to their modifiedAt field. | string | Optional | Options: asc , desc |
sortBy | Sorts channels in the response according to the chosen field: nameCode , modifiedAt , or createdAt . | string | Optional | Details about the Channel Data Model |
group | Returns all channels found within the indicated group. | ObjectId<COTGroup> | ||
isActive | Returns channels according to their isActive status. | string | Optional | Options are: all , true , false |
user | Returns channels in which the indicated user and the current user are found in. | ObjectId<COTUser> | Optional | |
userIsAdmin | Returns channels in which the indicated user is found in the groupOwnerIds | boolean | Optional | Must be used in conjunction with the user query parameter. |
directChannels | Returns channels according to their isDirect field which indicates whether a channel represents direct messages between two users or not. | string | Optional | Options are: all , true , false . |
modified | Returns channels with the indicated modification date in the modifiedAt field. | ISODate | Optional | YYYY-MM-DDTHH:mm:ss.SSSZ |
modified_gt | Returns channels modified after the indicated date and time. | ISODate | Optional | YYYY-MM-DDTHH:mm:ss.SSSZ |
modified_gte | Returns channels with a value in the modifiedAt field equal to or greater than the indicated date and time. | ISODate | Optional | YYYY-MM-DDTHH:mm:ss.SSSZ |
created | Returns channels with the indicated creation date in the createdAt field. | ISODate | Optional | YYYY-MM-DDTHH:mm:ss.SSSZ |
created_gt | Returns channels created after the indicated date and time. | ISODate | Optional | YYYY-MM-DDTHH:mm:ss.SSSZ |
created_gte | Returns channels with a value in the createdAt field equal to or greater than the indicated date and time. | ISODate | Optional | YYYY-MM-DDTHH:mm:ss.SSSZ |
created_lt | Returns channels created before the indicated date and time. | ISODate | Optional | YYYY-MM-DDTHH:mm:ss.SSSZ |
created_lte | Returns channels with a value in the createdAt field equal to or less than the indicated date and time. | ISODate | Optional | YYYY-MM-DDTHH:mm:ss.SSSZ |
debug | Adds the debug field with error notifications. | string | Optional | Option: true |
Request Samples
- cURL (default)
- cURL (query)
- Typescript (default)
This default request gets all the channels in the company.
curl --location --request GET 'https://www.cotalker.com/api/v2/channels' \
--header 'Authorization: Bearer $ACCESS_TOKEN'
This example uses the group query parameter to get channels within a group.
curl --location --request GET 'https://www.cotalker.com/api/v2/channels?group=61984c6f68a78ccc932d67f8' \
--header 'Authorization: Bearer $ACCESS_TOKEN'
This example gets all channels in the company.
// $ACCESS_TOKEN stored in .env file.
import { ChannelGetCollection, Configuration, V2ChannelsApi} from "@cotalker/cotalker-api";
const api = new V2ChannelsApi(new Configuration({
basePath: 'https://www.cotalker.com/api',
accessToken: process.env.ACCESS_TOKEN,
apiKey: 'true',
}));
async function getChannels(): Promise<ChannelGetCollection | undefined> {
const response = await api.getV2Channels();
return response.data?.data;
}
getChannels().then(channels => console.log(channels)).catch(e=>console.log(e))
Response Sample
Responses follow the COTChannel data model.
Get a Channel by Id
Returns the channel indicated by the Id.
GET /channels/{id}Endpoint URL
https://www.cotalker.com/api/v2/channels/{id}
Path Parameters
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
id | The ObjectId of the channel that is to be returned. | ObjectId<COTChannel> | Required |
Headers
Header | Description | Required | Values |
---|---|---|---|
Authorization | Sends your access token to make an API request. Click here to see how to obtain an access token. | Required | Bearer $ACCESS_TOKEN |
Query Parameters
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
debug | Adds the debug field with error notifications. | string | Optional | Option: true |
Request Sample
- cURL
- Typescript
curl --location --request GET 'https://www.cotalker.com/api/v2/channels/619648a6f27b4eb1a9e319ba' \
--header 'Authorization: Bearer $ACCESS_TOKEN'
// $ACCESS_TOKEN stored in .env file.
import { ChannelGetCollectionChannels, Configuration, V2ChannelsApi } from "@cotalker/cotalker-api";
const api = new V2ChannelsApi(new Configuration({
basePath: 'https://www.cotalker.com/api',
accessToken: process.env.ACCESS_TOKEN,
apiKey: 'true',
}));
async function getChannel(): Promise<ChannelGetCollectionChannels | undefined> {
const response = await api.getV2ChannelsId( { id: "619648a6f27b4eb1a9e319ba" } ); // ObjectId<COTChannel>
return response.data?.data;
}
getChannel().then(channel => console.log(channel)).catch(e=>console.log(e))
Response Sample
The response follows the COTChannel data model.
Create a New Channel
Creates a new channel within the company.
POST /channelsEndpoint URL
https://www.cotalker.com/api/v2/channels
Headers
Header | Description | Required | Values |
---|---|---|---|
Authorization | Sends your access token to make an API request. Click here to see how to obtain an access token. | Required | Bearer $ACCESS_TOKEN |
Admin | Grants administrative access to create a channel. | Required | true |
Content-Type | Indicates the body's format. | Required | application/json |
Query Parameters
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
debug | Adds the debug field with error notifications. | string | Optional | Option: true |
Request Body
Only required fields are listed below. For a complete schema description, please go to the COTChannel data model. Unrequired fields that are not submitted are either filled in automatically or left blank.
Element | Description | Type | Required | Notes |
---|---|---|---|---|
nameDisplay | The channel name users will see on the platform. | string | Required | |
nameCode | The channel's unique identification name. | string | Required | Maximum 60 characters; only lowercase letters, numbers, and underscores allowed; must be unique. |
Request Sample
Channel created with the minimum required fields:
curl --location --request POST 'https://www.cotalker.com/api/v2/channels' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"nameDisplay": "Maintenance",
"nameCode": "maintenance_channel",
"group": "619b8b9f026233d770d7ef0a"
}'
Response Sample
Go to COTChannel for a complete description of the response.
{
"_id": "619b8cf2107bbec0876cddf2",
"settings": {
"write": "all"
},
"videoCall": {
"start": {
"any": false,
"permissions": []
},
"isActive": false,
"duration": [],
"publishVideo": [],
"publishAudio": []
},
"propertyIds": [],
"userIds": [],
"groupOwnerIds": [],
"isPrivate": true,
"isDirect": false,
"isActive": true,
"pinned": [],
"bots": [],
"search": [
"maintenance",
"channel",
"maintenancechannel"
],
"nameDisplay": "Maintenance",
"nameCode": "maintenance_channel",
"group": "619b8b9f026233d770d7ef0a",
"company": "6136968b580aaf2b0e49d844",
"createdAt": "2021-11-22T11:52:26.975Z",
"modifiedAt": "2021-11-22T11:52:26.977Z",
}
Update a Channel
Updates or edits an existing channel's information.
PATCH /channels/{id}Endpoint URL
https://www.cotalker.com/api/v2/channels/{id}
Path Parameters
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
id | The ObjectId of the channel that is to be modified. | ObjectId<COTChannel> | Required |
Headers
Header | Description | Required | Values |
---|---|---|---|
Authorization | Sends your access token to make an API request. Click here to see how to obtain an access token. | Required | Bearer $ACCESS_TOKEN |
Admin | Grants administrative access to modify a channel. | Required | true |
Content-Type | Sets the body's format. | Required | application/json |
Query Parameters
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
debug | Adds the debug field with error notifications. | string | Optional | Option: true |
Request Body
Only the fields that are being updated or added are required to be put into the body. For a complete schema description, please go to the COTChannel data model.
Request Sample
Updating a channel's display name:
curl --location --request PATCH 'https://www.cotalker.com/api/v2/channels/619b8cf2107bbec0876cddf2?debug=true' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"nameDisplay": "Maintenance Report"
}'
Response Sample
Go to COTChannel for a complete description of the response.
{
"_id": "619b8cf2107bbec0876cddf2",
"settings": {
"write": "all"
},
"videoCall": {
"start": {
"any": false,
"permissions": []
},
"isActive": false,
"duration": [],
"publishVideo": [],
"publishAudio": []
},
"propertyIds": [],
"userIds": [],
"groupOwnerIds": [],
"isPrivate": true,
"isDirect": false,
"isActive": true,
"pinned": [],
"bots": [],
"search": [
"maintenance",
"channel",
"maintenancechannel"
],
"nameDisplay": "Maintenance Report",
"nameCode": "maintenance_channel",
"group": "619b8b9f026233d770d7ef0a",
"company": "6136968b580aaf2b0e49d844",
"createdAt": "2021-11-22T11:52:26.975Z",
"modifiedAt": "2021-11-22T11:52:26.977Z",
}