Capture CSAT response as button click on email (one click experience)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 12:59 AM
Hi,
We have a requirement to capture customer satisfaction feedback via email by having 3 smiley buttons on email body like (Satisfied, Neutral, Unsatisfied).
Once the ServiceDesk resolves an incident, a survey instance record gets created in "asmt_assessment_instance" table and user would receive an email notification to provide his feedback. On-click of one of the smiley the response should get captured and assessment record should be updated to completed status.
I tried using ServiceNow Table API concept.... however, there are 2 tables (asmt_assessment_instance & asmt_metric_result) to be updated on the response and challenge is table allow to perform action only on one table.
I built a scripted REST API and tested my API using rest API explorer that updates asmt_assessment_instance to completed status and asmt_metric_result with the actual value of the feedback response.... scripted REST API is working as expected in REST API explorer.
What I am not sure is, how to invoke the scripted REST API on button click in email? something like in the below screenshot (in my case, instead of number I would have 3 buttons as satisfied, neutral and un-satisfied)
how to have Button on email to fire the API call..... any light or tips is highly appreciated.
code generated by the REST API explorer to invoke my scripted REST API is as below....... how and where I should place this behind the button on email notification. (I assume, just by having endpoint url link behind the button would not work as it would not know what HTTP method to call and would not know what authentication details to use)......
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://.........................................................................................');
request.setHttpMethod('PATCH');
//Eg. UserName="admin", Password="admin" for this code sample.
var user = 'admin';
var password = 'admin';
request.setBasicAuth(user,password);
request.setRequestHeader("Accept","application/json");
var response = request.execute();
gs.log(response.getBody());
Thanks,
A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 03:54 AM
Why not just use an inbound email flow? Catch the email being send back and update both tables through one flow.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 04:26 AM
Hi, unfortunately NO..... our client wants to have one click experience where the feedback captured and API response popup saying "Thank you for your feedback". They don't wish to send inbound email and the proposal of inbound email flow was already turned down.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 04:37 AM
It's too bad that customers are allowed to dictate the 'how', instead of just doing what they are supposed to: tell what and why.
I think your way to go is to use unique url's for each response like:
https://your-instance.service-now.com/api/your_namespace/your_api/satisfied?sys_id={sys_id}
https://your-instance.service-now.com/api/your_namespace/your_api/neutral?sys_id={sys_id}
https://your-instance.service-now.com/api/your_namespace/your_api/unsatisfied?sys_id={sys_id}
The sys id would dynamically be replaced with that of the asmt_assessment_instance record.
Authentication needs to be done through API Keys (preventing user credentials being necessary). Set the API key in the request header or as URL parameter.
Apply the URL's to your smiley's so they are clickable buttons, linking to the correct ACL:
<a href="https://your-instance.service-now.com/api/your_namespace/your_api/satisfied?sys_id={sys_id}"><img src="path_to_satisfied_smiley.png" alt="Satisfied"></a>
<a href="https://your-instance.service-now.com/api/your_namespace/your_api/neutral?sys_id={sys_id}"><img src="path_to_neutral_smiley.png" alt="Neutral"></a>
<a href="https://your-instance.service-now.com/api/your_namespace/your_api/unsatisfied?sys_id={sys_id}"><img src="path_to_unsatisfied_smiley.png" alt="Unsatisfied"></a>
Parse the URL parameter do determine the feedback response, securely authenticate the request (since you are using API keys and update the relevant records in the tables.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 12:54 AM
Hi @Mark Manders ,
thank you very much for your kind response.
we tried using inbound email action flow initially and it proved not all the end user have there email configuration settings for “mail to” setup and most of them don’t know how to setup it… long story short, it was not feasible and would like have one click API experience to post the survey feedback.
regarding the API url’s is exactly we also planned to do (one small change was having it as a single url and passing the smiley value in the path parameter to update)
where I am stuck is, how do I specify the API operation (patch) to perform in the url link and how to specify API key in the url?
sorry I am new to API’s and any help would be greatly appreciated please…. I know about basic auth to use credentials, if we would like to create API keys, where should I do that in servicenow please.