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; //Any content settings that you would like to set. These are optional. content.country=Country.Australia; content.deviceType=Device.Desktop; content.sentimentType=Sentiment.Positive; 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 dialogueWiseService = new DialogueWiseService(); var response = await dialogueWiseService.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.