Skip to content

Funções de Grupo

Criamos a maneira mais fácil de criar grupos com Superchats

Criar Grupo

Crie um grupo com participantes

javascript
//name of group, array with number of contacts
let response = await client.createGroup("Name Group", ["556181590153", "5561981819855"])

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'create-group',
  groupId: "15815954040-1631239154"
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'create-group',
  message: 'message of erro'
}

Criar Comunidade

Crie uma comunidade

javascript
//name of community
let response = await client.createCommunity("Name Community")

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'create-community',
  groupId: "158159540401631239154"
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'create-community',
  message: 'message of erro'
}

Adicionar participantes

Adiciona participantes ao grupo

javascript
//id of group, array with number of contacts
let response = await client.addParticipantsGroup("15815954040-1631239154", ["556181590153", "5561981819855"])

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'add-participants-group',
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'add-participants-group',
  message: 'message of erro'
}

Adicionar Admins

Adiciona ou remove um admin

javascript
//id of group, array with number of contacts
let response = await client.addGroupAdmins("15815954040-1631239154", ["556181590153", "5561981819855"])
javascript
//id of group, array with number of contacts
let response = await client.removeGroupAdmins("15815954040-1631239154", ["556181590153", "5561981819855"])

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'add-group-admins',
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'add-group-admins',
  message: 'message of erro'
}

Alterar Nome do Grupo

Modifica o nome do grupo

javascript
//id of group, name group
let response = await client.groupTitle("15815954040-1631239154", "new name of group")

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'group-title',
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'group-title',
  message: 'message of erro'
}

Alterar Descrição do Grupo

Modifica descrição do Grupo

javascript
//id of group, name group
let response = await client.groupDescription("15815954040-1631239154", "description of group")

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'group-description',
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'group-description',
  message: 'message of erro'
}

Entrar em Grupo

Entra em um grupo especifico

javascript
//id of group
let response = await client.joinGroup("15815954040-1631239154")

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'join-group',
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'join-group',
  message: 'message of erro'
}

Sair de Grupo

Sai de um grupo especifico

javascript
//id of group
let response = await client.leaveGroup("15815954040-1631239154")

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'leave-group',
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'leave-group',
  message: 'message of erro'
}

Atualiza o link de um grupo especifico

javascript
//id of group
let response = await client.revokeGroupLink("15815954040-1631239154")

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'revoke-group-link',
  linkGroup: 'G3M81fQbuwDB2cuAdPIv0h'
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'revoke-group-link',
  message: 'message of erro'
}

Informações do Grupo

Retorna informações de um grupo especifico

javascript
//id of group
let response = await client.infoGroup("15815954040-1631239154")

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  type: 'info-group',
  status: 200,
  id: '15795662985-1631581942',
  owner: '15795662985@c.us',
  title: 'Teste Grupo Live',
  create: 1631581942,
  participants: [
    {
      id: '556181590153',
      name: 'Joe Dutra',
      short: 'Joe',
      isAdmin: false,
      isSuperAdmin: false
    },
    {
      id: '5521991977392',
      name: 'Israel - Fabrica de Sonhos',
      short: 'Israel - Fabrica',
      isAdmin: false,
      isSuperAdmin: false
    }
  ]
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'info-group',
  message: 'message of erro'
}

Modificar Configurações

Modifica configurações de um grupo especifico

Definir o envio de mensagens em grupo apenas para administradores

javascript
//id of group, type, boolean
let response = await client.setGroupSettings("15815954040-1631239154", "message", true)

Definir configurações de alteração no grupo apenas para administradores

javascript
//id of group, type, boolean
let response = await client.setGroupSettings("15815954040-1631239154", "settings", true)

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'set-group-settings',
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'set-group-settings',
  message: 'message of erro'
}

Get Groups List

Get all groups list

javascript
let response = await client.getGroups()

Retorno de sucesso

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 200,
  type: 'get-groups',
  chats: [
    { id: '5511982743910-1596072761', name: 'Venom Support' },
    { id: '556181590153-1625838636', name: 'Venom Business' }
  ]
}

Retorno de erro

javascript
{
  session: 'Marketing',
  device: "551152204957",
  status: 404,
  type: 'get-groups',
  message: 'message of erro'
}

All rights reserved to Orkestral LLC