Compare commits

20 Commits
Author SHA1 Message Date
Andy Dixon 3145a40d7d Codebase sync 2026-09-22 08:53:08 +01:00
Andy Dixon 680bfac014 Send as webhook.me.uk, add favicon, share image and SEO tags
Mail now comes from no-reply@webhook.me.uk (DKIM, SPF and DMARC are
set up for it) and the Message-ID uses that domain instead of the
container hostname. The landing page gets a favicon, an Open Graph
image, canonical/OG/Twitter/JSON-LD tags, robots.txt that keeps
crawlers off email URLs, and a sitemap. Footer links to dixon.cx.
2026-09-22 08:50:20 +01:00
Andy Dixon 07701ba9cd Clean white theme in black and Bristol blue, move to webhook.me.uk
The landing page and the email shell drop the dark gradient look for a
white background, black text and a single Bristol blue accent. Copy is
unchanged. Email footers and docs now point at webhook.me.uk; the
dixon.cx hostnames keep working.
2026-09-22 08:41:01 +01:00
Andy Dixon 2d0f98e041 Rewrite the service in Go and ship it as a static container
The PHP app, Apache, and .htaccess are replaced by a single Go binary
(standard library only). Routing, the JSON response, the landing page,
the shared email design, and all four parsers are ported with the same
output; JSON object keys are kept in sender order via an ordered decoder.

- mail.go: SMTP delivery with quoted-printable body and RFC 2047 subject
- main.go: routing, client IP from the proxy, /healthz, -check flag
- render.go: email shell, escaping, table helpers, generic renderer
- parser_*.go: github, grafana, json, wxinteract
- main_test.go: handler, response shape, IP forwarding, every parser
- Dockerfile: multi-stage build to distroless static, non-root, HEALTHCHECK
- deploy/webhooks.dixon.cx.service: systemd unit for the container
- README and PARSER_PROMPT updated for Go; IMPLEMENTATION_SUMMARY removed
2026-09-12 19:59:54 +01:00
Andy Dixon a61da1f6e3 Move the parser guide into the repo and bring it up to date
The guide lived one directory above the repo, so the README links were
broken on GitHub. It also described the old layout: parsers inside
index.php, a copied <style> block, and div-based tables. It now covers
parsers/{name}.php, emailShell(), esc(), real table markup,
case-insensitive headers, and local testing with a sendmail override.
2026-09-12 19:48:53 +01:00
Andy Dixon 5e731d5d11 Report the client IP nginx forwards, not the Docker bridge
REMOTE_ADDR inside the container is 172.17.0.1. When the peer is a
private or loopback address, use X-Real-IP (or the first hop of
X-Forwarded-For) that nginx sets. Public peers cannot spoof it.
2026-09-12 19:21:13 +01:00
Andy Dixon 39ea06c3ee Update README for JSON response, all four parsers, and email redesign 2026-09-12 19:20:14 +01:00
Andy Dixon 64c51d4f2b Keep line breaks in values, handle scalar and string-array JSON
- esc() helper escapes free-text values and converts newlines to <br>;
  used for commit messages, SMS text, annotations, and all JSON values
- JSON parser accepts scalar bodies (string, number, bool, null) and
  renders them as a one-row table instead of falling back to the
  default template
- Arrays of plain values render as one table under their path
  breadcrumb, so nested string lists are no longer anonymous
- GitHub commits render as cards with a sha pill linked to the commit
2026-09-12 18:55:21 +01:00
Andy Dixon b3da9fbb25 Render email metadata as real tables and redesign the shell
Metadata blocks were divs styled with display:table. Nested blocks and
orphan cells created phantom columns that squeezed the value column to
a character or two. Every metadata block is now a real <table>/<tr>/<td>,
which mail clients lay out reliably, and the value column always fills
the remaining width.

The shared shell gets a gradient hero header, timestamp pill, dark
frame, and refreshed section, card, and code-block styling.
2026-09-12 18:47:20 +01:00
Andy Dixon ae9348c0ad Match GitHub event headers case-insensitively
Header names arrive lowercase over HTTP/2 (the nginx front end enables
it) and Apache preserves that case, so the X-GitHub-Event lookup missed
and every email reported "Unknown". Normalise header keys once.
2026-09-12 18:41:32 +01:00
Andy Dixon c1ec1adf85 Redesign landing page, JSON caller response, shared email shell
- docs.htm: dark single-page redesign in plain CSS, live URL builder,
  all four parsers documented, Bootstrap CDN dependency dropped
- index.php: respond with pretty-printed JSON (success and 400 error);
  email "Parsed Variables" block uses JSON instead of print_r
- parsers/helpers.php: emailShell() provides one stylesheet, header and
  footer for every email template; five duplicated stylesheets removed
2026-09-11 18:23:25 +01:00
Andy Dixon f3f58dbf95 Set webhook email sender identity 2026-09-11 18:10:16 +01:00
Andy Dixon 3d88ae2132 Added JSON parsing 2026-01-26 13:12:15 +00:00
Andy Dixon ae3e3f8488 Break parsers into subfolder 2026-01-22 17:18:35 +00:00
Andy Dixon ee65789675 Add implementation summary documentation 2026-01-22 16:59:30 +00:00
Andy Dixon 2a45e6430c Add comprehensive Webex Interact parser guide
- Detailed documentation for all 7 event types
- Configuration instructions
- Testing examples with cURL
- Email organization tips
- Troubleshooting section
- Links to official API documentation
2026-01-22 16:58:40 +00:00
Andy Dixon 1d336e4cac Add Webex Interact webhook parser
- Added wxinteractParse() function supporting all SMS API events:
  * Outbound SMS (submitted, delivered, failed)
  * Shortlink clicked
  * Inbound SMS received
  * SMS opt out
  * Contacts callback
- Helper functions for each event type with formatted HTML
- Test samples file for all event types
- Updated README with Webex Interact documentation
- Follows existing parser style and security guidelines
2026-01-22 16:57:55 +00:00
Andy Dixon 861c9dddde Additional Parsers, improve design of email 2026-01-22 16:24:19 +00:00
Andy Dixon 53889663dd Merge branch 'master' of github.com:andydixon/webhook 2025-11-10 15:38:29 +00:00
Andy Dixon e56a2b340b Add GNU GPL v3 License
Added the GNU General Public License version 3 to the project.
2025-11-10 15:36:22 +00:00
630 changed files with 3685 additions and 736 deletions
+5
View File
@@ -0,0 +1,5 @@
*
!go.mod
!*.go
!docs.html
!static
+1
View File
@@ -0,0 +1 @@
webhooks
-8
View File
@@ -1,8 +0,0 @@
RewriteEngine On
# Skip existing files and directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Redirect all requests to the PHP script
RewriteRule ^(.*)$ index.php [L,QSA]
+13
View File
@@ -0,0 +1,13 @@
FROM golang:1.26-alpine AS build
WORKDIR /src
COPY go.mod ./
COPY *.go docs.html ./
COPY static ./static
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /webhooks .
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /webhooks /webhooks
ENV LISTEN=:8080 SMTP_ADDR=172.17.0.1:25 MAIL_FROM=no-reply@webhook.me.uk PUBLIC_HOST=webhook.me.uk
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s CMD ["/webhooks", "-check"]
ENTRYPOINT ["/webhooks"]
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
+381
View File
@@ -0,0 +1,381 @@
# Webhook Parser Development Guide
This guide explains how to create custom webhook parsers for the Webhook Email Forwarder.
## 📋 Overview
Parsers format webhook data from specific services (GitHub, Grafana, Stripe, GitLab, etc.) into readable HTML emails instead of the raw request dump.
## 🚀 Quick Start
### URL Format
Parsers are triggered by adding the parser name to the URL:
```
https://your-domain.com/{email}/{parser-name}
```
**Examples:**
- `https://webhook.me.uk/test%40example.com/github`
- `https://webhook.me.uk/user%40company.com/grafana`
- `https://webhook.me.uk/dev%40startup.io/json`
### How It Works
1. User configures the webhook URL with their email and parser name
2. Service sends a webhook to that URL
3. The server looks the parser name up in the `parsers` map in `main.go`
4. The parser turns the request into an email body and subject
5. The email is sent and the caller gets a JSON acknowledgement naming the parser and subject
If no parser is named, the name is unknown, or the parser returns `ok == false`, the default raw-request email is used instead.
---
## 🛠️ Creating a Parser
### File and Function
Create `parser_{servicename}.go` in the package root with one function of this type:
```go
// Parser turns a raw webhook into an email. ok=false means "fall back to the default email".
type Parser func(raw []byte, headers http.Header, meta Meta) (html, subject string, ok bool)
```
Then register it in `main.go`:
```go
var parsers = map[string]Parser{
"github": githubParse,
"grafana": grafanaParse,
"json": jsonParse,
"wxinteract": wxinteractParse,
"servicename": servicenameParse, // <- add yours
}
```
### Parameters
#### `raw []byte`
The complete request body as received.
```go
v, err := decodeJSON(raw) // ordered JSON: *OMap, []any, string, json.Number, bool, nil
payload := asObject(v) // nil if the body is not an object
```
`decodeJSON` keeps object keys in the order the sender wrote them, so tables read naturally. Use it rather than `encoding/json` into a `map`, which sorts keys.
#### `headers http.Header`
All request headers, including `Host`. Lookups through `headers.Get` are case-insensitive, which covers the lowercase names HTTP/2 delivers:
```go
event := headers.Get("X-GitHub-Event")
```
#### `meta Meta`
```go
type Meta struct {
Date string // "2026-01-22 15:30:45"
IP string // the client address nginx forwards, not the proxy
Method string // "POST"
ContentType string // "application/json"
}
```
### Return Value
- **Success:** the complete HTML document (from `emailShell`), the subject line, and `true`
- **Failure:** `"", "", false` to fall back to the default email
---
## 🎨 Building the Email
Never write a full HTML document by hand. Compose the body from the helpers in `render.go` and wrap it with `emailShell`, which adds the stylesheet, gradient header, and footer. Every parser looks the same this way and design changes happen in one place.
```go
html := emailShell(title, stamp, body, footerSentence)
```
| Argument | What it is |
|----------|------------|
| `title` | Header text, already HTML-safe. Start with an emoji. |
| `stamp` | Usually `h(meta.Date)`. Shown as a pill under the title. |
| `body` | Your sections. |
| `footerSentence` | One line, e.g. "This Stripe webhook was automatically forwarded to your email address." Empty string for the generic default. |
### Building Blocks
```go
section(title, innerHTML string) string // <div class="section"> with a title
table(rows ...string) string // a real <table class="metadata">
row(label, valueHTML string) string // one label/value <tr>
link(url string) string // escaped <a href>
kvTable(m *OMap) string // every key/value of an object as one table
renderDataAsTable(v any, depth int) string // arbitrary nested JSON as tables (generic fallback)
```
Example:
```go
body := section("💳 Payment Details", table(
row("Event", h(event)),
row("Amount", h(amount)+" "+h(currency)),
row("Customer", h(customer)),
)) + section("📝 Note", `<div class="message-box">`+esc(note)+`</div>`)
```
**Other classes you can use inside a section:**
| Class | Use for |
|-------|---------|
| `.subsection-title` | A bold sub-heading |
| `.data-box` | A `<pre>` for raw JSON, headers, or code (dark block) |
| `.message-box` | Quoted free text such as an SMS body |
| `.error-box` | Error details |
| `.array-item` / `.array-item-title` | A card for one item of a list (an alert, a commit) |
| `.path-title` | A breadcrumb pill above a nested table, e.g. `order->items->[0]` |
| `.commit-item` with `.sha`, `.who`, `.msg` | The GitHub commit card, reusable for any id + author + message list |
### Reading values
```go
str(v) // scalar as text ("" for null, "true"/"false" for bools)
strOr(v, "N/A") // PHP's `?? 'N/A'`: only missing/null takes the default
get(payload, "repository", "full_name") // nested lookup, nil if any step is missing
asObject(v) // *OMap or nil
isContainer(v) // object or array?
num(v) // float64 for a json.Number, else 0
```
### Escaping
Two helpers, use the right one:
- `h(s)` for anything that goes into an attribute or a single-line value.
- `esc(s)` for free text that may contain line breaks (commit messages, descriptions, SMS bodies). It escapes **and** converts newlines to `<br>`.
Subjects are plain text, never escaped.
---
## 📝 Example: Simple Parser
`parser_simplepay.go` for a fictional "SimplePay" service:
```go
package main
import "net/http"
func simplepayParse(raw []byte, headers http.Header, meta Meta) (string, string, bool) {
payload := asObject(mustDecode(raw))
if payload == nil {
return "", "", false // not a JSON object: use the default email
}
event := strOr(payload.Get("event"), "Unknown")
amount := strOr(payload.Get("amount"), "N/A")
currency := strOr(payload.Get("currency"), "USD")
customer := strOr(payload.Get("customer_email"), "Unknown")
note := strOr(payload.Get("note"), "")
body := section("💳 Payment Details", table(
row("Event", h(event)),
row("Amount", h(amount)+" "+h(currency)),
row("Customer", h(customer)),
row("IP Address", h(meta.IP)),
))
if note != "" {
body += section("📝 Note", `<div class="message-box">`+esc(note)+`</div>`)
}
html := emailShell("💳 SimplePay: "+h(event), h(meta.Date), body,
"This SimplePay webhook was automatically forwarded to your email address.")
return html, "💳 SimplePay " + event + " - " + amount + " " + currency, true
}
func mustDecode(raw []byte) any {
v, err := decodeJSON(raw)
if err != nil {
return nil
}
return v
}
```
---
## 🎨 Style Guidelines
The shell owns colours, fonts, and spacing. Parsers only choose structure and words.
1. **Sections**: one `section` per logical group
2. **Tables**: `table(row(...))` for label/value pairs, never hand-written divs
3. **Lists**: one `.array-item` card per item (alerts, commits, line items)
4. **Raw data**: `.data-box` for anything the reader might want to copy
5. **Free text**: `.message-box`, escaped with `esc`
6. **Links**: `link(url)`
### Emojis
- 💳 Payment events
- 🚀 Deployments/releases
- 📤 Push/upload events
- 🔀 Merge/pull request events
- ⚠️ Errors/warnings
- ✅ Success events
- 🔔 Notifications
Put the same emoji at the start of the subject line so inbox filters can key on it.
---
## 🔒 Security Best Practices
### 1. Escape everything dynamic
```go
// ❌ DANGEROUS - XSS in the email
body += "<div>" + str(payload.Get("user_input")) + "</div>"
// ✅ SAFE (single line)
body += "<div>" + h(str(payload.Get("user_input"))) + "</div>"
// ✅ SAFE (multi-line free text)
body += `<div class="message-box">` + esc(str(payload.Get("message"))) + `</div>`
```
### 2. Validate input
```go
if payload == nil || payload.Get("event_type") == nil {
return "", "", false
}
```
### 3. Verify signatures (optional)
```go
sig := headers.Get("X-Service-Signature")
mac := hmac.New(sha256.New, []byte(secret))
mac.Write(raw)
if sig == "" || !hmac.Equal([]byte(sig), []byte(hex.EncodeToString(mac.Sum(nil)))) {
return "", "", false
}
```
---
## 🧪 Testing Your Parser
### 1. Unit test
`main_test.go` has a `capture(t)` helper that swaps the mailer for an in-memory one and a `do(...)` helper that drives the handler. Add a test in the same style:
```go
func TestSimplePay(t *testing.T) {
c := capture(t)
_, out := do(t, "POST", "/t%40e.com/simplepay", `{"event":"paid","amount":"9.99"}`, nil)
if out["subject"] != "💳 SimplePay paid - 9.99 USD" || !strings.Contains(c.html, "9.99") {
t.Fatalf("%v", out["subject"])
}
}
```
```bash
go test ./...
```
### 2. Run locally without sending mail
Point the server at any SMTP sink (the repo's tests don't need one, but for eyeballing the HTML):
```bash
LISTEN=127.0.0.1:8098 SMTP_ADDR=127.0.0.1:2525 go run .
curl -X POST http://127.0.0.1:8098/test%40example.com/simplepay \
-H "Content-Type: application/json" \
-d '{"event":"paid","amount":"9.99","currency":"USD"}'
```
The JSON response tells you which parser ran and what subject was used.
### 3. Test the failure case
Send invalid data and confirm the response shows the default subject (`‼️ Webhook Request Received`).
### 4. Test a lowercase header
Real deliveries over HTTP/2 arrive with lowercase header names. `headers.Get` handles it, but if you read `headers[...]` directly you will miss them.
---
## 📋 Parser Checklist
- [ ] File is `parser_{servicename}.go` and the function matches the `Parser` type
- [ ] Registered in the `parsers` map in `main.go`
- [ ] Returns `false` on failure/invalid data
- [ ] Header lookups use `headers.Get`
- [ ] All dynamic content goes through `h` or `esc`
- [ ] Body uses `section` / `table` / `row` and is wrapped with `emailShell`
- [ ] Subject line includes an emoji and key information
- [ ] Unit test added and `go test ./...` passes
- [ ] README section added for the parser
---
## 🤝 Contributing Parsers
1. Add `parser_{servicename}.go` and register it
2. Add a test
3. Document usage in README.md (service name, URL format, supported events)
4. Submit a pull request with an example payload in the description
---
## 📚 Reference
### Existing parsers
- `parser_github.go` - Multiple event types, commit cards, generic fallback
- `parser_grafana.go` - Nested alert cards with label and annotation tables
- `parser_json.go` - Recursive rendering with path breadcrumbs
- `parser_wxinteract.go` - Many event types in one switch
- `render.go` - `emailShell`, `esc`, `h`, `decodeJSON`, `renderDataAsTable`, table helpers
- `main.go` - Routing, JSON response, default email, parser registry
- `mail.go` - SMTP delivery
### Configuration
| Variable | Default | Meaning |
|----------|---------|---------|
| `LISTEN` | `127.0.0.1:8080` | Address to listen on (`:8080` in the container) |
| `SMTP_ADDR` | `127.0.0.1:25` | SMTP relay (`172.17.0.1:25` in the container, the host's postfix) |
| `MAIL_FROM` | `no-reply@webhook.me.uk` | Envelope and From address |
| `PUBLIC_HOST` | `webhook.me.uk` | Host shown in email footers |
---
## ❓ FAQ
**Q: Can I use external libraries?**
A: The project has no dependencies beyond the standard library. Keep it that way unless there is a very good reason.
**Q: Can I make API calls in a parser?**
A: Not recommended. Parsers should be fast and not depend on external services.
**Q: What if my service sends different content types?**
A: Check `meta.ContentType` and parse accordingly.
**Q: Can I create multiple parsers for one service?**
A: Yes. Register as many names as you like.
**Q: Can I change the colours or fonts?**
A: Change `shellSrc` in `render.go` and every email picks it up.
---
**Happy Parser Building! 🚀**
+320 -35
View File
@@ -1,14 +1,17 @@
# Webhook Email Forwarder # Webhook Email Forwarder
A simple, elegant PHP solution for debugging webhooks by forwarding them directly to your email. A single-binary Go service for debugging webhooks by forwarding them directly to your email.
## 🌟 Features ## 🌟 Features
- **Email Delivery**: Receive complete webhook data directly in your inbox - **Email Delivery**: Receive complete webhook data directly in your inbox
- **Custom Parsers**: Beautifully formatted emails for GitHub, Grafana, Webex Interact, and any JSON payload
- **JSON Response**: Every request gets a structured JSON acknowledgement, not a wall of `print_r`
- **Secure**: Built-in email validation and XSS protection - **Secure**: Built-in email validation and XSS protection
- **Instant**: Real-time webhook processing and forwarding - **Instant**: Real-time webhook processing and forwarding
- **Simple**: No database or complex setup required - **Simple**: No database or complex setup required
- **Universal**: Supports all HTTP methods and content types - **Universal**: Supports all HTTP methods and content types
- **Extensible**: Easy to add new parsers for any webhook service
## 📋 Overview ## 📋 Overview
@@ -20,18 +23,163 @@ This webhook service captures incoming HTTP requests and forwards complete reque
Replace `@` with `%40` in your email address: Replace `@` with `%40` in your email address:
- `test@example.com` becomes `test%40example.com` - `test@example.com` becomes `test%40example.com`
The landing page has a URL builder that does this for you.
### 2. Configure Webhook ### 2. Configure Webhook
Use the following URL format as your webhook endpoint: Use one of the following URL formats as your webhook endpoint:
**Standard format** (raw webhook data):
``` ```
https://your-domain.com/{encoded-email} https://your-domain.com/{encoded-email}
``` ```
**With parser** (formatted email for specific services):
```
https://your-domain.com/{encoded-email}/{parser-name}
```
### 3. Check Your Inbox ### 3. Check Your Inbox
Receive detailed webhook data instantly in your email with the subject: Receive webhook data instantly in your email!
**Standard format:**
``` ```
‼️ Webhook Request Received - [timestamp] ‼️ Webhook Request Received - [timestamp]
``` ```
**With parser:**
```
📤 GitHub push - username/repo
🚨 Grafana Alert: firing - 2 alerts
📊 JSON Webhook - [timestamp]
📥 Webex Interact: Inbound SMS Received
```
## 📬 The Response
Every request is answered with `application/json`, pretty-printed. JSON bodies are decoded and echoed back under `data.json` so you can see exactly what the server understood.
```json
{
"ok": true,
"message": "Webhook received and forwarded to test@example.com",
"forwarded_to": "test@example.com",
"parser": "default",
"subject": "‼️ Webhook Request Received - 2026-09-12 17:18:02",
"received_at": "2026-09-12T17:18:02+00:00",
"request": {
"method": "POST",
"content_type": "application/json",
"ip": "203.0.113.7",
"headers": 9,
"body_bytes": 40
},
"data": {
"query": { "src": "curl" },
"form": {},
"json": { "event": "user.created", "user_id": 12345 },
"files": []
}
}
```
| Field | Meaning |
|-------|---------|
| `ok` | `true` on success, `false` on error |
| `parser` | The parser used, or `default` |
| `subject` | The subject line of the email that was sent |
| `request.headers` | Number of headers received |
| `request.body_bytes` | Raw body length |
| `data.query` / `data.form` | Query string and form fields (always objects, never `[]`) |
| `data.json` | Decoded body when the Content-Type is JSON, otherwise `null` |
| `data.files` | Names of uploaded file fields |
Any 2xx is enough for most services to mark the delivery as succeeded and stop retrying.
## 🎨 Webhook Parsers
Parsers format webhooks from specific services into beautiful, readable emails. Add the parser name to the end of the URL. If a parser can't understand the payload, the email falls back to the standard raw format so nothing is lost.
### Available Parsers
#### GitHub (`/github`)
Formats GitHub webhook events with full event details.
**Supported events:**
- Push events (each commit as a card with a linked sha, author, and full multi-line message)
- Pull requests
- Issues
- Releases
- Everything else in a clean generic layout
**Example URL:**
```
https://your-domain.com/test%40example.com/github
```
Header names are matched case-insensitively, so deliveries over HTTP/2 (where headers arrive lowercase) work correctly.
#### Grafana / Prometheus Alertmanager (`/grafana`)
Formats Alertmanager webhook payloads from Grafana or Prometheus.
**What you get:**
- Firing or resolved status in the subject and header
- Group labels, common labels, and common annotations
- Each alert as its own card with labels, annotations, start and end times, and a link to the generator
**Example URL:**
```
https://your-domain.com/test%40example.com/grafana
```
#### JSON (`/json`)
Renders any JSON body as tables. Nested objects are split into separate tables with path-based breadcrumbs (for example `order->items->[0]->tags`), so you can find a deeply nested value without squinting at raw JSON.
**Handles:**
- Objects and arrays of objects
- Arrays of plain values, as one table under their breadcrumb
- Scalar bodies (a bare string, number, boolean, or `null`)
- Multi-line string values, with line breaks preserved
**Example URL:**
```
https://your-domain.com/test%40example.com/json
```
#### Webex Interact (`/wxinteract`)
Formats Webex Interact SMS API webhook events into clean, readable emails.
**Supported events:**
- 📤 Outbound SMS - Submitted
- ✅ Outbound SMS - Delivered
- ❌ Outbound SMS - Failed
- 🔗 Shortlink Clicked
- 📥 Inbound SMS Received
- 🚫 SMS Opt Out Received
- 👤 Contacts Callback
**Example URL:**
```
https://your-domain.com/test%40example.com/wxinteract
```
**What you get:**
- Event-specific formatting with relevant emojis
- Message content displayed in a message box, line breaks intact
- Contact and campaign information
- Error details for failed messages
- Click tracking details for shortlinks
- Custom fields support for contact callbacks
**Test samples available in:** `wxinteract_test_samples.json`
See also the [Webex Interact Guide](WEBEX_INTERACT_GUIDE.md).
### Creating Your Own Parser
A parser is one Go function of type `Parser` in `parser_{name}.go`, registered in the `parsers` map in `main.go`. Build the body with `section`, `table`, and `row`, escape free text with `esc`, and wrap it with `emailShell` so it picks up the shared design. See the [Parser Development Guide](PARSER_PROMPT.md) for details.
---
## 💡 Usage Examples ## 💡 Usage Examples
### cURL - POST Request with JSON ### cURL - POST Request with JSON
@@ -43,70 +191,165 @@ curl -X POST https://your-domain.com/test%40example.com \
### cURL - GET Request with Parameters ### cURL - GET Request with Parameters
```bash ```bash
curl https://your-domain.com/test%40example.com?event=test&id=123 curl "https://your-domain.com/test%40example.com?event=test&id=123"
``` ```
### JavaScript - Fetch API ### JavaScript - Fetch API
```javascript ```javascript
fetch('https://your-domain.com/test%40example.com', { fetch('https://your-domain.com/' + encodeURIComponent('test@example.com'), {
method: 'POST', method: 'POST',
headers: { headers: { 'Content-Type': 'application/json' },
'Content-Type': 'application/json', body: JSON.stringify({ event: 'order.completed', order_id: 'ORD-789', total: 99.99 })
},
body: JSON.stringify({
event: 'order.completed',
order_id: 'ORD-789',
total: 99.99
})
}); });
``` ```
### Python - Requests Library ### Python - Requests Library
```python ```python
import requests import requests
from urllib.parse import quote
response = requests.post( response = requests.post(
'https://your-domain.com/test%40example.com', f'https://your-domain.com/{quote("test@example.com")}',
json={'event': 'payment.received', 'amount': 250.00}, json={'event': 'payment.received', 'amount': 250.00},
headers={'X-Custom-Header': 'MyValue'} headers={'X-Custom-Header': 'MyValue'},
) )
print(response.text) print(response.json())
```
### With GitHub Parser
Configure your GitHub webhook with:
```
https://your-domain.com/yourname%40company.com/github
```
When events occur, you'll receive formatted emails like:
**Push Event:**
```
📤 GitHub push - yourname/your-repo
Repository: yourname/your-repo
Branch: refs/heads/main
Commits: 3
Pusher: developerUsername
Commits:
abc1234 John Doe
Fix bug in authentication
def5678 Jane Smith
Update dependencies
```
**Pull Request:**
```
🔀 GitHub pull_request (opened) - yourname/your-repo
Number: #42
Title: Add new authentication method
State: open
Branch: feature-auth → main
```
### With Grafana Parser
Point a Grafana contact point or Alertmanager webhook receiver at:
```
https://your-domain.com/yourname%40company.com/grafana
```
**Firing alert:**
```
🚨 Grafana Alert: firing - 1 alert
Status: 🔥 firing
Receiver: email
Alert Count: 1
Alert 1 - firing
alertname: HighCPU
instance: web-01
severity: critical
summary: CPU over 90% for 5m
Started At: 2026-09-11T17:00:00Z
```
### With Webex Interact Parser
Configure your Webex Interact API callback URL with:
```
https://your-domain.com/yourname%40company.com/wxinteract
```
**Outbound SMS - Submitted:**
```
📤 Webex Interact: Outbound SMS - Submitted
Message ID: msg_123456789
To: +61412345678
From: +61387654321
Campaign ID: camp_987654321
Submitted At: 2026-01-22T16:45:00Z
Message Content:
Hello! Your appointment is confirmed for tomorrow at 2 PM.
``` ```
## 📦 Installation ## 📦 Installation
1. Clone the repository: ### Run the binary
```bash ```bash
git clone https://github.com/andydixon/webhook.git git clone https://github.com/andydixon/webhook.git
cd webhook
go build -o webhooks .
LISTEN=127.0.0.1:8080 SMTP_ADDR=127.0.0.1:25 MAIL_FROM=no-reply@example.com ./webhooks
``` ```
2. Upload the files to your web server (ensure PHP is installed and configured) Put a reverse proxy (nginx, Caddy) in front for TLS. The service reads `X-Real-IP` / `X-Forwarded-For` from a private-address proxy to report the real client IP.
3. Ensure the web server has permission to send emails (PHP `mail()` function) ### Run the container
4. Access the root URL to view the documentation page ```bash
docker build -t webhooks.dixon.cx:latest .
docker run --rm -p 127.0.0.1:29593:8080 webhooks.dixon.cx:latest
```
The image is a static binary on `distroless`, runs as non-root, listens on `:8080`, and relays mail to `172.17.0.1:25` (the Docker host's SMTP server) by default. `deploy/webhooks.dixon.cx.service` is the systemd unit used in production.
### Configuration
| Variable | Default | Meaning |
|----------|---------|---------|
| `LISTEN` | `127.0.0.1:8080` | Address to listen on (`:8080` in the container) |
| `SMTP_ADDR` | `127.0.0.1:25` | SMTP relay, no auth or TLS (`172.17.0.1:25` in the container) |
| `MAIL_FROM` | `no-reply@webhook.me.uk` | Envelope and From address |
| `PUBLIC_HOST` | `webhook.me.uk` | Host shown in email footers |
`/healthz` returns `ok`, and `webhooks -check` exits non-zero if a running instance is unhealthy (used by the image's `HEALTHCHECK`).
## 🔧 Requirements ## 🔧 Requirements
- PHP 7.0 or higher - Go 1.24 or newer to build (no third-party dependencies), or Docker
- Web server (Apache, Nginx, etc.) - An SMTP server that accepts mail from the service's address
- PHP `mail()` function enabled
- Outbound SMTP/email capability
## 📧 What You Receive ## 📧 What You Receive
Each webhook email contains: Every email shares one design: a gradient header with the event title and a timestamp pill, then a white card of sections. Metadata is rendered as real HTML tables so it lays out correctly in Gmail, Outlook, and Apple Mail. Code and raw payloads sit in dark code blocks.
The standard (no parser) email contains:
- **Request Timestamp**: Exact date and time when the webhook was received - **Request Timestamp**: Exact date and time when the webhook was received
- **Request Information**: IP address, HTTP method, and Content-Type - **Request Information**: IP address, HTTP method, and Content-Type
- **Request Headers**: All HTTP headers sent with the request - **Request Headers**: All HTTP headers sent with the request
- **Request Body**: Complete raw body content (JSON, XML, form data, etc.) - **Request Body**: Complete raw body content (JSON, XML, form data, etc.)
- **PHP Variables**: Parsed GET, POST, REQUEST, and FILES superglobals - **Parsed Variables**: GET, POST, REQUEST, and FILES superglobals as pretty-printed JSON
## 🔒 Security Features ## 🔒 Security Features
- **Email Validation**: Only valid email addresses are accepted - **Email Validation**: Only valid email addresses are accepted
- **XSS Protection**: All output is sanitized using `htmlspecialchars()` - **XSS Protection**: All output is HTML-escaped; free-text values go through `esc`, which also preserves line breaks
- **No Data Storage**: Webhook data is forwarded immediately and not stored - **No Data Storage**: Webhook data is forwarded immediately and not stored
- **Error Logging**: Failed email attempts are logged for monitoring - **Error Logging**: Failed email attempts are logged for monitoring
@@ -129,28 +372,46 @@ Each webhook email contains:
## 🎯 Common Use Cases ## 🎯 Common Use Cases
- **Debugging**: See exactly what data third-party services are sending - **Debugging**: See exactly what data third-party services are sending
- **GitHub Notifications**: Get beautifully formatted emails for pushes, PRs, and issues
- **Alerting**: Grafana and Prometheus alerts in your inbox without a whole notification stack
- **Integration Testing**: Test webhook integrations before implementing full handlers - **Integration Testing**: Test webhook integrations before implementing full handlers
- **Monitoring**: Monitor webhook activity and payload changes over time - **Monitoring**: Monitor webhook activity and payload changes over time
- **Documentation**: Capture real examples for API documentation - **Documentation**: Capture real examples for API documentation
- **Development**: Quickly test webhook flows during development - **Development**: Quickly test webhook flows during development
- **Troubleshooting**: Diagnose issues with webhook payloads and headers - **Troubleshooting**: Diagnose issues with webhook payloads and headers
- **Custom Parsers**: Add your own parsers for Stripe, GitLab, Slack, etc.
## 💡 Tips & Best Practices ## 💡 Tips & Best Practices
- **Email Filtering**: Create an email filter for the subject line "‼️ Webhook Request Received" to organize incoming webhooks - **Use Parsers**: Use `/github`, `/grafana`, `/json`, or `/wxinteract` for prettier emails
- **Email Filtering**: Create email filters based on subject patterns ("📤 GitHub", "🚨 Grafana") to organize webhooks
- **Plus Addressing**: Use email plus addressing (e.g., `yourname+github%40gmail.com`) to track which services are sending webhooks - **Plus Addressing**: Use email plus addressing (e.g., `yourname+github%40gmail.com`) to track which services are sending webhooks
- **Timestamp in Emails**: Check the "Date Received" field to verify webhook timing and debug delivery delays - **Timestamp in Emails**: Check the timestamp in the header to verify webhook timing and debug delivery delays
- **Parse the Body**: The raw body section contains the exact payload - perfect for copying into your code for testing - **Standard Format**: Use the standard format (no parser) when you need complete raw data for debugging
- **Create Parsers**: Build custom parsers for your favorite services - see [Parser Guide](PARSER_PROMPT.md)
## 📝 Error Handling ## 📝 Error Handling
### Invalid Email Address ### Invalid Email Address
If the email address in the URL is invalid or missing: If the email address in the URL is invalid or missing, you get a `400 Bad Request` with a JSON body:
``` ```json
HTTP 400 Bad Request {
Invalid email address provided in URL path. "ok": false,
"error": "invalid_email",
"message": "Invalid email address provided in URL path.",
"hint": "Encode @ as %40, e.g. /you%40example.com"
}
``` ```
### Unknown Parser or Unparseable Payload
The request still succeeds. The email uses the standard raw format and the response reports the parser name you asked for.
### Mail Delivery Failure
If the SMTP relay rejects the message you get a `502` with `"error": "mail_failed"`, so the sending service will retry rather than believe the webhook was delivered.
### Body Too Large
Bodies over 10 MB get a `413` with `"error": "body_too_large"`.
## 📄 License ## 📄 License
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details. This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
@@ -171,6 +432,30 @@ Give a ⭐️ if this project helped you!
## 📜 Version History ## 📜 Version History
- **3.0.0** - Go Rewrite
- ♻️ The whole service is now a single Go binary with no dependencies; PHP, Apache, and `.htaccess` are gone
- 🐳 Static `distroless` image, non-root, built-in health check
- 📧 Mail goes over SMTP with a quoted-printable body and an RFC 2047 subject, so emoji subjects survive every relay
- 🔁 A failed send returns `502 mail_failed` instead of a false `200`
- 🧪 `go test ./...` covers routing, the JSON response, IP forwarding, and every parser
- Email output and the JSON response are byte-for-byte compatible with 2.1.0, with JSON object keys kept in sender order
- **2.1.0** - JSON Response and Email Redesign
- ✨ **NEW**: Structured JSON response for every request, including errors
- ✨ **NEW**: Grafana / Prometheus Alertmanager parser (`/grafana`)
- ✨ **NEW**: Generic JSON parser (`/json`) with path breadcrumbs, scalar bodies, and arrays of plain values
- ✨ **NEW**: Redesigned landing page with a URL builder
- 🎨 One shared email design (`emailShell()`) across every template, built on real tables
- 🐛 Line breaks preserved in commit messages, SMS text, and JSON values
- 🐛 GitHub event headers matched case-insensitively (fixes "Unknown" events over HTTP/2)
- **2.0.0** - Parser System Release
- ✨ **NEW**: Custom parser support for formatted webhooks
- ✨ **NEW**: GitHub webhook parser with full event support
- ✨ **NEW**: Webex Interact SMS parser
- ✨ **NEW**: Parser development guide (PARSER_PROMPT.md)
- Backward compatible with existing webhook URLs
- **1.0.0** - Initial release - **1.0.0** - Initial release
- Basic webhook forwarding functionality - Basic webhook forwarding functionality
- HTML email formatting - HTML email formatting
@@ -179,4 +464,4 @@ Give a ⭐️ if this project helped you!
--- ---
Built with PHP and ADHD medication 💊 Built with Go and ADHD medication 💊
+380
View File
@@ -0,0 +1,380 @@
# Webex Interact Webhook Parser Guide
## Overview
The Webex Interact parser (`/wxinteract`) formats SMS API webhook events from Webex Interact into clean, readable HTML emails. Each event type gets custom formatting with relevant emojis for easy identification.
## Configuration
### URL Format
```
https://your-domain.com/{your-email}/wxinteract
```
### Example
```
https://webhook.me.uk/sms-notifications%40mycompany.com/wxinteract
```
## Supported Events
The parser automatically detects the event type based on the `data.status` field in the webhook payload.
### 📤 Outbound SMS - Submitted
**Status:** `submitted`
Triggered when an SMS message is submitted to the carrier for delivery.
**Fields displayed:**
- Message ID
- To (recipient phone number)
- From (sender phone number)
- Campaign ID
- Submitted At (timestamp)
- Message Content (formatted in a clean message box)
**Example payload:**
```json
{
"data": {
"status": "submitted",
"message_id": "msg_123456789",
"to": "+61412345678",
"from": "+61387654321",
"message": "Hello! Your appointment is confirmed for tomorrow at 2 PM.",
"submitted_at": "2026-01-22T16:45:00Z",
"campaign_id": "camp_987654321"
}
}
```
---
### ✅ Outbound SMS - Delivered
**Status:** `delivered`
Triggered when an SMS message is successfully delivered to the recipient.
**Fields displayed:**
- Message ID
- To (recipient phone number)
- From (sender phone number)
- Campaign ID
- Delivered At (timestamp)
**Example payload:**
```json
{
"data": {
"status": "delivered",
"message_id": "msg_123456789",
"to": "+61412345678",
"from": "+61387654321",
"delivered_at": "2026-01-22T16:46:15Z",
"campaign_id": "camp_987654321"
}
}
```
---
### ❌ Outbound SMS - Failed
**Status:** `failed`
Triggered when an SMS message fails to deliver.
**Fields displayed:**
- Message ID
- To (recipient phone number)
- From (sender phone number)
- Campaign ID
- Failed At (timestamp)
- Error Code (highlighted in error box)
- Error Message (highlighted in error box)
**Example payload:**
```json
{
"data": {
"status": "failed",
"message_id": "msg_987654321",
"to": "+61499999999",
"from": "+61387654321",
"failed_at": "2026-01-22T16:47:00Z",
"error_code": "ERR_INVALID_NUMBER",
"error_message": "The destination number is invalid or not reachable",
"campaign_id": "camp_987654321"
}
}
```
---
### 🔗 Shortlink Clicked
**Status:** `shortlink_clicked`
Triggered when a recipient clicks a tracked shortlink in an SMS message.
**Fields displayed:**
- Shortlink (clickable)
- Original URL (clickable)
- Phone Number (recipient who clicked)
- Message ID
- Campaign ID
- Clicked At (timestamp)
- IP Address (of the click)
- User Agent (browser/device information)
**Example payload:**
```json
{
"data": {
"status": "shortlink_clicked",
"shortlink": "https://wxint.co/abc123",
"original_url": "https://example.com/special-offer",
"clicked_at": "2026-01-22T17:30:45Z",
"phone_number": "+61412345678",
"message_id": "msg_123456789",
"campaign_id": "camp_987654321",
"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15",
"ip_address": "203.0.113.45"
}
}
```
---
### 📥 Inbound SMS Received
**Status:** `received`
Triggered when an inbound SMS is received from a recipient.
**Fields displayed:**
- Message ID
- From (sender phone number)
- To (your phone number)
- Keyword (detected keyword)
- Received At (timestamp)
- Message Content (formatted in a clean message box)
**Example payload:**
```json
{
"data": {
"status": "received",
"message_id": "msg_inbound_001",
"from": "+61412345678",
"to": "+61387654321",
"message": "YES I would like to receive updates",
"received_at": "2026-01-22T18:00:00Z",
"keyword": "YES"
}
}
```
---
### 🚫 SMS Opt Out Received
**Status:** `opt_out`
Triggered when a recipient opts out of receiving SMS messages (typically by replying "STOP").
**Fields displayed:**
- Phone Number (who opted out)
- From Number (your SMS number)
- Keyword (e.g., "STOP")
- Message ID
- Opt Out At (timestamp)
**Example payload:**
```json
{
"data": {
"status": "opt_out",
"phone_number": "+61412345678",
"opt_out_at": "2026-01-22T18:15:00Z",
"keyword": "STOP",
"message_id": "msg_optout_001",
"from": "+61387654321"
}
}
```
---
### 👤 Contacts Callback
**Status:** `contact_created` or `contact_updated`
Triggered when a contact is created or updated in your Webex Interact account.
**Fields displayed:**
- Contact ID
- Phone Number
- First Name
- Last Name
- Email
- Status
- Created At (timestamp)
- Updated At (timestamp)
- Custom Fields (if present, displayed in a separate section)
**Example payload:**
```json
{
"data": {
"status": "contact_created",
"contact_id": "contact_abc123",
"phone_number": "+61412345678",
"first_name": "John",
"last_name": "Smith",
"email": "john.smith@example.com",
"created_at": "2026-01-22T19:00:00Z",
"updated_at": "2026-01-22T19:00:00Z",
"custom_fields": {
"company": "Acme Corporation",
"department": "Sales",
"customer_id": "CUST_12345"
}
}
}
```
---
## Testing
### Using cURL
Test individual event types using the sample payloads:
```bash
# Test Outbound SMS Submitted
curl -X POST https://your-domain.com/test%40example.com/wxinteract \
-H "Content-Type: application/json" \
-d '{"data": {"status": "submitted", "message_id": "msg_123", "to": "+61412345678", "from": "+61387654321", "message": "Test message", "submitted_at": "2026-01-22T16:45:00Z", "campaign_id": "camp_001"}}'
# Test SMS Opt Out
curl -X POST https://your-domain.com/test%40example.com/wxinteract \
-H "Content-Type: application/json" \
-d '{"data": {"status": "opt_out", "phone_number": "+61412345678", "opt_out_at": "2026-01-22T18:15:00Z", "keyword": "STOP", "message_id": "msg_005", "from": "+61387654321"}}'
```
### Using Test Samples
A complete set of test samples for all event types is available in `wxinteract_test_samples.json`.
```bash
# Test with submitted event
cat wxinteract_test_samples.json | jq '.outbound_sms_submitted' | \
curl -X POST https://your-domain.com/test%40example.com/wxinteract \
-H "Content-Type: application/json" \
-d @-
```
---
## Configuring in Webex Interact
### Step 1: Log in to Webex Interact
Go to your Webex Interact dashboard at https://interact.webex.com/
### Step 2: Navigate to API Settings
1. Click on **Settings** or **API** in the navigation menu
2. Look for **Webhooks** or **API Callbacks** section
### Step 3: Configure Callback URL
1. Enter your webhook URL: `https://your-domain.com/{your-email}/wxinteract`
2. Select the events you want to receive:
- ☑️ Outbound SMS - Submitted
- ☑️ Outbound SMS - Delivered
- ☑️ Outbound SMS - Failed
- ☑️ Shortlink Clicked
- ☑️ Inbound SMS Received
- ☑️ SMS Opt Out Received
- ☑️ Contacts Callback
3. Save your configuration
### Step 4: Test the Integration
1. Send a test SMS from Webex Interact
2. Check your email inbox for the formatted webhook notification
3. Verify the email contains the correct information
---
## Email Organization Tips
### Create Email Filters
Set up filters based on the subject line patterns:
- **All Webex Interact webhooks:** Subject contains "Webex Interact"
- **Failed messages only:** Subject contains "❌ Webex Interact: Outbound SMS - Failed"
- **Opt-outs only:** Subject contains "🚫 Webex Interact: SMS Opt Out"
- **Click tracking:** Subject contains "🔗 Webex Interact: Shortlink Clicked"
### Use Plus Addressing
Track different campaigns or environments:
- Production: `sms-prod%40mycompany.com`
- Staging: `sms-staging%40mycompany.com`
- Campaign A: `sms+campaignA%40mycompany.com`
---
## Troubleshooting
### Parser Not Working
If you're receiving raw webhook data instead of formatted emails:
1. **Check URL:** Ensure `/wxinteract` is at the end of the URL
2. **Check payload structure:** Parser expects `{"data": {"status": "...", ...}}`
3. **Check the container logs:** `docker logs webhooks.dixon.cx` shows mail failures and parser errors
### Missing Fields
If some fields are showing as "N/A":
- The webhook payload may not include those fields for that event type
- Check the Webex Interact documentation for the specific event
- Use the raw webhook format (without `/wxinteract`) to see the complete payload
### Wrong Event Type
If the event is being parsed as a generic event:
- Check that `data.status` matches one of the supported values
- Supported values: `submitted`, `delivered`, `failed`, `shortlink_clicked`, `received`, `opt_out`, `contact_created`, `contact_updated`
---
## API Documentation References
Official Webex Interact webhook documentation:
- [Outbound SMS - Submitted](https://docs.webexinteract.com/reference/sms-api-request-accepted)
- [Outbound SMS - Delivered](https://docs.webexinteract.com/reference/outbound-sms-delivered)
- [Outbound SMS - Failed](https://docs.webexinteract.com/reference/outbound-sms-failed)
- [Shortlink Clicked](https://docs.webexinteract.com/reference/shortlink-clicked)
- [Inbound SMS Events](https://docs.webexinteract.com/reference/inbound-sms-events)
- [SMS Opt Out Received](https://docs.webexinteract.com/reference/sms-opt-out-received)
- [Contacts Callback](https://docs.webexinteract.com/reference/contacts-callback)
---
## Support
For issues with:
- **This parser:** Open an issue on the GitHub repository
- **Webex Interact API:** Contact Webex Interact support
---
Built with ❤️ for better webhook debugging
+16
View File
@@ -0,0 +1,16 @@
[Unit]
Description=webhooks.dixon.cx (docker container)
After=docker.service network-online.target
Requires=docker.service
Wants=network-online.target
[Service]
Restart=always
RestartSec=5
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker rm -f webhooks.dixon.cx
ExecStart=/usr/bin/docker run --rm --memory 256m --cpus 1.0 --pids-limit 128 --name webhooks.dixon.cx -p 127.0.0.1:29593:8080 webhooks.dixon.cx:latest
ExecStop=/usr/bin/docker stop -t 30 webhooks.dixon.cx
[Install]
WantedBy=multi-user.target
-491
View File
@@ -1,491 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Webhook Email Forwarder - Documentation</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
<style>
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 40px 0;
}
.doc-container {
background: white;
border-radius: 15px;
box-shadow: 0 10px 40px rgba(0,0,0,0.2);
padding: 40px;
margin-bottom: 40px;
}
.hero {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 60px 40px;
border-radius: 15px;
margin-bottom: 40px;
text-align: center;
}
.code-block {
background: #f8f9fa;
border-left: 4px solid #667eea;
padding: 15px;
border-radius: 5px;
font-family: 'Courier New', monospace;
overflow-x: auto;
}
.feature-card {
border: none;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: transform 0.2s;
height: 100%;
}
.feature-card:hover {
transform: translateY(-5px);
}
.badge-custom {
font-size: 0.85rem;
padding: 0.5em 0.8em;
}
h2 {
color: #667eea;
margin-top: 30px;
margin-bottom: 20px;
}
h3 {
color: #764ba2;
margin-top: 25px;
margin-bottom: 15px;
}
.alert-info {
border-left: 4px solid #0dcaf0;
}
.alert-warning {
border-left: 4px solid #ffc107;
}
.alert-success {
border-left: 4px solid #198754;
}
</style>
</head>
<body>
<div class="container">
<!-- Hero Section -->
<div class="hero">
<h1 class="display-4"><i class="bi bi-webhook"></i> Webhook Email Forwarder</h1>
<p class="lead">A simple, elegant solution for debugging webhooks by forwarding them directly to your email</p>
<p class="mb-0">Version 1.0 | Made with ❤️ by Andy Dixon</p>
</div>
<!-- Overview Section -->
<div class="doc-container">
<h2><i class="bi bi-info-circle"></i> Overview</h2>
<p class="lead">This webhook service captures incoming HTTP requests and forwards complete request details (headers, body, metadata) to your specified email address.</p>
<div class="row mt-4">
<div class="col-md-4 mb-3">
<div class="card feature-card">
<div class="card-body text-center">
<i class="bi bi-envelope-check text-primary" style="font-size: 3rem;"></i>
<h5 class="card-title mt-3">Email Delivery</h5>
<p class="card-text">Receive webhook data directly in your inbox</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card feature-card">
<div class="card-body text-center">
<i class="bi bi-shield-check text-success" style="font-size: 3rem;"></i>
<h5 class="card-title mt-3">Secure</h5>
<p class="card-text">Email validation and XSS protection built-in</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card feature-card">
<div class="card-body text-center">
<i class="bi bi-lightning-charge text-warning" style="font-size: 3rem;"></i>
<h5 class="card-title mt-3">Instant</h5>
<p class="card-text">Real-time webhook processing and forwarding</p>
</div>
</div>
</div>
</div>
</div>
<!-- How It Works Section -->
<div class="doc-container">
<h2><i class="bi bi-gear"></i> How It Works</h2>
<ol class="lead">
<li>You configure a third-party service to send webhooks to this URL with your email encoded in the path</li>
<li>When a webhook request arrives, the service captures all request data</li>
<li>The complete request details are formatted into a readable HTML email</li>
<li>The email is sent to your specified address</li>
<li>A confirmation response is returned to the webhook sender</li>
</ol>
<div class="alert alert-info mt-4">
<i class="bi bi-lightbulb"></i> <strong>Perfect for:</strong> Debugging webhooks, testing integrations, monitoring API callbacks, and understanding third-party service payloads.
</div>
</div>
<!-- Usage Section -->
<div class="doc-container">
<h2><i class="bi bi-code-square"></i> Usage</h2>
<h3>Basic URL Format</h3>
<p>The URL format is simple - just append your URL-encoded email address to the domain:</p>
<div class="code-block mb-4">
https://<?php echo $_SERVER['HTTP_HOST']; ?>/<strong>{email-address}</strong>
</div>
<h3>URL Encoding Your Email</h3>
<p>The <code>@</code> symbol must be URL-encoded as <code>%40</code>:</p>
<div class="row mt-3">
<div class="col-md-6">
<div class="card">
<div class="card-header bg-light">
<strong>Original Email</strong>
</div>
<div class="card-body">
<code>john@example.com</code>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-header bg-light">
<strong>Webhook URL</strong>
</div>
<div class="card-body">
<code><?php echo $_SERVER['HTTP_HOST']; ?>/john%40example.com</code>
</div>
</div>
</div>
</div>
<h3 class="mt-4">Example Requests</h3>
<h4>cURL - POST Request with JSON</h4>
<div class="code-block">
curl -X POST https://<?php echo $_SERVER['HTTP_HOST']; ?>/test%40example.com \
-H "Content-Type: application/json" \
-d '{"event": "user.created", "user_id": 12345}'
</div>
<h4 class="mt-3">cURL - GET Request with Parameters</h4>
<div class="code-block">
curl https://<?php echo $_SERVER['HTTP_HOST']; ?>/test%40example.com?event=test&id=123
</div>
<h4 class="mt-3">JavaScript - Fetch API</h4>
<div class="code-block">
fetch('https://<?php echo $_SERVER['HTTP_HOST']; ?>/test%40example.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
event: 'order.completed',
order_id: 'ORD-789',
total: 99.99
})
});
</div>
<h4 class="mt-3">Python - Requests Library</h4>
<div class="code-block">
import requests
response = requests.post(
'https://<?php echo $_SERVER['HTTP_HOST']; ?>/test%40example.com',
json={'event': 'payment.received', 'amount': 250.00},
headers={'X-Custom-Header': 'MyValue'}
)
print(response.text)
</div>
<div class="alert alert-warning mt-4">
<i class="bi bi-exclamation-triangle"></i> <strong>Important:</strong> Make sure to URL-encode your email address. Most programming languages and tools have built-in functions for this (e.g., <code>encodeURIComponent()</code> in JavaScript, <code>urllib.parse.quote()</code> in Python).
</div>
</div>
<!-- Response Section -->
<div class="doc-container">
<h2><i class="bi bi-arrow-return-left"></i> What to Expect</h2>
<h3>Immediate HTTP Response</h3>
<p>When your webhook is successfully received, you'll get an immediate response:</p>
<div class="card">
<div class="card-header bg-success text-white">
<strong>HTTP 200 OK</strong>
</div>
<div class="card-body">
<div class="code-block">
Webhook received and forwarded to: test@example.com
Request data:
Array
(
[event] => test
[id] => 123
)
</div>
</div>
</div>
<h3 class="mt-4">Email Contents</h3>
<p>Within moments, you'll receive a styled HTML email containing:</p>
<div class="row mt-3">
<div class="col-md-6 mb-3">
<div class="card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-clock"></i> Request Timestamp</h5>
<p class="card-text">Exact date and time when the webhook was received</p>
</div>
</div>
</div>
<div class="col-md-6 mb-3">
<div class="card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-info-square"></i> Request Information</h5>
<p class="card-text">IP address, HTTP method (GET/POST/etc), and Content-Type</p>
</div>
</div>
</div>
<div class="col-md-6 mb-3">
<div class="card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-list-ul"></i> Request Headers</h5>
<p class="card-text">All HTTP headers sent with the request</p>
</div>
</div>
</div>
<div class="col-md-6 mb-3">
<div class="card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-file-earmark-text"></i> Request Body</h5>
<p class="card-text">Complete raw body content (JSON, XML, form data, etc.)</p>
</div>
</div>
</div>
<div class="col-md-12 mb-3">
<div class="card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-code-slash"></i> PHP Variables</h5>
<p class="card-text">Parsed GET, POST, REQUEST, and FILES superglobals for easy access</p>
</div>
</div>
</div>
</div>
<div class="alert alert-success mt-4">
<i class="bi bi-check-circle"></i> <strong>Subject Line:</strong> Emails arrive with the subject <strong>"‼️ Webhook Request Received - [timestamp]"</strong> for easy filtering and identification.
</div>
</div>
<!-- Error Handling Section -->
<div class="doc-container">
<h2><i class="bi bi-exclamation-octagon"></i> Error Handling</h2>
<h3>Invalid Email Address</h3>
<p>If the email address in the URL is invalid or missing, you'll receive:</p>
<div class="card">
<div class="card-header bg-danger text-white">
<strong>HTTP 400 Bad Request</strong>
</div>
<div class="card-body">
<div class="code-block">
Invalid email address provided in URL path.
</div>
</div>
</div>
<div class="alert alert-info mt-4">
<i class="bi bi-shield-check"></i> <strong>Validation:</strong> The service validates email addresses using PHP's built-in <code>FILTER_VALIDATE_EMAIL</code> filter to ensure proper formatting.
</div>
</div>
<!-- Security Section -->
<div class="doc-container">
<h2><i class="bi bi-shield-lock"></i> Security Features</h2>
<ul class="lead">
<li><strong>Email Validation:</strong> Only valid email addresses are accepted</li>
<li><strong>XSS Protection:</strong> All output is sanitized using <code>htmlspecialchars()</code></li>
<li><strong>No Data Storage:</strong> Webhook data is forwarded immediately and not stored on the server</li>
<li><strong>Error Logging:</strong> Failed email attempts are logged for monitoring</li>
</ul>
<div class="alert alert-warning">
<i class="bi bi-exclamation-triangle"></i> <strong>Privacy Note:</strong> Anyone with your webhook URL can send data to your email address. Only use this service for testing and debugging purposes. Do not use for sensitive production data without additional authentication.
</div>
</div>
<!-- Supported Features Section -->
<div class="doc-container">
<h2><i class="bi bi-check2-square"></i> Supported Features</h2>
<div class="row">
<div class="col-md-6">
<h5><i class="bi bi-check-circle text-success"></i> HTTP Methods</h5>
<ul>
<li>GET</li>
<li>POST</li>
<li>PUT</li>
<li>PATCH</li>
<li>DELETE</li>
<li>Any custom method</li>
</ul>
</div>
<div class="col-md-6">
<h5><i class="bi bi-check-circle text-success"></i> Content Types</h5>
<ul>
<li>application/json</li>
<li>application/x-www-form-urlencoded</li>
<li>multipart/form-data</li>
<li>text/plain</li>
<li>text/xml</li>
<li>Any custom content type</li>
</ul>
</div>
</div>
</div>
<!-- Use Cases Section -->
<div class="doc-container">
<h2><i class="bi bi-star"></i> Common Use Cases</h2>
<div class="row">
<div class="col-md-4 mb-3">
<div class="card feature-card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-bug"></i> Debugging</h5>
<p class="card-text">See exactly what data third-party services are sending to your webhooks</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card feature-card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-plugin"></i> Integration Testing</h5>
<p class="card-text">Test webhook integrations before implementing full handlers</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card feature-card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-eye"></i> Monitoring</h5>
<p class="card-text">Monitor webhook activity and payload changes over time</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card feature-card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-book"></i> Documentation</h5>
<p class="card-text">Capture real examples for API documentation</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card feature-card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-diagram-3"></i> Development</h5>
<p class="card-text">Quickly test webhook flows during development</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card feature-card">
<div class="card-body">
<h5 class="card-title"><i class="bi bi-search"></i> Troubleshooting</h5>
<p class="card-text">Diagnose issues with webhook payloads and headers</p>
</div>
</div>
</div>
</div>
</div>
<!-- Tips Section -->
<div class="doc-container">
<h2><i class="bi bi-lightbulb"></i> Tips & Best Practices</h2>
<div class="alert alert-info">
<h5><i class="bi bi-envelope-at"></i> Email Filtering</h5>
<p class="mb-0">Create an email filter for the subject line "‼️ Webhook Request Received" to organize incoming webhooks in your inbox.</p>
</div>
<div class="alert alert-info">
<h5><i class="bi bi-plus-slash-minus"></i> Use Plus Addressing</h5>
<p class="mb-0">Use email plus addressing (e.g., <code>yourname+github%40gmail.com</code>) to track which services are sending webhooks.</p>
</div>
<div class="alert alert-info">
<h5><i class="bi bi-clock-history"></i> Timestamp in Emails</h5>
<p class="mb-0">Check the "Date Received" field in emails to verify webhook timing and debug delivery delays.</p>
</div>
<div class="alert alert-info">
<h5><i class="bi bi-code"></i> Parse the Body</h5>
<p class="mb-0">The raw body section contains the exact payload - perfect for copying into your code for testing.</p>
</div>
</div>
<!-- Quick Start Section -->
<div class="doc-container">
<h2><i class="bi bi-rocket-takeoff"></i> Quick Start</h2>
<p class="lead">Get started in 3 simple steps:</p>
<div class="row">
<div class="col-md-4 mb-3">
<div class="card text-center feature-card border-primary">
<div class="card-body">
<div class="display-4 text-primary">1</div>
<h5 class="card-title mt-3">Encode Your Email</h5>
<p class="card-text">Replace <code>@</code> with <code>%40</code> in your email address</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card text-center feature-card border-success">
<div class="card-body">
<div class="display-4 text-success">2</div>
<h5 class="card-title mt-3">Configure Webhook</h5>
<p class="card-text">Use <code><?php echo $_SERVER['HTTP_HOST']; ?>/{your-email}</code> as the webhook URL</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card text-center feature-card border-warning">
<div class="card-body">
<div class="display-4 text-warning">3</div>
<h5 class="card-title mt-3">Check Your Inbox</h5>
<p class="card-text">Receive detailed webhook data instantly in your email</p>
</div>
</div>
</div>
</div>
<div class="text-center mt-4">
<h5>Try it now!</h5>
<div class="code-block text-start d-inline-block">
curl -X POST https://<?php echo $_SERVER['HTTP_HOST']; ?>/YOUR-EMAIL-HERE \
-d '{"test": "Hello World!"}'
</div>
</div>
</div>
<!-- Footer -->
<div class="text-center text-white mt-5">
<p class="mb-1"><i class="bi bi-code-slash"></i> Built with PHP and ADHD medication</p>
<p><small>© 2025-2026 Andy Dixon | <a href="https://<?php echo $_SERVER['HTTP_HOST']; ?>/" class="text-white"><?php echo $_SERVER['HTTP_HOST']; ?></a></small></p>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
+300
View File
@@ -0,0 +1,300 @@
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Webhook → Email: forward any webhook to your inbox | {{.Canonical}}</title>
<meta name="description" content="Point any webhook at a URL with your email in it. Get the whole request in your inbox. That's it. That's the product.">
<link rel="canonical" href="https://{{.Canonical}}/">
<meta name="robots" content="index, follow">
<meta name="author" content="Andy Dixon">
<meta name="theme-color" content="#0047ab">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="icon" href="/favicon.ico" sizes="16x16 32x32 48x48">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<meta property="og:type" content="website">
<meta property="og:site_name" content="webhook→email">
<meta property="og:title" content="Webhooks. Straight to your inbox.">
<meta property="og:description" content="Point any webhook at a URL with your email in it. Get the whole request in your inbox. No signup, no dashboard.">
<meta property="og:url" content="https://{{.Canonical}}/">
<meta property="og:image" content="https://{{.Canonical}}/og.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Webhooks. Straight to your inbox. https://{{.Canonical}}/you%40example.com">
<meta property="og:locale" content="en_GB">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Webhooks. Straight to your inbox.">
<meta name="twitter:description" content="Point any webhook at a URL with your email in it. Get the whole request in your inbox. No signup, no dashboard.">
<meta name="twitter:image" content="https://{{.Canonical}}/og.png">
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebApplication","name":"webhook→email","url":"https://{{.Canonical}}/","description":"Forward any webhook to your inbox as a formatted email. Parsers for GitHub, Grafana, JSON and Webex Interact.","applicationCategory":"DeveloperApplication","operatingSystem":"Any","isAccessibleForFree":true,"offers":{"@type":"Offer","price":"0","priceCurrency":"GBP"},"author":{"@type":"Person","name":"Andy Dixon","url":"https://dixon.cx/"}}
</script>
<style>
:root{
--bg:#ffffff;--panel:#f6f8fc;--line:#e3e7ef;
--text:#0a0a0a;--muted:#4a4f5c;--dim:#7a8090;
--blue:#0047ab;--blue-dark:#003380;--blue-soft:#eef3fb;
--mono:ui-monospace,SFMono-Regular,"JetBrains Mono",Menlo,Consolas,monospace;
--sans:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,"Helvetica Neue",Arial,sans-serif;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--text);font-family:var(--sans);line-height:1.6;font-size:17px;-webkit-font-smoothing:antialiased}
a{color:var(--blue)}
.wrap{max-width:900px;margin:0 auto;padding:0 20px}
::selection{background:var(--blue);color:#fff}
/* nav */
nav{display:flex;align-items:center;justify-content:space-between;padding:22px 0;font-size:14px;border-bottom:1px solid var(--line)}
nav .brand{font-family:var(--mono);font-weight:700;letter-spacing:-.02em}
nav .brand span{color:var(--blue)}
nav ul{display:flex;gap:22px;list-style:none;margin:0;padding:0}
nav a{text-decoration:none;color:var(--muted)}nav a:hover{color:var(--blue)}
@media(max-width:600px){nav ul{display:none}}
/* hero */
.hero{padding:64px 0 48px}
.eyebrow{font-family:var(--mono);font-size:13px;color:var(--blue);letter-spacing:.12em;text-transform:uppercase;margin-bottom:18px}
h1{font-size:clamp(2.4rem,6.5vw,4.6rem);line-height:1;letter-spacing:-.04em;margin:0 0 22px;font-weight:800}
h1 em{font-style:normal;color:var(--blue)}
.hero p{font-size:clamp(1.05rem,2vw,1.3rem);color:var(--muted);max-width:640px;margin:0 0 30px}
.hero p b{color:var(--text);font-weight:600}
/* url builder */
.builder{border:1px solid var(--line);border-radius:12px;padding:20px}
.builder label{display:block;font-size:12px;color:var(--dim);font-family:var(--mono);letter-spacing:.1em;text-transform:uppercase;margin-bottom:8px}
.builder input{width:100%;font:inherit;font-size:1.1rem;padding:12px 14px;border-radius:8px;background:#fff;border:1px solid #c9cfdb;color:var(--text);outline:none}
.builder input:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(0,71,171,.15)}
.url{margin-top:14px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.url code{flex:1;min-width:0;font-family:var(--mono);font-size:.95rem;word-break:break-all;padding:12px 14px;border-radius:8px;background:var(--panel);border:1px solid var(--line)}
.url code b{color:var(--blue);font-weight:600}
button.copy{font:inherit;font-size:.9rem;font-weight:600;padding:12px 18px;border-radius:8px;border:0;cursor:pointer;background:var(--blue);color:#fff;white-space:nowrap}
button.copy:hover{background:var(--blue-dark)}
button.copy:active{transform:scale(.97)}
.hint{font-size:.85rem;color:var(--dim);margin:12px 0 0}
/* sections */
section{padding:56px 0;border-top:1px solid var(--line)}
h2{font-size:clamp(1.6rem,4vw,2.2rem);letter-spacing:-.03em;margin:0 0 8px;line-height:1.15}
.sub{color:var(--muted);margin:0 0 28px;max-width:640px}
h3{font-size:1.1rem;margin:28px 0 10px;letter-spacing:-.01em}
.tangent{color:var(--dim);font-size:.92rem;font-style:italic}
p code,li code{font-family:var(--mono);font-size:.88em;background:var(--panel);border:1px solid var(--line);padding:2px 6px;border-radius:5px;color:var(--blue-dark)}
pre{margin:0;background:#0a0a0a;border-radius:10px;padding:16px 18px;font-family:var(--mono);font-size:.9rem;line-height:1.55;overflow-x:auto;color:#e8e8e8;position:relative}
pre::before{content:attr(data-lang);position:absolute;top:8px;right:12px;font-size:11px;color:#8a8a8a;letter-spacing:.1em;text-transform:uppercase}
pre .h{color:#8a8a8a}pre .s{color:#8fb8ff}pre .k{color:#ffffff;font-weight:600}
.stack{display:grid;gap:14px}
/* steps */
.steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px;counter-reset:s}
.step{border:1px solid var(--line);border-radius:12px;padding:22px;counter-increment:s}
.step::before{content:"0" counter(s);font-family:var(--mono);font-size:2rem;font-weight:800;line-height:1;color:var(--blue);display:block;margin-bottom:12px}
.step b{display:block;font-size:1.05rem;margin-bottom:4px}
.step span{color:var(--muted);font-size:.95rem}
/* parsers */
.parsers{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:14px}
.parser{border:1px solid var(--line);border-radius:12px;padding:20px;transition:border-color .15s}
.parser:hover{border-color:var(--blue)}
.parser .ico{font-size:1.6rem;margin-bottom:8px}
.parser code{display:inline-block;font-family:var(--mono);font-size:.85rem;font-weight:700;color:var(--blue);margin-bottom:8px}
.parser p{margin:0;color:var(--muted);font-size:.95rem}
/* inbox list */
.inbox{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px;list-style:none;padding:0;margin:0}
.inbox li{padding:14px 16px;background:var(--panel);border-radius:10px;font-size:.95rem}
.inbox li b{display:block;color:var(--text)}
.inbox li span{color:var(--muted)}
/* callouts */
.note{border-left:3px solid var(--blue);padding:14px 18px;background:var(--blue-soft);border-radius:0 10px 10px 0;margin:22px 0}
.note.warn{border-color:var(--text);background:var(--panel)}
.note b{color:var(--text)}
.note p{margin:0;color:var(--muted)}
/* chips */
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.chip{font-family:var(--mono);font-size:.8rem;padding:5px 11px;border:1px solid var(--line);border-radius:999px;color:var(--muted)}
footer{padding:40px 0 60px;border-top:1px solid var(--line);color:var(--dim);font-size:.9rem;display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}
footer a{color:var(--muted)}
</style>
</head>
<body>
<div class="wrap">
<nav>
<div class="brand"><span>webhook</span>→email</div>
<ul>
<li><a href="#start">Start</a></li>
<li><a href="#examples">Examples</a></li>
<li><a href="#parsers">Parsers</a></li>
<li><a href="#inbox">Inbox</a></li>
<li><a href="#faq">Caveats</a></li>
</ul>
</nav>
<div class="hero">
<div class="eyebrow">// no signup. no dashboard. no, seriously.</div>
<h1>Webhooks.<br>Straight to <em>your inbox.</em></h1>
<p>Put your email in the URL. Point a webhook at it. Every header, every byte of body, every superglobal shows up as an email. <b>Done. Go do the next thing.</b></p>
<div class="builder">
<label for="em">Type your email → get your URL</label>
<input id="em" type="email" placeholder="you@example.com" autocomplete="email" spellcheck="false">
<div class="url">
<code>https://{{.Host}}/<b id="out">you%40example.com</b></code>
<button class="copy" id="cp">Copy</button>
</div>
<p class="hint">Yes the <code>@</code> becomes <code>%40</code>. Yes that's the whole trick. Add <code>/github</code>, <code>/json</code>, etc. on the end for the fancy parsers — more on that below, if you scroll that far.</p>
</div>
</div>
<section id="start">
<h2>Three steps. Two, really.</h2>
<p class="sub">The third one is just "wait for an email", which you were going to do anyway.</p>
<div class="steps">
<div class="step"><b>Encode your email</b><span><code>@</code> → <code>%40</code>. The box above already did it for you. Ok moving on.</span></div>
<div class="step"><b>Paste the URL into whatever</b><span>Stripe, GitHub, Grafana, that cron job, a curl you're about to forget you wrote.</span></div>
<div class="step"><b>Check your inbox</b><span>Full request, nicely formatted. Subject starts with ‼️ so it's filterable. You're welcome.</span></div>
</div>
<h3>The fastest possible test</h3>
<pre data-lang="bash">curl -X POST https://{{.Host}}/<span class="s" id="ex1">you%40example.com</span> \
-d '{"test": "hello, is this thing on"}'</pre>
<p class="tangent">(the email will arrive before you've alt-tabbed back. probably. depends on your mail server. anyway.)</p>
</section>
<section id="examples">
<h2>Examples, because reading is hard</h2>
<p class="sub">Any method, any content type. GET, POST, PUT, PATCH, DELETE, something you made up. JSON, form data, multipart, XML, plain text, a string of emoji. It all gets forwarded.</p>
<div class="stack">
<pre data-lang="bash"><span class="h"># JSON</span>
curl -X POST https://{{.Host}}/<span class="s ex">you%40example.com</span> \
-H "Content-Type: application/json" \
-d '{"event": "user.created", "user_id": 12345}'
<span class="h"># GET with query string (yes, this works too)</span>
curl "https://{{.Host}}/<span class="s ex">you%40example.com</span>?event=test&id=123"</pre>
<pre data-lang="javascript"><span class="k">fetch</span>(<span class="s">'https://{{.Host}}/'</span> + <span class="k">encodeURIComponent</span>(<span class="s">'you@example.com'</span>), {
method: <span class="s">'POST'</span>,
headers: { <span class="s">'Content-Type'</span>: <span class="s">'application/json'</span> },
body: JSON.stringify({ event: <span class="s">'order.completed'</span>, order_id: <span class="s">'ORD-789'</span>, total: 99.99 })
});</pre>
<pre data-lang="python"><span class="k">import</span> requests
<span class="k">from</span> urllib.parse <span class="k">import</span> quote
requests.post(
<span class="s">f'https://{{.Host}}/{quote("you@example.com")}'</span>,
json={<span class="s">'event'</span>: <span class="s">'payment.received'</span>, <span class="s">'amount'</span>: 250.00},
headers={<span class="s">'X-Custom-Header'</span>: <span class="s">'MyValue'</span>},
)</pre>
</div>
<div class="note">
<p><b>Pro tip you'll ignore and then come back for:</b> use plus addressing. <code>you+stripe%40example.com</code>, <code>you+github%40example.com</code>. Now your inbox filters do the sorting so you don't have to.</p>
</div>
</section>
<section id="parsers">
<h2>Parsers. Ooh, shiny.</h2>
<p class="sub">Add one word to the end of the URL and the email stops being a wall of raw JSON and starts being something you can actually read at 3am. Parser doesn't understand the payload? It falls back to the raw format. Nothing gets lost.</p>
<div class="parsers">
<div class="parser"><div class="ico">🐙</div><code>/github</code><p>Push, pull request, issue and release events get their own layout with commits, authors, branches and links. Everything else still renders, just less fancy. Subjects like <em>📤 GitHub push - you/repo</em>.</p></div>
<div class="parser"><div class="ico">📈</div><code>/grafana</code><p>Grafana and Prometheus Alertmanager alerts. Firing, resolved, labels, annotations. Finally know <em>which</em> thing is on fire.</p></div>
<div class="parser"><div class="ico">🧩</div><code>/json</code><p>Any JSON at all, rendered as tables. Nested objects get split out into their own tables with path-based titles so you can find <code>data.items[3].sku</code> without squinting.</p></div>
<div class="parser"><div class="ico">💬</div><code>/wxinteract</code><p>Webex Interact SMS events. Inbound messages, delivery receipts, the lot, with the event type in the subject line.</p></div>
</div>
<h3>Setting up GitHub, since that's the one everyone asks about</h3>
<ol>
<li>Repo → Settings → Webhooks → Add webhook</li>
<li>Payload URL: <code>https://{{.Host}}/<span class="ex">you%40example.com</span>/github</code></li>
<li>Content type: <code>application/json</code></li>
<li>Pick events (or "Send me everything", live a little)</li>
<li>Save. Push something. Refresh inbox. Refresh again. There it is.</li>
</ol>
</section>
<section id="inbox">
<h2>What actually lands in your inbox</h2>
<p class="sub">One HTML email per request. Gmail-safe styling. All of the following, every time, whether you asked for it or not:</p>
<ul class="inbox">
<li><b>Timestamp</b><span>when it arrived, to the second</span></li>
<li><b>Source IP + method</b><span>who sent it and how</span></li>
<li><b>Content-Type</b><span>what they claimed it was</span></li>
<li><b>Every header</b><span>auth, signatures, user agents, the weird custom ones</span></li>
<li><b>Raw body</b><span>byte-for-byte, ready to paste into a test</span></li>
<li><b>Parsed superglobals</b><span>$_GET, $_POST, $_REQUEST, $_FILES</span></li>
</ul>
<h3>And the sender gets</h3>
<pre data-lang="http 200 · application/json">{
<span class="k">"ok"</span>: true,
<span class="k">"message"</span>: <span class="s">"Webhook received and forwarded to you@example.com"</span>,
<span class="k">"forwarded_to"</span>: <span class="s">"you@example.com"</span>,
<span class="k">"parser"</span>: <span class="s">"default"</span>,
<span class="k">"subject"</span>: <span class="s">"‼️ Webhook Request Received - 2026-09-11 17:15:42"</span>,
<span class="k">"received_at"</span>: <span class="s">"2026-09-11T17:15:42+00:00"</span>,
<span class="k">"request"</span>: { <span class="k">"method"</span>: <span class="s">"POST"</span>, <span class="k">"content_type"</span>: <span class="s">"application/json"</span>, <span class="k">"ip"</span>: <span class="s">"203.0.113.7"</span>, <span class="k">"headers"</span>: 9, <span class="k">"body_bytes"</span>: 40 },
<span class="k">"data"</span>: {
<span class="k">"query"</span>: { <span class="k">"src"</span>: <span class="s">"curl"</span> },
<span class="k">"form"</span>: {},
<span class="k">"json"</span>: { <span class="k">"event"</span>: <span class="s">"user.created"</span>, <span class="k">"user_id"</span>: 12345 },
<span class="k">"files"</span>: []
}
}</pre>
<p class="tangent">JSON bodies get decoded and echoed back under <code>data.json</code>, so you can eyeball what the server actually understood. Form fields land in <code>form</code>, query string in <code>query</code>. No print_r in sight.</p>
<p class="tangent">Any 200 is enough for most services to mark the delivery as "succeeded" and stop retrying. Which is the point.</p>
</section>
<section id="faq">
<h2>Caveats, small print, that sort of thing</h2>
<div class="note warn">
<p><b>Anyone with the URL can email you.</b> There's no auth. There's no secret. It's your email address in a URL. Use it for debugging and testing. Do not point production payment data at it. Don't make me put a bigger warning here.</p>
</div>
<h3>Stuff that's true</h3>
<ul>
<li><b>Nothing is stored.</b> Request comes in, email goes out, request is forgotten. No logs of your payloads, no database, no "insights".</li>
<li><b>Output is escaped.</b> Everything is run through <code>htmlspecialchars()</code> before it hits the email, so a malicious payload renders as text, not as a thing.</li>
<li><b>Bad email → HTTP 400, as JSON.</b> <code>{"ok": false, "error": "invalid_email", ...}</code> with a hint about <code>%40</code>. Validated with PHP's <code>FILTER_VALIDATE_EMAIL</code>. Boring, correct.</li>
<li><b>Failed sends get logged.</b> On the server side, for the person running it. Not for you. Sorry.</li>
</ul>
<h3>Good for</h3>
<div class="chips">
<span class="chip">debugging a webhook you didn't write</span>
<span class="chip">seeing what Stripe actually sends</span>
<span class="chip">capturing real payloads for docs</span>
<span class="chip">testing before the handler exists</span>
<span class="chip">"is it even firing?"</span>
<span class="chip">alerts in your inbox without a whole thing</span>
</div>
</section>
<footer>
<div>Built with Go and ADHD medication. Not necessarily in that order.</div>
<div>© 2025–2026 Andy Dixon · <a href="https://dixon.cx/">dixon.cx</a></div>
</footer>
</div>
<script>
(function(){
var em=document.getElementById('em'),out=document.getElementById('out'),cp=document.getElementById('cp');
var ex=document.querySelectorAll('.ex, #ex1');
function enc(v){return encodeURIComponent(v.trim()||'you@example.com');}
em.addEventListener('input',function(){
var e=enc(em.value);out.textContent=e;
ex.forEach(function(n){n.textContent=e;});
});
cp.addEventListener('click',function(){
var url=out.parentNode.textContent.replace(/\s+/g,'');
var done=function(){cp.textContent='Copied ✓';setTimeout(function(){cp.textContent='Copy';},1400);};
if(navigator.clipboard){navigator.clipboard.writeText(url).then(done);}
else{var r=document.createRange();r.selectNodeContents(out.parentNode);getSelection().removeAllRanges();getSelection().addRange(r);document.execCommand('copy');done();}
});
})();
</script>
</body>
</html>
+3
View File
@@ -0,0 +1,3 @@
module webhooks
go 1.24
Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Some files were not shown because too many files have changed in this diff Show More