# Envio de Imagens/Anexos/Vídeos/Áudios

É possível enviar mídias via JS, utilizando o modelo abaixo:

## Enviar Textos

```javascript
// Para enviar textos
var message_texto = {
   type: 'text',
   text: 'Muito obrigado, ' + user.first_name, //Envia a mensagem "Muito obrigado, @nome do usuário"
};
send_message.push(message_texto);
```

## Enviar Vídeos

```javascript
// Vídeo no Fluxo
let message_video = {
    type: 'media',
    mime_type: 'video/mp4',
    name: 'Nome Vídeo',
    url: 'URL Vídeo',
}
send_message.push(message_video);
```

## Enviar Imagens

```javascript
// Imagem no Fluxo
let message_foto = {
    type: 'media',
    mime_type: 'image/jpg',
    name: 'Nome Foto',
    url: 'URL Foto',
}
send_message.push(message_foto);
```

## Enviar Anexos

```javascript
// Arquivos no Fluxo
var message_pdf = {
   type: 'media',
   name: 'Nome PDF',
   mime_type: 'application/pdf',
   url: 'https://urldopdf.pdf'
};
send_message.push(message_pdf);
```

## Enviar Áudios

```javascript
// Áudio no Fluxo
var message_audio = {
   type: 'media',
   mime_type: 'audio/mpeg',
   url: 'https://urldoaudio.mp3'
};
send_message.push(message_audio);
```

## Envio de Excel

```javascript
// Excel no Fluxo
var message_excel = {
   type: 'media',
   name: 'Mobile App Quick Start',
   mime_type: 'application/xlsx',
   url: 'https://s3.amazonaws.com/cosmo-attachments/1671564193342-31903a96-d7ac-405a-aada-700082ff8e76-Planilha em D Downloads CHAT BOTS - Doc enviado por Abott.xls',
};
send_message.push(message_excel);
```

## Mime Types

{% tabs %}
{% tab title="Imagens" %}

* 'image/jpeg',&#x20;
* 'image/jpg',&#x20;
* 'image/png',&#x20;
* 'image/gif',&#x20;
* 'image/svg+xml',&#x20;
* 'image/webp',&#x20;
* 'image/bmp',&#x20;
* 'image/x-icon'
  {% endtab %}

{% tab title="Vídeos" %}

* 'video/mp4',&#x20;
* 'video/ogg',&#x20;
* 'video/webm',&#x20;
* 'video/x-ms-wmv',&#x20;
* 'video/x-flv'
  {% endtab %}

{% tab title="Áudios" %}

* 'audio/mpeg',&#x20;
* 'audio/ogg',&#x20;
* 'audio/webm',&#x20;
* 'audio/wav'
  {% endtab %}

{% tab title="Documentos" %}

* 'application/msword',&#x20;
* 'application/vnd.ms-excel',&#x20;
* 'application/vnd.ms-powerpoint',&#x20;
* 'application/pdf',&#x20;
* 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',&#x20;
* 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',&#x20;
* 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
  {% endtab %}

{% tab title="Compressão" %}

* 'application/zip',&#x20;
* 'application/x-rar-compressed',&#x20;
* 'application/x-7z-compressed'
  {% endtab %}
  {% endtabs %}


---

# 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://help.cosmobots.io/help/outros/exemplos-de-codigos-javascript/exemplos-de-codigos.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.
