# SlackBot

## Contexto

Muchas veces queremos recibir información desde nuestras aplicaciones a algún canal de Slack y para esto existe una [API](https://api.slack.com/) que nos provee diversas funcionalidades.

## Configuración

Para configurar un nuevo bot que interactue con nuestro workspace de Slack es importante seguir [esta guía.](https://api.slack.com/authentication/basics)

Y luego hacer pruebas desde rails con la gema [slack-ruby-client](https://github.com/slack-ruby/slack-ruby-client/blob/v0.17.0/README.md) .

## Posibles errores

Puede pasar que tu app esté bien configurada, pero que cuando intentes que el código mande mensajes o haga alguna acción, la request te entregue el siguiente error:

```javascript
Slack::Web::Api::Errors::MissingScope: missing_scope
```

Esto pasa porque no se han actualizado bien los scopes en el workspace, entonces Slack cree que tu app no tiene ningún permiso.

Para eso tienes que hacer Reinstall to Workspace como en la imagen:

![](/files/Ccdj3e13kNpa1YmUtp6e)

Y luego tiene que pedirte permiso para acceder al workspace como en la siguiente imagen:

![](/files/dpM8Tnb88aulsRhHAsfa)

Si no te aparece la segunda imagen te recomendamos agregar a alguien del workspace como colaborador, y que esa persona reinstale la app.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://la-guia.platan.us/setup/configuracion_de_proyectos/slackbot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
