References an Asset in CMS

  1. Upload an asset by entering sb-cli content upload-asset <alias> <file>. You will get a confirmation message as shown.
sb-cli content upload-asset myPuppy CutePuppy.jpg
Starting Upload CMS Asset command
Finished Upload CMS Asset command

An asset with the alias myPuppy has now been uploaded to ServisBOT and is stored in your account.

  1. Create content using sb-cli content create <JSON>. The JSON should be structured as follows:
{
  "Key": "Key",                           /*Required*/
  "Locale": "NiceName",                   /*Required*/
  "DisplayName": "online",                /*Required*/
  "Content": {                            /*Required*/
      "Type": "ContentType",
      "Value": "ContentValue",
  }
}

You should expect the following response if you successfully created using a JSON file (in this example the JSON file is called puppyCard.json):

sb-cli content create puppyCard.json
Starting Create CMS Content command
Finished Create CMS Content command

Below is the JSON file puppyCard.json. Notice how our asset, myPuppy, is called using {asset:myPuppy} instead of inserting the image URL.

{
  "Key": "puppyCard",
  "Locale": "en",
  "DisplayName": "cutePuppy",
  "Content": {
    "Type": "Markup",
    "Value": "<TimelineMessage><Card title=\"This is my new puppy\" imgUrl=\"{asset:myPuppy}\" /></TimelineMessage>"
  }
}
  1. To insert the content into your flow, login to portal in your bot’s designer page add a content node CMSClassicFlow.png

Make sure to double click on the content node and set Content Key to the same key you specified in your JSON file. In this example, the key is “puppyCard” EditContentNode.png

  1. Test your bot. The desired content should appear. puppyChat.png