In the continuation of my last post "integration with Survey Monkey through Zapier".
I had another requirement to implement a customization to directly call the external API of Survey Monkey from Maximo.
Below are the 2 steps procedure, first is the list of APIs we are going to call in a sequence from Maximo Automation Script, and then the detail code I used.
Prerequisites:
- Survey Moneky Account, Token
- Design Survey and enable "Embed First Question" in the Email
- Create an Email collector
- Get the id of the newly created Email Collector
A. Three APIs we are going to call for this project from Automation Script:
- https://api.surveymonkey.net/v3/collectors/{{COLLECTOR_ID}}/messages
- {"type": "invite","subject": "Survey for the Ticket {{myextrafield}} {{CustomData1}}","is_branding_enabled": true,"embed_first_question": true}
- https://api.surveymonkey.net/v3/collectors/{{COLLECTOR_ID}}/messages/{{MESSAGE_ID}}/recipients
- { "email": "abdulqadeer.el@gmail.com", "custom_fields": { "1": "c1"}, "extra_fields": { "myextrafield": "1234" } }
- https://api.surveymonkey.net/v3/collectors/{{COLLECTOR_ID}}/messages/{{MESSAGE_ID}}/send
- { }
B. Jython code can be implemented on any object, for testing I am using SR object before-save trigger.