@nsvsrk You can perform below steps:
1 - Add an approval step to the workflow
- Use a Participant or Process step that pauses the workflow and triggers sending an email.
- Persist the current work item id (or workflow instance id) and a short-lived secure token in JCR (/var/workflow-approvals/<token>) or in the workflow metadata so the link can be validated later.
2 - Build email with secure links
- Include two links (approve / reject) pointing to a Sling servlet endpoint, e.g.:
- Do not include PII. Use IDs and tokens only.
3 - Create a secure servlet to handle clicks
- Implement a Sling servlet (GET or POST) at /bin/wf-approval.
- Steps inside servlet:
- Validate token and ensure it maps to the expected workItemId and is not expired.
- Obtain a ResourceResolver with a service user (no end-user creds).
- Get a WorkflowSession from the ResourceResolver (via WorkflowService or adapt).
- Locate the WorkItem / WorkflowInstance by ID.
- Record the decision into workflow metadata or add a workflow comment (who, when, decision).
- Advance or complete the work item so the workflow continues down the correct transition (approve vs reject).
- Mark token used / remove it to prevent replay.
- Return a friendly confirmation page to the user.
4 - Update workflow state reliably
- Use the WorkflowSession API to modify workflow data or to complete the work item and select the correct outcome/transition so only the targeted work item moves forward.
- Ensure the servlet handles idempotency (multiple clicks) and logs actions.
5 - Security & best practices
- Use strong tokens, HTTPS, short expiry, and store tokens server-side.
- Perform authorization checks (ensure token matches workItem and intended user if applicable).
- Avoid exposing internal IDs if possible—use mapped reference tokens.
- Log actions and failures for audit.
6 - Testing & QA
- Test approve/reject flows, expired tokens, replay attempts, anonymous vs logged-in clicks, and error handling.
- Validate that the exact workflow instance/work item gets updated and that downstream steps trigger correctly.