# Slack

Este tutorial le ayuda a conectarse mediante la API de Slack para enviar mensajes desde Flow Studio. Para ello, necesita ser administrador del espacio de trabajo de Slack y poder editar las integraciones de la API.

El primer paso es ir a <https://api.slack.com/apps> y crear una nueva aplicación desde cero.<br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfo0mIh0A-egSgsqUepU1GIj42SsZWpzyPgcY-iVGNl3VYzA31Dlxy3icBffdXe3DKIsAQAzrOp84nhuLYor7YwzuVzZdUqYikrB3hdmbGOfmG_SHLXNsh-2chqnkqK2pN7mxnBFw?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXd2OkMaKX9kfVzJ1fJUlUrgvd34fSTbqKnVsWtdTqEVeEReSQCriZs92NCTYt6Lp1xknXqPtphXvlnTUQW6yGSWqLyRyPwoz_DklEqvmlf4LP47RvZGbBfx0_L06sEWsTta-IUj5A?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfL9exJBgiU8h0_o3d3m7ro_eR5UDKvTqLFqFdsIZJMdnJ4GrqUgGhOJr49k8xtvvwxttMJcSSn1IX1c-w6X8n9kwqnHJBk9CK_UYvIyX49WgPipWLG6VoQlQaUcfYdT6AAayMmdQ?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

Esto creará la nueva aplicación donde podrá configurar todos los componentes visuales de la integración para asegurarse de que el nombre que aparecerá en cada mensaje y la imagen sean los correctos.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcqL3nhNrvhuXWXdwIfepoZIpg-D4RM8RzlQDmCWcmqTxanBmYY5Fb_Fl8sc6LIM8OQPz0gTBYTh2LPGaEtveKXfqs3lB-yl7BRBnAdJ9HNgc9SX-T_rHX-P9ivQTCrlGI_m_ZvNg?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

Es importante tener en cuenta que el primer paso que debe realizar es agregar los permisos y ámbitos para poder enviar mensajes a través de la API.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfysA6e7Sp2tdsUV1Ta0stqNKBd7T_Wg1UhKBSX-J8qVp_oqujY-ZEoLvCGk_G43wKmbFguWeO91fezDJHs1u__M7VmiUmoHLnjPvdtXnUMp3lce49fQKUvRZWOoqA5ZWsidyNQ?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeSd2CDOdlXE2ZS8-5WCAdh1ZRRfTraEAzdx6zU3DR0vOHkGdtzcLCegj_priUj3NTVthdcuwH4BuP69VjA2YjfnY1ruh24AhUS4Sh1gv1D0a7Yd_0KYC6AfcDNXFYak6hEqGR21A?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcTJ-1YJOvjAfIy4zFnWSxKCIf0DujICf0Bs3oHgAisakmQYHzSCNyJAo1sbT4HajcVPbjZpzqdVkjZUPC_VD7XdOf7Sc4QTgAD8VgrU_IMkPKfXpykssc_vdtmAiKrxVFopbcH?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

Para enviar mensajes, el ámbito más importante es "chat:write", pero puede añadir los que considere necesarios.

Una vez configurados los ámbitos, puede proceder a instalar la aplicación en su espacio de trabajo.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcbKUMnWl2sUy2k263GRfylAQlC7oXQZMrbJDDdQ4y5os517zgo7v3FuP3KFpFfQJtWwpVHyNseswxK_PIu4cLLpe_cOtVcLjpF-DWOlugqGVrDqNGc-Kd_xvk41-93BMn6SqYKTw?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXe3ymRNRc8NQcwQAASerpZ7gL9wGuaZuyLMSLTwxSHOZWGuBI4S9bvwUvnicKbfXIFbuvK3qmBdCkrGIKO0KsL73uaXkHt5SbeHSHdfWOJtlpeFmrlPspUN0Shzgtx6iB7udlJgGw?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdytmVmS8inp-2kqK0EnWFJMC8u9C723sDL4LR2VX4H0QoGcDRMHb7wxHD77INgxoeOuPnJmhj-GcmITKcQFak3fTRG6pSB0IDpHzmhgt_W7y7dVDbdDyJLf1QeuS8z7R4FW7gQpw?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

Esto generará su "Token OAuth de Usuario Bot", que es la clave para enviar mensajes desde la API de Slack.

Una vez que tenga este token, debe invitar a la aplicación al canal donde quiere que se envíen los mensajes. Para ello, vaya al canal, escriba "/invite" y seleccione la opción para añadir aplicaciones al canal.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdduR2UgQr_lWt42q9Hsf5wooKk25TQZ2lEGdh-C5mSbWHz_PJ_CtqeQuyN8i6R2ruuSSmbqVsaj-qcBN0_H12sUZzyrcxeWB7QRr3CGe-aqzjVpX5twZdce7SY0sFo7AtZxR3m?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdduR2UgQr_lWt42q9Hsf5wooKk25TQZ2lEGdh-C5mSbWHz_PJ_CtqeQuyN8i6R2ruuSSmbqVsaj-qcBN0_H12sUZzyrcxeWB7QRr3CGe-aqzjVpX5twZdce7SY0sFo7AtZxR3m?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfSGSHFnVkquKbWtdAWZlelyaePHW-dANZ9ikH34WDWACXQZP93RLP6n8ZNkeOrk1FoJWDw0FGRQFLKacavVI0Eq0yMMMQH8dXRNHgyWoOfy921KGtnuuhkEkJiBer39nXEEiCapA?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

Una vez configurado, necesita obtener el ID del canal. Para obtenerlo, inicie sesión en Slack online, acceda al canal y obtenga la URL. Este ID se encuentra entre el final de la URL y la última barra. En este caso, el ID sería C08PU07PY5R.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdjv8bScJDfibeZ98GHejb03lSVSqor8IG5Vju-dDS7yH_Qf3FsrXAVMqWB1B33R1ahpA6hn8HggJ9-lCR1kbTP5sf194naqIexgp3WUKQhXoImEJsh0SruvZLrJn4DpPw5Rn1Eeg?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

Ya estamos listos para enviar el mensaje mediante la API de Dapta.

Vaya a la sección Flow Studio y cree un nuevo flujo. A continuación, agregue un nodo API.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfxUUBAJmPtiSR0jfAM1ZM__6ONAU7JqX9_Czh9WinBOyMEVLvIwCGb6mc90TDv3zo6f5ka1tEouQOH9Lf2Zxxx3qm6lPEueyJEDUVZeeXpiRO-B_iG4KmRVQ8tHj4NYDm-u5qQZA?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

En la API, asegúrese de agregar esta URL y configurarla como método de publicación: <https://slack.com/api/chat.postMessage>. Ahora, vaya a la pestaña Encabezados y agregue un encabezado para "Autorización". Escribe "Portador" y el valor del token obtenido de la página de la API de Slack.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXd98H7Mhq0t9cKOLFqEE_bfbdfbQsa-MZIB78j216EPnteqFxKn7WCkgQKciguG716pK4YNw-TfvylCsqvEN1DyhcnRVn0AJp0K1taxhYPRZMBiMUJ7Sh6hAnhth4I65CX3VDfLKA?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

Ahora vaya a la pestaña Cuerpo, pegue el ID de su canal y configure el mensaje que desea enviar.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXe0lFacOwFIFiGJvfOBB6koFUvUSE3SJvxijKL-teSaAir6V41m_QInn18RjtGF-L_wuh76CWw12m3mMHsky3uQTPpkLCWOzgGu9dVn1cm9q9dCMLgLWvjyedcxFg5QvASeOub8VQ?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXclhGdeB3MDeLqvn0LGDQM8kGmpJJqo6Mt3qVr9okx0Wety3V-aiW6iyCPw4bc-wrI2G9WF8mMTaQPmGSA4gTsfRE3RTUFNrNV8q_3jTy92fHI2vtBCzgERfR8bOsydtJq1fm1T?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

¡Listo! También puede cambiar el ícono y el nombre de la aplicación desde la Información básica si quiere que su integración tenga un aspecto más dinámico.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfoVwTlI3mhVdgy-d8qISCcOH1_65AUpSs-H3L0BwQn6aeZcebPC8X1AbeQtoV2J6vkcU6b5VyRI1Bt1OvbWqyIrCVddobuvVojv5lTDQleIpkdb2DFP0ZpUIFMgCgFBZE3s4OIag?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeXVWysjsqx5UsX-BbrcuoTs1iPGbdhbngyYrNj85_wiVz-CVrjQwDWhfCKTb9vzTOY9r3pp0rriYS4Hkv4Q3gQnnZOkJmEQ14EQhwGrtxFum0LxFWB0tNq6vcfteO2akPyVSv93Q?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXflrPfdAfemoK1owme0NYqI1pKOwXawHnkURBmOQwUHSlKHxpfOq_QskWTCSXM7u_1UV1_Xz4l2RCqMoJi9mPpv2SBYADZKz9iokujHluoJfXHbsiWeo7_7haariCaUru2oxmqePw?key=WOBNB_rJfOlCxAUb1kQyYCgN" alt=""><figcaption></figcaption></figure>


---

# 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://docs.dapta.ai/dapta-docs-es/integraciones/slack.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.
