# Use @Format

## Use formats

### Quick response

Show quick answers like this:

```typescript
@Event('start')
start() {
    @Format('quickReplies', ['yes', 'no'])
    > Continue ?
    Prompt()
    > Ok !
}
```

### Carousel

Here's how to display a carousel:

```typescript
@Event('start')
start() {
    @Format('carousel', [
        {
            title: 'TITLE',
            subtitle: 'SUBTITLE',
            image: 'URL_IMAGE',
            buttons: [
                {
                    url: 'URL',
                    title: 'TITLE BUTTON'
                }
            ]
        }
    ])
    > Continue ?
}
```

### Display an image

```typescript
@Event('start')
start() {
    @Format('image', 'http://url.com/image.png')
    > Nice picture !
}
```

### Send text with buttons

```typescript
@Event('start')
start() {
    @Format('buttons', [
        {
            title: 'An url',
            url: 'https://google.fr'
        },
        {
            type: 'postback',
            title: 'Postback'
        }
    ])
    > Buttons
}
```

### Webview

1. Create an `webviews` folder at the root of the project
2. Put an HTML file (eg `webviews/map.html`)

```typescript
@Event('start')
start() {
    @Format('webview', {
        url: '/webview/map.html', // required
        button: 'View map', // for other platforms,
        fbHeight: 'full', // compact, tall or full (only for Messenger)
        height: 600 // in pixels, only for chatbox
    })
    > Ok, here is the webview
}
```

#### Share button

On Facebook Messenger, NewBot ChatBox and Twitter, we can share content with the following code

```typescript
@Event('start')
start() {
    @Format('buttons', [
        {
           type: 'share'
        }
    ])
    > Buttons
}
```

**On Twitter**

On Twitter, let's add the `tweet` property:

```typescript
@Event('start')
start() {
    @Format('buttons', [
        {
           type: 'share',
           tweet: {
               text: 'Partagez-moi',
               url: 'https://newbot.io'
               via: '@me',
               hashtags: ['one', 'two']
           }
       }
    ])
    > Share
}
```

* `tweet.text` (required): Text in the tweet
* `tweet.url` (optional): Url to share
* `tweet.via` (optional): User Profile to Share
* `tweet.hashtags` (optional): Embed Hashtags

### Show a video

```typescript
@Event('start')
start() {
    @Format('video', 'http://url.com/video.mp4')
    > Nice video !
}
```

### Send a contact

```typescript
@Event('start')
start() {
    @Format('contact', '0123456789', 'Sam R')
    > Here is my friend !
}
```


---

# 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.newbot.io/conversescript-syntax/the-decorators/use-format.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.
