Hello guys, welcome to the 37th session of using Microsoft Word framework Louise and cognitive services tutorials for beginners. In this session we will learn how to send a different response to different channels. It is a useful feature. As we know each tenant does not support all of these features such as for adding bold text in some channels, we can use HTML or in some we need to use markdown. So using these we can generate a different response to those two channels. It is not limited to text formatting, we can also attach each cards that are only supported by a specific channel.
For example, Facebook's flight card, we need to assign our data to channel data property of message activity. Channel data is dynamic property which can hold any kind of object. We need to create an object as called Jason payload data required by Tim Microsoft documentation contains various JSON examples for that. It also contains links to channels docs. So we can also learn and create more rich attachment as per requirement. I have created a new dialog for that and also updated it in message controller.
And the returned message from result. That is create a reply from a message dot channel ID. It contains the name of China. That is abbreviated Facebook Skyping like telegram, etc. It was a telegram then I'm going to send a speaker. Here is a payload data that required by telegram to create a speaker.
It includes the name of method that is done speaker and reading parameters past attachment data. Here I have used an image from TP that is copy this and escaping exports. If you perform this operation more frequently then you can also create a model and assign values to properties. But here I'm going to use Newton soft to deserialize the JSON data. Here is payload data example for slack. It includes tax and multiple attachments.
The first attachment contains a link as well as English. My second attachment only contains title and tax. You can also add files, folders etc. But in this example, I don't need this. Let us copy this and of course for these two Copy Paste case, change to slide and upgrade Jason string. Here is payload data example for the Facebook Messenger.
Here I have just added an image that is encoded and update JSON data. Create a default case and assign tax message that you want to display in your boat other than telegram slack and Facebook. At the end Sandy's reply to our poll. We need to publish those changes and as you can sign hi from telegram here we can see I have stickers as well Jason Primo data loggers check in slack Here we got title string, as well as two attachments first contains an image and another contains only title and type. And now I'm sending hi from emulator. Here we got a text message that we have specified in the default case.
Let us see what we have learned in this session. To send channel specific data we need to use channel ID to obtain channels based on reach perform the operation and assign custom payload data into channel data optimization. Here is the payload for telegram and Facebook. Here firstly and here is an example that we have. Thanks for watching this video. If you have any doubts, please feel free to contact me Have a nice day.