department-of-veterans-affairs / notification-api

Notification API
MIT License
16 stars 8 forks source link

GA4 Migration: Create GET endpoint to accept open email tracking data #1853

Closed MackHalliday closed 2 months ago

MackHalliday commented 3 months ago

User Story - Business Need

We need to create a GET endpoint to accept GET requests (pixel tracking) embedded in opened emails. This endpoint should extract the different values from the GET request. In a later user story, we'll use the extracted data and pass the data along to GA4. This user story focuses exclusively on creating the GET endpoint.

User Story(ies)

As a VA Notify Developer I want to create a GET endpoint that extracts information from the GET request embedded in an opened email So that we can capture the necessary data for tracking email opens.

Additional Info and Resources

Engineering Checklist

Acceptance Criteria

QA Considerations

Out of Scope

mjones-oddball commented 3 months ago

Hey team! Please add your planning poker estimate with Zenhub @cris-oddball @EvanParish @k-macmillan @kalbfled @MackHalliday @mchlwellman

kalbfled commented 2 months ago

The query parameters are logged many times because they are part of the URL, but I'm not sure that I'm seeing the output of the dedicated logged call I wrote in the route handler. I will wrap this up in the morning.

kalbfled commented 2 months ago

I found the relevant logging statement. This is the HTTPie command I used to test endpoint:

http https://dev-api.va.gov/vanotify/ga4/open-email-tracking campaign==hi campaign_id==e774d2a6-4946-41b5-841a-7ac6a42d178b name==email_open source==vanotify medium==email content=='test/e774d2a6-4946-41b5-841a-7ac6a42d178b/e774d2a6-4946-41b5-841a-7ac6a42d178b'

You could also use cUrl or a browser to do the same thing.

cris-oddball commented 2 months ago

PR Approved and merged, will deploy to Perf bu no farther until I discuss with the team about sending all 3 PRs up as a feature package to Prod instead of dripping them out.

cris-oddball commented 2 months ago

awaiting second PR and putting this under automation.

cris-oddball commented 2 months ago

Second PR approved and merged and sent via pipeline to Perf.

cris-oddball commented 2 months ago

QA PASSED

since the route and query parameters are encoded as a string, not testing for strings that are not string, since it will be sent as a string anyway.

Putting the route under automation.

cris-oddball commented 2 months ago

error response for the above test cases:

{
    "errors": [
        {
            "error": "ValidationError",
            "message": "'hello' is not a 'uuid'"
        }
    ]
}

{
    "errors": [
        {
            "error": "ValidationError",
            "message": "'email_open' was expected"
        }
    ]
}

{
    "errors": [
        {
            "error": "ValidationError",
            "message": "'vanotify' was expected"
        }
    ]
}

{
    "errors": [
        {
            "error": "ValidationError",
            "message": "'email' was expected"
        }
    ]
}

{
    "errors": [
        {
            "error": "ValidationError",
            "message": "'foo' does not match '^[^/]{1,255}/[0-9a-zA-Z-]{36}/[0-9a-zA-Z-]{36}$'"
        }
    ]
}

{
    "errors": [
        {
            "error": "ValidationError",
            "message": "'foo/foo' does not match '^[^/]{1,255}/[0-9a-zA-Z-]{36}/[0-9a-zA-Z-]{36}$'"
        }
    ]
}

{
    "errors": [
        {
            "error": "ValidationError",
            "message": "'foo/foo/bar' does not match '^[^/]{1,255}/[0-9a-zA-Z-]{36}/[0-9a-zA-Z-]{36}$'"
        }
    ]
}
cris-oddball commented 2 months ago

Writing automation, but closing this ticket since Evan, Dave and I decided to just go ahead and release this today rather than wait for the other two PRs that complete this feature. This will be a Minor version bump to 1.9.0 and then the next two PRs will be patch bumps to complete the feature.

This is definitely something we want to brainstorm as a team for the next time this happens.