/ 01-whatsapp-end-user-messaging / architecture.drawio
architecture.drawio
1 <mxfile host="app.diagrams.net" version="24.0.0"> 2 <diagram name="Stack 01 - End User Messaging" id="stack01"> 3 <mxGraphModel dx="1800" dy="1100" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0"> 4 <root> 5 <mxCell id="0" /> 6 <mxCell id="1" parent="0" /> 7 8 <!-- Description text block --> 9 <mxCell id="desc" value="<h2 style="margin-top: 0px;">Stack 01: WhatsApp End User Messaging</h2><p><b>Flow:</b></p><ol><li>WhatsApp user sends a message (text, image, audio, video, or document).</li><li>AWS End User Messaging Social receives and publishes to Amazon SNS.</li><li>Receiver Lambda: mark as read, download media to S3, save to DynamoDB.</li><li>DynamoDB Stream with tumbling window (3s) buffers messages from the same user.</li><li>Processor Lambda: aggregates buffered messages, transcribes audio, invokes AgentCore once per user.</li><li>AgentCore Runtime processes with memory context and returns response via WhatsApp.</li></ol>" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;fillColor=#f5f5f5;fontColor=#333333;strokeColor=#666666;spacing=9;fontSize=11;" vertex="1" parent="1"> 10 <mxGeometry x="160" y="-100" width="960" height="180" as="geometry" /> 11 </mxCell> 12 13 <!-- AWS Region container --> 14 <mxCell id="region" value="AWS Region" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_region;strokeColor=#00A4A6;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#147EBA;dashed=1;" vertex="1" parent="1"> 15 <mxGeometry x="160" y="100" width="930" height="380" as="geometry" /> 16 </mxCell> 17 18 <!-- ============ ROW 1: Main flow (y=70 inside region) ============ --> 19 20 <!-- End User Messaging Social --> 21 <mxCell id="eum" value="End User<br>Messaging Social" style="sketch=0;points=[[0,0,0],[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0,0],[0,1,0],[0.25,1,0],[0.5,1,0],[0.75,1,0],[1,1,0],[0,0.25,0],[0,0.5,0],[0,0.75,0],[1,0.25,0],[1,0.5,0],[1,0.75,0]];outlineConnect=0;fontColor=#232F3E;fillColor=#E7157B;strokeColor=#ffffff;dashed=0;verticalLabelPosition=top;verticalAlign=bottom;align=center;html=1;fontSize=11;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.end_user_messaging;" vertex="1" parent="region"> 22 <mxGeometry x="20" y="70" width="60" height="60" as="geometry" /> 23 </mxCell> 24 25 <!-- Amazon SNS Topic (native topic shape) --> 26 <mxCell id="sns" value="Amazon<br>SNS Topic" style="sketch=0;outlineConnect=0;fontColor=#232F3E;gradientColor=none;fillColor=#E7157B;strokeColor=none;dashed=0;verticalLabelPosition=top;verticalAlign=bottom;align=center;html=1;fontSize=11;fontStyle=0;aspect=fixed;pointerEvents=1;shape=mxgraph.aws4.topic;" vertex="1" parent="region"> 27 <mxGeometry x="150" y="74" width="60" height="52" as="geometry" /> 28 </mxCell> 29 30 <!-- Receiver Lambda --> 31 <mxCell id="receiver" value="Receiver<br>Lambda" style="sketch=0;points=[[0,0,0],[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0,0],[0,1,0],[0.25,1,0],[0.5,1,0],[0.75,1,0],[1,1,0],[0,0.25,0],[0,0.5,0],[0,0.75,0],[1,0.25,0],[1,0.5,0],[1,0.75,0]];outlineConnect=0;fontColor=#232F3E;fillColor=#ED7100;strokeColor=#ffffff;dashed=0;verticalLabelPosition=top;verticalAlign=bottom;align=center;html=1;fontSize=11;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.lambda;" vertex="1" parent="region"> 32 <mxGeometry x="280" y="70" width="60" height="60" as="geometry" /> 33 </mxCell> 34 35 <!-- Amazon DynamoDB --> 36 <mxCell id="ddb" value="Amazon<br>DynamoDB" style="sketch=0;points=[[0,0,0],[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0,0],[0,1,0],[0.25,1,0],[0.5,1,0],[0.75,1,0],[1,1,0],[0,0.25,0],[0,0.5,0],[0,0.75,0],[1,0.25,0],[1,0.5,0],[1,0.75,0]];outlineConnect=0;fontColor=#232F3E;fillColor=#C925D1;strokeColor=#ffffff;dashed=0;verticalLabelPosition=top;verticalAlign=bottom;align=center;html=1;fontSize=11;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.dynamodb;" vertex="1" parent="region"> 37 <mxGeometry x="410" y="70" width="60" height="60" as="geometry" /> 38 </mxCell> 39 40 <!-- DynamoDB Stream --> 41 <mxCell id="stream" value="DynamoDB Stream<br>(tumbling window)" style="sketch=0;points=[[0,0,0],[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0,0],[0,1,0],[0.25,1,0],[0.5,1,0],[0.75,1,0],[1,1,0],[0,0.25,0],[0,0.5,0],[0,0.75,0],[1,0.25,0],[1,0.5,0],[1,0.75,0]];outlineConnect=0;fontColor=#232F3E;fillColor=#C925D1;strokeColor=#ffffff;dashed=0;verticalLabelPosition=top;verticalAlign=bottom;align=center;html=1;fontSize=11;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.dynamodb_stream;" vertex="1" parent="region"> 42 <mxGeometry x="540" y="70" width="60" height="60" as="geometry" /> 43 </mxCell> 44 45 <!-- Processor Lambda --> 46 <mxCell id="processor" value="Processor<br>Lambda" style="sketch=0;points=[[0,0,0],[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0,0],[0,1,0],[0.25,1,0],[0.5,1,0],[0.75,1,0],[1,1,0],[0,0.25,0],[0,0.5,0],[0,0.75,0],[1,0.25,0],[1,0.5,0],[1,0.75,0]];outlineConnect=0;fontColor=#232F3E;fillColor=#ED7100;strokeColor=#ffffff;dashed=0;verticalLabelPosition=top;verticalAlign=bottom;align=center;html=1;fontSize=11;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.lambda;" vertex="1" parent="region"> 47 <mxGeometry x="670" y="70" width="60" height="60" as="geometry" /> 48 </mxCell> 49 50 <!-- Amazon Bedrock AgentCore Runtime --> 51 <mxCell id="agentcore" value="Amazon Bedrock<br>AgentCore Runtime" style="sketch=0;points=[[0,0,0],[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0,0],[0,1,0],[0.25,1,0],[0.5,1,0],[0.75,1,0],[1,1,0],[0,0.25,0],[0,0.5,0],[0,0.75,0],[1,0.25,0],[1,0.5,0],[1,0.75,0]];outlineConnect=0;fontColor=#232F3E;fillColor=#01A88D;strokeColor=#ffffff;dashed=0;verticalLabelPosition=top;verticalAlign=bottom;align=center;html=1;fontSize=11;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.bedrock;" vertex="1" parent="region"> 52 <mxGeometry x="800" y="70" width="60" height="60" as="geometry" /> 53 </mxCell> 54 55 <!-- ============ ROW 2: Supporting services (y=250 inside region) ============ --> 56 57 <!-- Amazon S3 Media (below Receiver) --> 58 <mxCell id="s3" value="Amazon S3<br>Media" style="sketch=0;points=[[0,0,0],[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0,0],[0,1,0],[0.25,1,0],[0.5,1,0],[0.75,1,0],[1,1,0],[0,0.25,0],[0,0.5,0],[0,0.75,0],[1,0.25,0],[1,0.5,0],[1,0.75,0]];outlineConnect=0;fontColor=#232F3E;fillColor=#3F8624;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=11;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.s3;" vertex="1" parent="region"> 59 <mxGeometry x="280" y="250" width="60" height="60" as="geometry" /> 60 </mxCell> 61 62 <!-- Amazon Transcribe (below Processor) --> 63 <mxCell id="transcribe" value="Amazon<br>Transcribe" style="sketch=0;points=[[0,0,0],[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0,0],[0,1,0],[0.25,1,0],[0.5,1,0],[0.75,1,0],[1,1,0],[0,0.25,0],[0,0.5,0],[0,0.75,0],[1,0.25,0],[1,0.5,0],[1,0.75,0]];outlineConnect=0;fontColor=#232F3E;fillColor=#01A88D;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=11;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.transcribe;" vertex="1" parent="region"> 64 <mxGeometry x="670" y="250" width="60" height="60" as="geometry" /> 65 </mxCell> 66 67 <!-- ============ ROW 1 EDGES: Main flow ============ --> 68 69 <!-- EUM -> SNS (green) --> 70 <mxCell id="e_eum_sns" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#009900;strokeWidth=2;flowAnimation=1;" edge="1" parent="region" source="eum" target="sns"> 71 <mxGeometry relative="1" as="geometry" /> 72 </mxCell> 73 74 <!-- SNS -> Receiver (green) --> 75 <mxCell id="e_sns_receiver" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#009900;strokeWidth=2;flowAnimation=1;" edge="1" parent="region" source="sns" target="receiver"> 76 <mxGeometry relative="1" as="geometry" /> 77 </mxCell> 78 79 <!-- Receiver -> DynamoDB (green) --> 80 <mxCell id="e_receiver_ddb" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#009900;strokeWidth=2;flowAnimation=1;" edge="1" parent="region" source="receiver" target="ddb"> 81 <mxGeometry relative="1" as="geometry" /> 82 </mxCell> 83 84 <!-- DynamoDB -> DynamoDB Stream (green) --> 85 <mxCell id="e_ddb_stream" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#009900;strokeWidth=2;flowAnimation=1;" edge="1" parent="region" source="ddb" target="stream"> 86 <mxGeometry relative="1" as="geometry" /> 87 </mxCell> 88 89 <!-- DynamoDB Stream -> Processor (red = buffered) --> 90 <mxCell id="e_stream_processor" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FF0000;strokeWidth=2;flowAnimation=1;" edge="1" parent="region" source="stream" target="processor"> 91 <mxGeometry relative="1" as="geometry" /> 92 </mxCell> 93 94 <!-- Processor -> AgentCore (orange = processed) --> 95 <mxCell id="e_processor_agentcore" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FF8000;strokeWidth=2;flowAnimation=1;" edge="1" parent="region" source="processor" target="agentcore"> 96 <mxGeometry relative="1" as="geometry" /> 97 </mxCell> 98 99 <!-- ============ ROW 2 EDGES: Supporting services ============ --> 100 101 <!-- Receiver -> S3 (green, straight down) --> 102 <mxCell id="e_receiver_s3" value="write media" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#009900;strokeWidth=2;flowAnimation=1;fontSize=9;fontColor=#666666;labelBackgroundColor=#ffffff;" edge="1" parent="region" source="receiver" target="s3"> 103 <mxGeometry relative="1" as="geometry" /> 104 </mxCell> 105 106 <!-- Processor -> S3 (orange, route with waypoints around DDB/Stream) --> 107 <mxCell id="e_processor_s3" value="read media" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FF8000;strokeWidth=2;flowAnimation=1;fontSize=9;fontColor=#666666;labelBackgroundColor=#ffffff;" edge="1" parent="region" source="processor" target="s3"> 108 <mxGeometry relative="1" as="geometry"> 109 <Array as="points"> 110 <mxPoint x="700" y="185" /> 111 <mxPoint x="380" y="185" /> 112 <mxPoint x="380" y="280" /> 113 </Array> 114 </mxGeometry> 115 </mxCell> 116 117 <!-- Processor -> Transcribe (orange, straight down) --> 118 <mxCell id="e_processor_transcribe" value="audio" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#FF8000;strokeWidth=2;flowAnimation=1;fontSize=9;fontColor=#666666;labelBackgroundColor=#ffffff;" edge="1" parent="region" source="processor" target="transcribe"> 119 <mxGeometry relative="1" as="geometry" /> 120 </mxCell> 121 122 <!-- ============ WhatsApp User (outside region) ============ --> 123 <mxCell id="user" value="WhatsApp User" style="dashed=0;outlineConnect=0;html=1;align=center;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.weblogos.whatsapp;fillColor=#00E676;strokeColor=none;fontSize=11;fontStyle=0;" vertex="1" parent="1"> 124 <mxGeometry x="50" y="170" width="60" height="60" as="geometry" /> 125 </mxCell> 126 127 <!-- User -> EUM (green) --> 128 <mxCell id="e_user_eum" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#009900;strokeWidth=2;flowAnimation=1;" edge="1" parent="1" source="user" target="eum"> 129 <mxGeometry relative="1" as="geometry" /> 130 </mxCell> 131 132 <!-- ============ LEGEND ============ --> 133 <mxCell id="legend_title" value="Legend" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;fontSize=14;fontStyle=0;" vertex="1" parent="1"> 134 <mxGeometry x="160" y="510" width="80" height="30" as="geometry" /> 135 </mxCell> 136 137 <mxCell id="leg1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;strokeColor=#009900;strokeWidth=2;flowAnimation=1;endArrow=block;endFill=1;" edge="1" parent="1"> 138 <mxGeometry relative="1" as="geometry"> 139 <mxPoint x="250" y="525" as="sourcePoint" /> 140 <mxPoint x="320" y="525" as="targetPoint" /> 141 </mxGeometry> 142 </mxCell> 143 <mxCell id="leg1t" value="Raw messages (ingestion)" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;fontSize=11;fontStyle=0;" vertex="1" parent="1"> 144 <mxGeometry x="325" y="512" width="170" height="25" as="geometry" /> 145 </mxCell> 146 147 <mxCell id="leg2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;strokeColor=#FF0000;strokeWidth=2;flowAnimation=1;endArrow=block;endFill=1;" edge="1" parent="1"> 148 <mxGeometry relative="1" as="geometry"> 149 <mxPoint x="510" y="525" as="sourcePoint" /> 150 <mxPoint x="580" y="525" as="targetPoint" /> 151 </mxGeometry> 152 </mxCell> 153 <mxCell id="leg2t" value="Buffered (tumbling window)" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;fontSize=11;fontStyle=0;" vertex="1" parent="1"> 154 <mxGeometry x="585" y="512" width="180" height="25" as="geometry" /> 155 </mxCell> 156 157 <mxCell id="leg3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;strokeColor=#FF8000;strokeWidth=2;flowAnimation=1;endArrow=block;endFill=1;" edge="1" parent="1"> 158 <mxGeometry relative="1" as="geometry"> 159 <mxPoint x="780" y="525" as="sourcePoint" /> 160 <mxPoint x="850" y="525" as="targetPoint" /> 161 </mxGeometry> 162 </mxCell> 163 <mxCell id="leg3t" value="Processed (to AgentCore)" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;fontSize=11;fontStyle=0;" vertex="1" parent="1"> 164 <mxGeometry x="855" y="512" width="170" height="25" as="geometry" /> 165 </mxCell> 166 167 </root> 168 </mxGraphModel> 169 </diagram> 170 </mxfile>