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.country=Country.Australia;
content.deviceType=Device.Desktop;
content.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 dialogueWiseService = new DialogueWiseService();
var response = await dialogueWiseService.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.