Recent searches
No recent searches
Update custom fields in the widget at runtime using ZenDesk API
Posted Jun 08, 2021
I'm attempting to update the zendesk widget at runtime using data I've loaded asynchronously from a server. I can initialize the values of the custom fields, but at runtime I'm only able to update the name and email address.
- Is it possible to update a custom field post-initialization
- What is the correct syntax for the payload.
I am using a react package to call the API. https://www.npmjs.com/package/react-zendesk
The example I tried is listed below
API Call
ZendeskAPI('webWidget', 'prefill', test);
Payload
var test =
//{ id: '360044430071', prefill: { '*': '1. This is prefilled session text' }};
{
name: {
value: 'isamu',
readOnly: true // optional
},
email: {
value: 'isamu@voltron.com',
readOnly: true // optional
},
‘360044430071’: {
value: '9a74b148-35ed-4f41-afc5-d9f3301ea180',
readOnly: true
}
}
0
1 comment
Leon Pryor
The solution is to call the api using "updatesettings" and pass in the data structure you use for initialization. The "prefill" command doesn't seem to actually work for anything other than name and email. This is something you should probably document for other users.
1