Add contents

Using our SDK you can easily add content to your dialogue. This gives you the benefit of creating new content directly from your app. First, you need to prepare the AddContentsRequest request payload and the first part of this is to set your Slug, API key and Email hash.

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

We then add the fields and their corresponding 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 contentList = new List<Content>();
var content = new Content();
content.Fields=fieldList;
contentList.Add(content);

request.Contents=contentList;

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

var dialogueWiseClient = new DialogueWiseClient();
var response = await dialogueWiseClient.AddContents(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 added will be added 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.