Letting visitors find their local branch
Turn a postcode a visitor types into the branch nearest them, with no page reload — and turn a miss into an invitation to start a branch.
Quick answers
5 questions · click to openHow does the site know which branch covers a postcode?
From the boundaries you set on each branch under Settings → Political divisions. A branch can be defined by federal electorates, state electorates, LGAs, postcodes, or any mix of those. The lookup uses exactly the same rules that decide which branch a member belongs to.
What happens when no branch covers the postcode?
You get a clear "no branch here" answer along with the branches in that state, so the page can say "no branch in Albany yet" and offer a way to start one. It is not treated as an error.
Do I need to list every postcode on every branch?
No. If your branches are defined by federal electorates — which is the usual way — Cobber works out which electorate a postcode falls in for you. Listing postcodes is only worth doing where you want to override that for a specific area.
Is the lookup public?
Yes. It returns only what your branch directory already publishes: branch name, state, public contact email, page link and next public event. It never returns member data.
We do not have a branch directory page. Will it still work?
The lookup will still find the branch, but it cannot link to it — branch pages come from a published directory page. Create one and include your branches to get working links.
If your organisation has branches, the single most useful thing your homepage can do is answer “is there one near me?”. Cobber can resolve a postcode a visitor types into the branch that covers it, without a page reload.
What decides the answer
Nothing separate — it uses the boundaries already on each branch.
Under Settings → Political divisions, every branch has a set of boundaries: federal electorates, state electorates, LGAs, postcodes, or a mix. Those same boundaries decide which branch a member belongs to, so a visitor and a member are never told different things about the same address.
Most organisations define branches by federal electorate, and that is enough. Cobber works out which electorate a postcode falls in, then finds the branches covering it. You only need to list postcodes on a branch if you want to pin a specific area to a specific branch regardless of the electorate it sits in.
Postcodes do not line up neatly with electorates — plenty straddle two. When that happens the lookup returns the best match plus the others, so the page can show one branch and offer the rest rather than silently picking one.
If two branches both cover a postcode, the more specific boundary wins: a branch that names the postcode itself beats one that covers the whole electorate.
The four answers
The lookup always distinguishes these, because the page should say something different for each:
- A branch covers it. Show the branch, its next meeting, and a link to its page.
- Nothing covers it. The most valuable case. Branches start when a handful of locals decide to start one, so this is where the page says “No branch in Albany yet” and offers a Start a branch button — not an error message.
- We could not check. The address lookup was unavailable. Ask the visitor to try again in a moment. Never show “no branch here” for this — it is not the same thing, and telling someone their town has no branch when it does is worse than saying nothing.
- That is not a postcode. Ask for four digits.
Adding it to a page
Use the lookup endpoint on your own site:
GET /api/branches/lookup?postcode=4810
It returns JSON and needs no login:
{
"status": "matched",
"postcode": "4810",
"electorates": ["Herbert"],
"branch": {
"name": "Townsville",
"url": "/branch-directory/townsville",
"state": "Queensland",
"contact_email": "townsville@example.org.au",
"next_event": {
"title": "Branch meeting",
"date": "Sun 14 Sep",
"time": "7:00pm",
"url": "/events/townsville-september"
}
},
"alternatives": []
}
status is one of matched, no_branch, unresolved or invalid_postcode. When
nothing covers the postcode, branch is null and alternatives holds the branches in
that state — so the page always has something to show.
Because it answers without a page reload, the postcode field can resolve in place. This is the one to use for a “find your branch” module.
Linking to branch pages
Branch pages are produced by a directory page, so the link in a lookup result only appears once you have one: create a directory page, include the branches you want listed, and publish it. Without that the lookup still identifies the right branch, but has nowhere to send the visitor.
Before you launch it
- Check a postcode you know the answer for, and one you know has no branch. Both should read well on the page.
- Make sure the no-branch message is an invitation, not an apology. Most postcodes in Australia will not have a branch, and that screen will be seen more than any other.
- Give the branches you list a public contact email under Settings → Political divisions, or the result has no way for someone to get in touch.