Skip to content

CCM-22090: Recipient response message retrieval API - #1090

Open
rhyscoxnhs wants to merge 16 commits into
releasefrom
feature/CCM-22090
Open

CCM-22090: Recipient response message retrieval API#1090
rhyscoxnhs wants to merge 16 commits into
releasefrom
feature/CCM-22090

Conversation

@rhyscoxnhs

@rhyscoxnhs rhyscoxnhs commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds proxy configuration for new recipient response message retrieval API.

Reviews Required

  • Dev
  • Test
  • Tech Author
  • Product Owner

Checklist

  • Brief description of work completed, and any technical decisions made as part of the PR
  • PR link added as a comment to the relevant JIRA ticket
  • PR link shared on Slack and/or Teams
  • 2 reviews received
  • Tester approval

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

cgitim
cgitim previously requested changes Aug 10, 2026
Comment thread proxies/shared/policies/ExtractVariables.MessageResponses.Get.Request.xml Outdated
Comment thread proxies/shared/policies/AssignMessage.MessageResponses.Get.Request.xml Outdated
Comment thread sandbox/handlers/message_responses.js Outdated
Comment thread specification/documentation/APIDescription.md Outdated
Comment thread specification/documentation/GetResponses.md Outdated
Comment thread specification/schemas/components/ResponseItem.yaml Outdated
Comment thread specification/responses/2xx/200_Responses.yaml Outdated
Comment thread specification/communications-manager.yaml Outdated
Comment thread sandbox/handlers/message_responses.js Outdated
Comment thread specification/schemas/responses/GetResponsesSuccess.yaml Outdated
@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@rhyscoxnhs
rhyscoxnhs requested a review from cgitim August 12, 2026 10:44
Comment thread specification/documentation/GetMessageResponses.md
Comment thread specification/documentation/GetMessageResponses.md Outdated
Comment thread specification/responses/4xx/message_responses/422_TooManyResponses.yaml Outdated
Comment thread specification/endpoints/get_responses.yaml Outdated
Comment thread specification/responses/4xx/message_responses/400_UnableToGetResponses.yaml Outdated
Comment thread specification/schemas/enums/ErrorTooManyResponses.yaml Outdated
Comment thread sandbox/handlers/message_responses.js
Comment thread specification/documentation/APIDescription.md Outdated
Comment thread tests/sandbox/message_responses/test_success.py Outdated
@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@rhyscoxnhs
rhyscoxnhs requested a review from mjewildnhs August 14, 2026 13:37

@mjewildnhs mjewildnhs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've paused reviewing until we get an answer on whether we should be following the JSON:API convention as per my review comment.

Comment thread specification/endpoints/get_responses.yaml
@mark-r-bjss

Copy link
Copy Markdown
Collaborator

After a team discussion we decided that

  1. It would be best to align the response more closely with existing API responses by adding in a data object wrapper and listing the items within.
  2. To stick with a 500 response if there are too many responses found for the messageId as this is an unexpected real-world scenario.
  3. To extract the repeated fields messageId and messageReference into the new data wrapper.
  4. To sort the patient-responses so that the API produces consistent responses for the same query as this would make testing easier.

@rhyscoxnhs

Copy link
Copy Markdown
Collaborator Author

One revision to the above - since JSON API mandates specific fields for the data wrapper, we can't extract messageId and messageReference out of the attributes object, the only valid fields in the data wrapper are id, attributes, links, relationships and type.

@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@rhyscoxnhs

Copy link
Copy Markdown
Collaborator Author

Migrated to JSON:API

@mjewildnhs mjewildnhs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not finished yet but posting feedback I have.

Comment thread specification/documentation/GetMessageResponses.md Outdated
Comment thread specification/responses/4xx/415_UnsupportedMedia.yaml
Comment thread specification/endpoints/get_responses.yaml
Comment thread sandbox/handlers/message_responses.js Outdated
Comment thread sandbox/handlers/message_responses.js Outdated
Comment thread sandbox/handlers/message_responses.js
Comment thread sandbox/handlers/message_responses.js Outdated
@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@rhyscoxnhs
rhyscoxnhs dismissed cgitim’s stale review August 24, 2026 07:26

Requested changes have been addressed

const tooManyResponsesMessageId = '00000000-0000-4000-8000-000000000500';
const supportedContentTypes = ['application/json', 'application/vnd.api+json'];

export async function messageResponses(req, res, next) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow on from one of my previous comments: #1090 (comment)

Looking at this again I've got this wrong.
I think the sandbox will use the proper proxy config so which will transform error responses based on the rules.
So we should return error responses in line with what our app actually does.
If we can get the deployment working and APIM access we can properly test this. I was testing against the sandbox directly and there isn't a way to locally deploy the full sandbox API consumers will see.
Let's leave this unresolved for now until we are happy with the error responses app-response returns and we can test the properly deployed sandbox.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed feedback - reverted to simple responses for the responses that are unconditionally overwritten, and preserved the ones that aren't.

Comment thread specification/responses/4xx/415_UnsupportedMedia.yaml
from lib.fixtures import * # NOSONAR


@pytest.mark.devtest

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a bit of a shame we can't test this in other environments.
e.g. get_message runs its tests in all envs
However it can create messages to then get.
We don't have a way to create a response so I guess we are stuck with dev only test which I think is against the sandbox. This does risk things breaking in prod on APIM releases.

Might be worth discussion with @cgitim

@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

Comment thread proxies/live/apiproxy/targets/target.xml Outdated
@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

Comment thread sandbox/__test__/message_responses.spec.js Outdated
Comment thread proxies/live/apiproxy/targets/app-response-target.xml
Comment thread sandbox/handlers/message_responses.js Outdated
Comment thread specification/schemas/responses/RecipientResponse.yaml
@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

Comment thread proxies/shared/partials/Partial.Flows.GetMessageResponsesEndpoint.xml Outdated
@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@mjewildnhs

Copy link
Copy Markdown

Happy with the changes.
Leaving approval off as I suspect further changes to get the build/tests working when app-response routing resolved.
One outstanding comment is around tests which we'll have a bit more clarity on when we get things working.

@mark-r-bjss mark-r-bjss left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, in that I can't see any issues but it's very hard to follow what's going on with these XML files and we will be relying heavily on the testing to find any issues. Also worth ensuring that somebody with experience in this area reviews this.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants