> **Tech Lead** · 2017 to 2019
> Source: https://www.simonbetton.com/case-studies/netsafe-rescam.md (markdown only; there is no HTML page for this document).
> Index of case studies: https://www.simonbetton.com/case-studies/index.md

# Case study: Re:scam

## Quick facts

|  |  |
| --- | --- |
| **Role** | Tech Lead at DDB New Zealand; sole engineer on the 2017 NetSafe build, lead developer on the 2019 Australian rebuild |
| **Company** | DDB New Zealand |
| **Client** | NetSafe (2017 New Zealand campaign); Westpac Australia (licensee of the 2019 rebuild) |
| **Product** | Re:scam, an email bot that identifies forwarded scam mail and keeps the scammer in conversation with a fictional persona |
| **Headline** | Launched November 2017; eleven Effies across 2018 New Zealand and 2019 APAC; around 210,000 forwarded scam emails per NetSafe's Effie case; featured by IBM at a European AI conference |
| **Timeline** | Original campaign launched November 2017; rebuild began March 2019 as a 14 to 16 week build, completed and reviewed, never launched |
| **Stack (rebuild)** | PHP 7.2, Laravel 5.8, Vue 2, AWS (SQS, DynamoDB, Elastic Beanstalk, Lambda via SAM, CloudFormation, CodePipeline), Aurora MySQL, Algolia, SendGrid, Google Cloud Natural Language and DLP |

## The 2017 problem

Scam email works on volume, and the people who reply are the ones who lose money. NetSafe wanted the public to have something to do with a scam email other than delete it; DDB New Zealand's answer was to turn the scammer's own time against them. A member of the public forwards the scam to Re:scam; the service takes over the correspondence under a fictional identity and asks the scammer endless questions. Time spent talking to the bot is time not spent on a real victim.

The creative idea was the agency's; making it real was my job as sole engineer. The product had to hold a conversation with a hostile, unpredictable correspondent, at scale, without a person approving each reply, and without ever saying something the agency and the client had not written.

## What I built

I built Re:scam as an interpreter attached to a library, not as an author.

IBM Watson Natural Language Understanding read each incoming email for keywords, category, and sentiment. Watson Natural Language Classifier then chose a reply from a library of roughly 90,000 human-written conversation lines, as reported at launch. Every line the bot could send had been written by a copywriter in the voice of one of six fictional personas. Watson decided which line fitted the moment; it never composed one.

Sentiment was the operational signal: an introductory message reads differently from a frustrated follow-up, and the bot chose its tack accordingly. The persona chosen at the start of a conversation held for its lifetime, so a scammer corresponding over days met a consistent character.

The design decision that mattered most was the authorship boundary: retrieve, never generate. A bot that can only send lines a human wrote cannot be steered into unapproved copy, cannot be embarrassed by its own invention, and can be shown to a client as a finite, reviewable artefact. That boundary carried unchanged into the 2019 rebuild, and it is the reason the product could later be offered to a bank.

I describe the Watson version at the level of its design because that is what I can stand behind at this distance: classify the message, use sentiment and category to pick a tactic, retrieve a line from the persona's library, send it, and keep the exchange alive for as long as the scammer keeps replying.

## What the live campaign taught

Running against real scammers taught lessons that no amount of design would have surfaced.

The first was about where to reply. Scammers bulk-send from unmonitored accounts and read a different mailbox named in the body of the message, so replying to the envelope sender talks to nobody. Reply-to has to win over sender, and a usable address in the body has to win over an unusable sender.

The second was about what to discard. Malformed forwards, empty bodies, mail from no-reply accounts, and addresses whose domains do not resolve are not conversations worth opening; engaging them wastes a persona and risks emailing a real person. Deciding early what is not worth a conversation matters as much as deciding what is.

The third was never to repeat a line inside a conversation, because a scammer who sees the same sentence twice knows they are talking to a machine. The fourth was that one blacklisted domain can end a campaign, so sending identity has to be spread across domains. Each of these became an explicit rule in the rebuild.

## The campaign outcome

Re:scam launched in November 2017 and is the version of the product the public knows. It won eleven Effies across the 2018 New Zealand and 2019 APAC competitions. NetSafe's Effie case reported around 210,000 forwarded scam emails over the campaign period. DDB's 2019 awards entry also noted that IBM had included Re:scam in a European AI conference.

For a piece of work built by one engineer, that is the strongest business outcome in my portfolio, and it is why the next two years happened.

## Turning a campaign into a product

By 2019 DDB had spent about eighteen months turning Re:scam into a product for markets outside New Zealand, beginning with Westpac Australia. Westpac would license the product and sponsor an Australian awareness campaign; DDB would build and operate an Australian instance. I was the lead developer, making the architecture calls and implementing them; AC3, an Auckland AWS partner already supplying the bank, supported the Well-Architected implementation.

### What licensing to a bank changed

Licensing to a bank in another country changed the engineering problem more than the deployment target. The product had to be explainable, because a bank's risk function would review why the bot engaged a given sender, and the cost of a false positive was emailing a stranger's genuine correspondent under a fake name. Personal data handling had to be defensible in writing; forwarded mail carries the forwarder's own details and whatever the scammer included, and we committed to storing no personal information. The bot would email third parties without a person approving each reply, on a bank-sponsored campaign, so the obvious question from the client was whether it could be "played". Traffic was unknown, and the intake path could not depend on the web tier keeping up. And the client would receive full access to the codebase and collected data for security review, so the design had to survive an outside reader.

### Retrieve a human-written reply; never generate one

The 2017 authorship boundary became a stated selling point. Every outbound line is written by a copywriter and attached to a keyword through the control panel. Incoming mail becomes a search query against that library in Algolia, filtered to the active persona and the stage of the conversation, with recently used lines excluded and a curated fallback when nothing matches. There are no prompts, embeddings, or generative calls, so the answer to "can the bot be played?" was that it cannot be steered into unapproved copy.

The trade-off is a large library that has to stay in character. The rebuild also gave up the sentiment signal the Watson original used to pick a tactic; category classification stayed, and the model budget went to sensitive-identifier detection, which matters more to a bank than knowing the scammer is annoyed. Google's natural language service proposes new keywords as traffic arrives, but only a person can attach a reply to one. The vocabulary grows automatically; the voice does not.

### Score with explicit weights, and let a repeat offender outrank textual inference

The scam decision is a sum of inspectable signals against a threshold rather than a single classifier verdict. A score of four engages; zero to three sends advice back to the forwarder and starts no conversation. Weak textual signals score one each: a body over three hundred words, explicit language, an address in the body that is not the sender's, a link whose visible address differs from its target, and a Google category of adult, finance, or lottery above a confidence level on a message long enough to classify. Stronger signals score two: more than one unique address in the body, amounts above two million, a sensitive identifier detected by Google's DLP service (card numbers, SWIFT codes, Australian Medicare numbers, Australian tax file numbers), and a message fingerprint already seen ten or more times. A sender already flagged ten times scores four on their own.

That ordering is the point: evidence of a repeat offender outweighs any amount of inference from the text, which is the right way round when a false positive means emailing a real person. Those are the design weights; we tuned them during the build, so the signal set and configurable threshold shipped as designed and the final weights differed. I did not keep the production values.

One rule is jurisdictional. Mail from a .com.au domain is not scored as scam, because that namespace requires an Australian business registration, so a genuine bank or retailer notice forwarded in good faith cannot be engaged by mistake. It came out of the risk register and shipped.

### Filter before queueing

A lightweight filter encodes the New Zealand lessons before anything is queued: a malformed or missing forward is dropped, as is a body under two characters, an unroutable sender, a no-reply account, and an address whose domain fails a reachability check. Reply-to wins over sender, and a usable address in the body wins over an unusable sender. Replies to an existing persona are not re-scored, because the decision to engage was made when the conversation opened. Every message ends in one of four actions: a new scam conversation, a non-scam result to the forwarder, a reply to an existing identity, or a discard as an operational error.

### Two queues, two stores, and retention as a property of the table

Intake is serverless: an endpoint receives the email provider's payload, a small Node.js service writes the raw message to DynamoDB with a one-day time-to-live and puts its identifier on an SQS queue. An Elastic Beanstalk worker consumes the queue and runs formatting, classification, decision, persistence, and dispatch. Outbound mail goes onto a second queue, and a separate service selects the SendGrid template, sends after a randomised delay, and deletes the temporary payload. Both queues have capped retries and dead-letter queues. The inbound queue protects analysis from public traffic; the outbound queue protects conversation processing from provider latency.

Raw payloads live only in DynamoDB and expire on their own; durable relationships between personas, replies, keywords, fictional identities, and conversation turns live in Aurora MySQL. Retention is enforced by the table's expiry rather than by a cleanup job someone has to remember to run, and analytics records carry scammer addresses only as SHA-256 hashes.

### Bound the autonomy

The six personas carried over from the New Zealand campaign; one is drawn at random when a conversation opens and holds for its lifetime. Replies are typed by position in the exchange: an opening line on a keyword hit, an opening line for when nothing matched, a general line, and a continuation line. Keyword matching is exact, partial, and fuzzy, because scam mail is full of misspelling and transliteration. No line repeats within a conversation. Each fictional identity has a cap on how many turns it can send, which stops an automated counterpart from creating an unbounded loop, and long messages are searched in bounded chunks. Alias addresses combine a generated name and number with one of a set of sending domains, so one blacklisted domain could not end the campaign.

### What changed between design and build

Several parts of the March 2019 design changed during the build, and the changes were my calls. Cloudflare had been proposed for DNS, content delivery, and web application firewall; we shipped CloudFront with HTTPS terminating at the load balancer. MongoDB had been proposed for the temporary queue store; DynamoDB with time-to-live shipped. Proposed retention was a twenty-four hour conversation window and five days of stored conversation data; the implementation expires raw payloads after one day and deletes them on successful delivery. The proposed Node filter script became Lambda functions behind API Gateway, and the proposed MySQL on RDS became an Aurora MySQL cluster.

The first two replaced a separately managed dependency with a managed service already inside the AWS account, which reduced the vendors that could fail independently. The retention change made the policy a property of the data store rather than a process.

### Infrastructure and delivery

CloudFormation describes the network, application services, data stores, queues, security controls, monitoring, and the deployment pipeline, with parameters for development, test, staging, and production. The network spans three availability zones; web and worker tiers run in private subnets behind a load balancer and scale on CPU, database access is restricted to the application security group and a bastion host, and credentials come from Secrets Manager. CodePipeline coordinates source intake, a manual approval with an SNS notification, infrastructure updates, serverless packaging, and deployment of the web, worker, and serverless workloads in that order. On a system where an accidental deployment changes live email behaviour, the approval gate is appropriate.

Account-level controls include alarmed root activity, an IAM policy denying service use outside the approved region, encrypted log buckets, and a billing alarm. Non-production environments redirect all outbound mail to a controlled recipient, so test traffic cannot reach a real scammer. Operational statistics come from structured JSON logs queried with CloudWatch Logs Insights and charted from the control panel, which avoided a separate analytics pipeline.

### Assurance

The bank required an independent penetration test and security review of the whole solution before public launch, conducted by a security provider already supplying the bank. Administrative login was restricted to allowlisted office addresses and sat behind a challenge test as well as authentication. The build followed the AWS Well-Architected framework, with AC3 supporting the implementation and conducting the review. Both reviews were completed on the rebuild.

### Limitations I would name first

The repository has only example-level automated tests, and the pipeline packages and deploys without running tests, lint, or infrastructure validation as gates. Some environment configuration was manual. The classifier was designed to produce separate scam and spam assessments, but the email provider's spam score never reaches the assessment state, so the spam result and the dashboard measure built on it did not work as intended.

One risk sits outside the trust boundary entirely. Forwarding a scam message from some mail clients fires any tracking pixel embedded in it, which tells the sender the forwarder's address is live. The service can strip personal data after receipt but cannot unsend that signal. The mitigation was editorial: campaign messaging had to teach people to forward scam mail, not everything suspicious.

### Completed, not launched

The 2019 rebuild was completed: a codebase distinct from the Watson original, implementing the design above with infrastructure and pipeline as code, penetration tested and reviewed against the Well-Architected framework. It was never launched. The client did not take the Australian instance live, and I do not know the reasons. The outcome I can point to on the rebuild is the engineering; the campaign outcome belongs to 2017.

NetSafe relaunched Re:scam in New Zealand in June 2023 as "Re:Scam 2.0" with a generative approach. I had left DDB in 2021 and had no part in it.

## Technologies and standards

| Layer | Choices |
| --- | --- |
| Application | PHP 7.2, Laravel 5.8, Vue 2, Bootstrap 4, Sass, Webpack |
| Data | Aurora MySQL, DynamoDB with TTL, Algolia, CloudWatch Logs |
| Messaging | SQS inbound and outbound queues with dead-letter queues, SendGrid |
| Machine-learning signals | IBM Watson NLU and NLC (2017 original); Google Cloud Natural Language classification and DLP (rebuild) |
| Infrastructure | CloudFormation, AWS SAM, Elastic Beanstalk, API Gateway, Secrets Manager, CloudFront |
| Delivery | CodePipeline, CodeBuild, manual SNS approval |
| Operations | CloudWatch Logs Insights, SNS alerting |

The rebuild codebase follows Laravel conventions of its period: MVC structure, schema migrations, environment-based configuration, server-side validation, lint rules declared, PHPUnit configured, and structured logging. Declared is not enforced; see the limitations above.

## Questions this work answers

Was this built with generative AI? No, in either version. Watson interpreted and classified in 2017; Algolia retrieves in the rebuild. Every line a scammer received was written by a person, and in 2019 that was a selling point to the client, not an accident of the era.

Is it an agent? Not in the LLM sense. It is a bounded loop: perceive an email, extract signals, score, pick one of four fixed actions, retrieve an approved line, send after a delay, persist the turn.

Why did the AI stack change from the original? The licensee was a bank in Australia. Sensitive-identifier detection earned its place ahead of the sentiment reading the original used to pick a tactic, and rules give a reason a reviewer can read.

What would I check first if handed the rebuild today? The spam-score defect, then the missing pipeline gates, then whether the production scoring weights still match the design intent.
