Update content

To update existing content, you need to first prepare the UpdateContentRequest request.

var request = new UpdateContentRequest();
request.Slug = '[Your Slug]';
request.ApiKey = '[Your API Key]';
request.EmailHash='[The hash of your email]';

Then add the existing fields and their corresponding updated contents.

var fieldList = new List<Field>();
var field = new Field();
field.Name='[Name of field 1]';
field.Value='[Content for field 1]';
fieldList.Add(field);
.
.
.
field = new Field();
field.Name='[Name of field n]';
field.Value='[Content for field n]';
fieldList.Add(field);

var content = new Content();
content.Fields = fieldList;
content.Id = "[The content id]";

//Any content settings that you would like to set. These are optional.
content.Settings = new ContentSettings 
{
    Country=Country.Australia,
    DeviceType=Device.Mobile,
    SentimentType=Sentiment.Positive
};

request.Content = content;

Once all the fields and their corresponding contents are added, we then need to call the UpdateContent method using this payload.

var dialogueWiseClient = new DialogueWiseClient();
var response = await dialogueWiseClient.UpdateContent(request);

That’s it! You will now get a response of type DialogueWiseResponse which will indicate if your content was added successfully.

Please note, all the contents that are updated will be saved as a draft version. You will need to deploy your Dialogue for it to be available. To understand further, please have a look at Deploying your Dialogue.