# Dynamic Content Action

This action will display dynamic chat elements by downloading a standard Xenioo Action Model JSON from any URL or translating it directly from any conversation variable.

![](https://2678899722-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdPD9c4fJbXSAZcPHt9%2F-LgqKeZUov_0n9IWSMAr%2F-LgqKoNL_y8lgwn9z-yd%2Fimage.png?alt=media\&token=c40a24b4-5667-43b5-9803-b75637f58c92)

### Settings

The action uses the following settings:

| Setting                             | Description                                                    | [Parsed](https://docs10.xenioo.com/actions-and-operations/dynamic-parsing) |
| ----------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------- |
| Xenioo Action Model URL             | The Url from which the dynamic content data will be retrieved. | :white\_check\_mark:                                                       |
| Xenioo Action Model Variable Source | The variable that holds the dynamic content model.             | :white\_check\_mark:                                                       |

### Remarks

The Dynamic Content Action data model is similar to the [Dynamic Carousel Action](https://docs10.xenioo.com/actions-and-operations/cards/xenioo.bots.actions.base.dynamicgenerictemplateaction) one (which is actually using a subset of it). Two more object types are added to extend this action support for [Text ](https://docs10.xenioo.com/actions-and-operations/content/xenioo.bots.actions.base.textaction)and [Buttons Cards](https://docs10.xenioo.com/actions-and-operations/cards/buttons-card-template-action).

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

```javascript
{
  "items":[
      {
      		"type":"text",
      		"text":"hello there!"
      },
      {
      		"type":"carousel",
	        "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.com",
			"text":"Visit Website",
			"view_size":"full"
	          }
          ]
      }
  ]
}
```

The content *type* field values currently supported are text, carousel and buttonscard.

The model also accept both [Variables and Tags](https://docs10.xenioo.com/actions-and-operations/variables-and-tags) injection so that your remote service can also push specific values inside the chatbot runtime automatically. The injection happens with the same model used by [On Demand Broadcast](https://docs10.xenioo.com/broadcast/scheduling/basic-settings/on-demand) and, extending the previous example, may look similar to the following:

```javascript
{
  "items":[
      {
      		"type":"text",
      		"text":"hello there!"
      },
      {
      		"type":"carousel",
	        "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.com",
                        "text":"Visit Website",
                        "view_size":"full"
	          }
          ]
      }
  ],
  "variables":[
  		{
                    "name":"user_data",
                    "value":"some variable value",
                    "mode":0
  		}
  ],
  "tags":[
  		{
  	            "name":"VIP_USER",
                    "mode":0
  		}
  ]
}
```

The mode setting for variables and tags may have one of the following values:

| Value | Description                                                                                                                                                                                    |
| ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0     | Replace. The current value is replaced by the given value                                                                                                                                      |
| 1     | Append. The given value is [appended ](https://docs10.xenioo.com/actions-and-operations/profile/xenioo.bots.actions.base.setvariableaction)to the current value. This is not supported by tags |
| 2     | Delete. The value and the associated tag or variable and deleted from the current runtime instance.                                                                                            |

### Trigger

This action has no triggers.

### Variables

When carousel or buttons card content is used, this action will produce the following variables:

| Variable      | Description                              |
| ------------- | ---------------------------------------- |
| last\_command | Contains the last clicked button payload |

### Availability

Channel specific availability follows the table below:

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

This action can be used only inside interactions and not as child of other actions. This action requires a [Premium Account](https://docs10.xenioo.com/basic-concepts/your-account/upgrading-from-free) to be used on a live chatbot.
