I want to know if a chat widget (Guest chat API or widget version 2) is deleted, is there any API or any other way to restore it. OR If there is any way to know the date and time of its deletion? I did try to get details of the widget using widget get api passing deployment id but its returning 404 with no information of modification time. I'd like to get an answer for this as this concerns a major glitch that we might have to find ways to mitigate down the road.
There is no API to restore a deleted chat widget. You might want to open a ticket with our Care group to see if there is something the engineering team who owns the API can do.
One thing you can do is look at using the CX as Code export functionality to take a daily snapshot of your widget configuration. CX as Code is not a full backup and recovery platform, but its export functionality might help you solve this specific problem. The CX as Code home page is located here. The documentation on the export functionality is located here.
Remember though, CX as Code can dump your Genesys Cloud configuration out in JSON or HCL (and only for the components currently supported by CX as Code). It is still your responsibility to recover the data either using the API or terraform.