%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#1e1e2e'}}}%%
flowchart TD
A([Start]) --> B[Parse Event Body]
B --> C{api_url present?}
C -->|No| D[Return 400 Error]
C -->|Yes| E[Fetch External API]
E --> F{API Response OK?}
F -->|No| G[Throw Error]
F -->|Yes| H[Compute JSON Hash]
H --> I[Get Last Hash from DynamoDB]
I --> J{Item exists?}
J -->|No| K[Store New Hash\nSet mutation flag=true]
J -->|Yes| L{Hash Changed?}
L -->|No| M[Set flag=false\nMetric: NoChange]
L -->|Yes| N[Update Hash\nSet flag=true\nMetric: HashChanged]
K --> O{Mutation needed?}
N --> O
M --> O
O -->|flag=true| P[Execute Mutation\nMetric: MutationInvoked]
O -->|flag=false| Q[Skip Mutation]
P --> R[Return 200\nchanged: true]
Q --> S[Return 200\nchanged: false]
G --> T[Log Error]
T --> U[Return 500 Error]
D --> U
style A fill:#2ecc71,stroke:#27ae60
style U fill:#e74c3c,stroke:#c0392b
style R fill:#3498db,stroke:#2980b9
style S fill:#3498db,stroke:#2980b9
Agenda Fetcher Lambda Implementation
Objective: Create a serverless function that detects changes in Sessionize API and triggers downstream actions only when changes occur.
Functional Requirements
Input Handling:
api_urlparameterapi_urlData Fetching:
api_urlChange Detection:
State Management:
updatedAttimestampAction Trigger:
Response:
{ changed: boolean }Error Handling:
Non-Functional Requirements
Observability:
Infrastructure:
DYNAMODB_TABLE_NAMEDYNAMODB_HASH_KEYEfficiency:
Flowchart Diagram
%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#1e1e2e'}}}%% flowchart TD A([Start]) --> B[Parse Event Body] B --> C{api_url present?} C -->|No| D[Return 400 Error] C -->|Yes| E[Fetch External API] E --> F{API Response OK?} F -->|No| G[Throw Error] F -->|Yes| H[Compute JSON Hash] H --> I[Get Last Hash from DynamoDB] I --> J{Item exists?} J -->|No| K[Store New Hash\nSet mutation flag=true] J -->|Yes| L{Hash Changed?} L -->|No| M[Set flag=false\nMetric: NoChange] L -->|Yes| N[Update Hash\nSet flag=true\nMetric: HashChanged] K --> O{Mutation needed?} N --> O M --> O O -->|flag=true| P[Execute Mutation\nMetric: MutationInvoked] O -->|flag=false| Q[Skip Mutation] P --> R[Return 200\nchanged: true] Q --> S[Return 200\nchanged: false] G --> T[Log Error] T --> U[Return 500 Error] D --> U style A fill:#2ecc71,stroke:#27ae60 style U fill:#e74c3c,stroke:#c0392b style R fill:#3498db,stroke:#2980b9 style S fill:#3498db,stroke:#2980b9