# Dynamic Carousel Action

This action will display a dynamically generated carousel based on standard Xenioo Action Model Json content from either a Url or a variable.

![](https://2532694803-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdPD9c4fJbXSAZcPHt9%2F-Lg39yo1ugXRpk3OpWzS%2F-Lg3A38tC4qCahiEib5J%2Fimage.png?alt=media\&token=968db208-221a-4f05-880b-fd7946b8c76e)

### Settings

The action uses the following settings:

| Setting                             | Description                                                                                              | [Parsed](https://docs.xenioo.com/actions-and-operations/dynamic-parsing) |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| Data Source                         | Select if the dynamic carousel data model will be downloaded from an Url or retrieved from a variable.   | :no\_entry:                                                              |
| Xenioo Action Model URL             | The Url from which the dynamic carousel data will be retrieved.                                          | :white\_check\_mark:                                                     |
| Xenioo Action Model Variable Source | The variable that holds the dynamic carousel model.                                                      | :white\_check\_mark:                                                     |
| Postback target variable            | The variable that will hold any postback command caused by postback buttons inside the dynamic carousel. | :white\_check\_mark:                                                     |
| Default Image Source                | The source of the default card image, if non is supplied inside the model.                               | :no\_entry:                                                              |
| Default Element Image               | The url of the image to be used as default card image.                                                   | :white\_check\_mark:                                                     |

### Remarks

The Dynamic Carousel Action will be activated by a very specific JSON model that represents the carousel cards and buttons. The model can be retrieved from an external source or from a [runtime variable](https://docs.xenioo.com/actions-and-operations/variables-and-tags).

The following source shows a brief sample of a complete dynamic carousel JSON:

```javascript
{
  "image_aspect_ratio":"horizontal",
  "items":[
      {
	        title: "Chevrolet Corvette",
	        subtitle: "Buy your Chevrolet Corvette!",
	        image_url:"https://someserver.com/corvette.jpg",
			view_size:"compact",
	        buttons:[
	          {
	              type:'postback',
		          payload: "buy_corvette",
		          text:'Buy Now'
	          },
	          {
	              type:'url',
		          url: "https://www.chevrolet.comr",
		          text:'Visit Website',
			      view_size:'full'
	          }
          ]
      }
  ]
}
```

The above items collection holds all of the different cards that will be created dynamically. \
The *view\_size* parameter can have the following values:

| Value   | Description                                                              |
| ------- | ------------------------------------------------------------------------ |
| compact | The web view will be about half the size of the available mobile screen. |
| tall    | The web view will cover most of the available mobile screen.             |
| full    | The webb view will be full screen.                                       |

The *image\_aspect\_ratio* parameter can have the following values:

| Value      | Description                               |
| ---------- | ----------------------------------------- |
| horizontal | The image will have a 1:1.91 aspect ratio |
| square     | The image will have a 1:1 aspect ratio.   |

Aspect ratio parameter is currently supported on on [Facebook Messenger channel](https://docs.xenioo.com/basic-concepts/publishing/channels/facebook).

The *type* parameter for each button can have the following values:

| Value    | Description                                                                                                                                                       |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| postback | Defines a [postback ](https://docs.xenioo.com/actions-and-operations/cards/additional-buttons/xenioo.bots.actions.base.operations.buttonpostbackoperation)button. |
| url      | Defines an [Url ](https://docs.xenioo.com/actions-and-operations/cards/additional-buttons/xenioo.bots.actions.base.operations.buttonurloperation)button.          |
| phone    | Defines a [Phone ](https://docs.xenioo.com/actions-and-operations/cards/additional-buttons/xenioo.bots.actions.base.operations.buttonphoneoperation)button.       |
| share    | Defines a [Share ](https://docs.xenioo.com/actions-and-operations/cards/additional-buttons/xenioo.bots.actions.base.operations.buttonshareoperation)button.       |

If no button type is specified Xenioo will display a postback button.

### Trigger

On Postback. This action will trigger any child operation as the user click any postback button.

### Variables

This action does not produce any variable.

### Availability

Channel specific availability follows the table below:

| Channel          | Availability        |
| ---------------- | ------------------- |
| Facebook         | Fully Available.    |
| WhatsApp         | **Not Available.**  |
| Telegram         | Fully Available.    |
| Web              | Fully Available.    |
| Alexa            | *Device Dependant.* |
| Google Assistant | *Device Dependant*. |
| Slack            | Fully Available.    |
| API              | Fully Available.    |

This action can be used only inside interactions and not as child of other actions. Any account can use this action regardless of [subscription level](https://docs.xenioo.com/basic-concepts/your-account/the-free-plan).


---

# 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.xenioo.com/actions-and-operations/cards/xenioo.bots.actions.base.dynamicgenerictemplateaction.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.
