mv.teams
Teams of users. These methods are on mv.teams, where mv is your client (see the Node.js SDK). Each one returns the response object and throws when the API answers with an error.
create()
Section titled “create()”Create a team. Returns the new Team.
mv.teams.create(body: TeamsCreateData["body"], options?: RequestOptions): Promise<TeamsCreateResponse>POST /teams · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
body.name |
string |
yes | |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["Idempotency-Key"] |
string |
no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”Team:
| Field | Type | Description |
|---|---|---|
id |
string |
The team’s ID. |
object |
"team" |
Always team. |
livemode |
boolean |
true in live mode, false in test mode. |
name |
string |
— |
member_count |
integer |
Active members in the team. |
created |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const team = await mv.teams.create({ name: "Sales",});console.log(team);delete()
Section titled “delete()”Delete a team. Deletes the team. Its members stay in the organisation, in no team; queues that list the team no longer reach them through it.
mv.teams.delete(id: TeamsDeleteData["path"]["id"], options?: RequestOptions): Promise<TeamsDeleteResponse>DELETE /teams/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A team ID (team_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["Idempotency-Key"] |
string |
no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”DeletedTeam:
| Field | Type | Description |
|---|---|---|
id |
string |
A team ID (prefix team_). |
object |
"team" |
Always team. |
deleted |
true |
— |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const deletedTeam = await mv.teams.delete("team_7Hk2Lm9Qp");console.log(deletedTeam);list()
Section titled “list()”List teams. Returns a page of Team objects, newest first. Pass next_cursor as starting_after for the next page; the SDKs iterate every page for you.
mv.teams.list(query?: NonNullable<TeamsListData["query"]>, options?: RequestOptions): PagedList<TeamsListResponse["data"][number], NonNullable<TeamsListData["query"]>>GET /teams · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
query.limit |
integer |
no | How many objects to return, 1–100 (default 20). |
query.starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
query.ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”A PagedList: await it for the first page, for await it for every item.
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
for await (const team of mv.teams.list()) { console.log(team);}retrieve()
Section titled “retrieve()”Retrieve a team. Returns the Team object. Answers 404 with the code resource_missing when nothing has this ID in this organisation and mode.
mv.teams.retrieve(id: TeamsRetrieveData["path"]["id"], options?: RequestOptions): Promise<TeamsRetrieveResponse>GET /teams/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A team ID (team_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”Team:
| Field | Type | Description |
|---|---|---|
id |
string |
The team’s ID. |
object |
"team" |
Always team. |
livemode |
boolean |
true in live mode, false in test mode. |
name |
string |
— |
member_count |
integer |
Active members in the team. |
created |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const team = await mv.teams.retrieve("team_7Hk2Lm9Qp");console.log(team);update()
Section titled “update()”Rename a team. Changes only the fields you send. Returns the updated Team. Answers 404 with the code resource_missing when nothing has this ID in this organisation and mode.
mv.teams.update(id: TeamsUpdateData["path"]["id"], body: TeamsUpdateData["body"], options?: RequestOptions): Promise<TeamsUpdateResponse>PATCH /teams/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A team ID (team_…). |
body.name |
string |
yes | |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”Team:
| Field | Type | Description |
|---|---|---|
id |
string |
The team’s ID. |
object |
"team" |
Always team. |
livemode |
boolean |
true in live mode, false in test mode. |
name |
string |
— |
member_count |
integer |
Active members in the team. |
created |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const team = await mv.teams.update("team_7Hk2Lm9Qp", { name: "Sales",});console.log(team);