Custom Templates
Heidi allows you to provide custom templates for your users. When providing custom templates as params to Heidi.open()
, you should follow this format:
Template
Attribute | Type |
---|---|
content | string |
responses | TemplateQuestion[] |
summaryRequired | boolean |
TemplateQuestion
Attribute | Type | Required | Comment |
---|---|---|---|
questionId | string | true | |
question | string | true | |
answer | string[] | false | No need for input request, the answer will be returned in structured data response |
answerType | AnswerType | true | Please refer to the enum below |
answerOptions | string[] | true | If AnswerType is TextArea or DateResponse, should be empty array; If AnswerType is SingleResponse or MultipleResponse, should be provided. |
dateFormat | string | false | If AnswerType is DateResponse, this field is required. Please provide the date format you want. E.G. YYYY/MM/DD |
AnswerType Enum
Attribute |
---|
'SingleResponse' |
'MultipleResponse' |
'TextArea' |
'DateResponse' |
TypeScript Interface
interface Template {
content: string;
responses: TemplateQuestion[];
summaryRequired: boolean;
}
interface TemplateQuestion {
questionId: string;
question: string;
answer: string[];
answerType: AnswerType;
answerOptions: string[];
dateFormat: string;
}
type AnswerType = 'SingleResponse' | 'MultipleResponse' | 'TextArea' | 'DateResponse';