Trigger a Grok Bot routine from Paystack webhooks, with Hooksnode in front
- Author:
- hooksnode
- Published:
- Updated:
- paystack
- webhooks
A Grok Bot routine can start from a webhook. You give it a payment event, and it does the follow-up work: it checks the order, writes the note, tells your team. The catch is the way the routine's webhook is protected.
Grok Bot gives each webhook routine a URL and a key. The sender must send the key in an Authorization: Bearer <key> header. Paystack, Flutterwave and Stripe don't work that way. You give them a URL, and they sign each event with their own secret. They don't send your routine's key.
Hooksnode sits in the middle. The provider sends to one Hooksnode URL. Hooksnode checks the provider's signature, adds the routine's Authorization header, and sends the same event to your own backend at the same time. This guide sets that up for Paystack charge.success.
The setup
Paystack --signed POST--> https://hooksnode.com/p/<source-id>
| checks the Paystack signature
| (bad or missing signature: 401, nothing is sent)
|
+--> Grok Bot routine URL
| + Authorization: Bearer <routine key>
|
+--> https://api.yourapp.com/webhooks/paystack
+ X-Hooksnode-Signature
What you get:
- One URL in the Paystack dashboard. The routine's URL and key live only in Hooksnode. You never paste them into Paystack.
- A signature check before the routine runs. Hooksnode refuses events that don't carry a valid Paystack signature, so a forged request never reaches the routine or your backend.
- Retries for each destination. If the routine endpoint doesn't answer
2xx, Hooksnode tries again, without slowing delivery to your backend. - Change the key or the routine without touching Paystack. You edit one Hooksnode destination.
What Hooksnode does, and what it doesn't
Here is what the product does today, so you know what to expect.
| Step | What happens |
|---|---|
| Inbound check | A webhook source can require a signature. Pick the Paystack preset and paste your secret. Hooksnode checks Paystack-Signature when present (300 second window) and falls back to x-paystack-signature. Presets also exist for Flutterwave, Stripe and Meta. A missing or wrong signature gets 401. |
| Routine auth | Each destination has Extra headers: fixed headers added to every request to that destination. Set Authorization: Bearer <routine key> there. Hooksnode never forwards the inbound Authorization header, so the extra header is the only one the routine sees. |
| Outbound signing | Optional, per destination. Hooksnode adds X-Hooksnode-Signature, either sha256=<hex> (an HMAC SHA256 of the delivered body) or a timestamped t=<unix>,v1=<hex> format, picked under the destination's signature format. Use it on your own backend, or on any receiver that checks it. |
| Provider headers | Hooksnode forwards the original headers, including Paystack's signature header, and keeps the body byte for byte unless you add a transform. |
| Retries | Up to 25 delivery attempts in total for each destination. The wait grows each time and never goes over 1 hour, so all 25 take about 17.5 hours. Each attempt waits up to 15 seconds for an answer. |
| Dead deliveries | After the last attempt the delivery is dead. Retry it from the event page, from the Needs retry view on the Events page, or from the API. |
| Replay | Send an old event again to every active destination, or to one destination. |
| Delivery guarantee | At least once, never exactly once. Hooksnode adds no idempotency key when it delivers. Your routine and your backend must handle a repeat. |
Set it up
1. Create the Grok Bot routine
Ask your Bot for a routine with a webhook trigger, and write the instruction around the event it will get (there's an example below). Then open the routine on desktop. Its Webhook section shows three fields:
- POST to: the routine URL.
- key: the secret.
- header: the full
Authorization: Bearer ...line.
Keep the key secret. You'll paste it into Hooksnode in step 3, and nowhere else.
2. Create a Hooksnode project and turn on the Paystack check
- Create a project in Hooksnode. Its webhook source has a URL like
https://hooksnode.com/p/<source-id>. - Open the source and turn on signature verification.
- Choose the Paystack format and paste your Paystack secret as given. Paste the webhook signing secret (
whsec_...) if your events carryPaystack-Signature. Paste the secret key if they only carryx-paystack-signature.
The full walkthrough, with the exact field names, is in Verify a Paystack webhook signature.
3. Add the Grok Bot routine as a destination
Open Destinations → Add destination:
- Name:
Grok Bot routine - URL: the routine's POST to URL
- Extra headers:
{
"Authorization": "Bearer <routine key>"
}
- Filter: send the routine only the events it needs (see the next section).
- Transform: optional. Use it to send the routine only the fields it needs.
Hooksnode masks the Authorization value in event search and exports.
4. Add your backend as a second destination
Add a destination for your own handler, for example https://api.yourapp.com/webhooks/paystack. Turn on Signing, copy the secret into your backend's environment, and check X-Hooksnode-Signature on the raw body. The signing docs have Node.js, Python, Go and PHP code.
Your backend still gets Paystack's own signature header too. But a retry can arrive more than 5 minutes after the event, and Paystack's timestamped header then fails its window. X-Hooksnode-Signature doesn't have that problem.
5. Point Paystack at Hooksnode
In your Paystack dashboard, set the webhook URL to your Hooksnode source URL. That's the only URL Paystack needs.
6. Test it
Make a test payment in Paystack test mode. Then check three places:
- The Hooksnode event page shows one event with a delivery to each destination.
- The Grok Bot destination's attempt shows
200. For Grok Bot,200means it accepted the call and started a run, not that the run has finished. - The Bot's chat shows the run's result.
Example: Paystack charge.success to Grok Bot
Filter: only successful charges
On the Grok Bot destination, set this filter:
{ "event": "charge.success" }
Every routine run spends Grok Bot usage, and Grok Bot limits how often routines can run each hour. Don't wake the routine for events it will ignore. Your backend destination can have no filter and get everything.
Hooksnode filters match exact values only. There is no "greater than", so you can't filter on amount. If the routine should only act on large payments, put that rule in the routine's instruction.
Transform: send only what the routine needs
A Paystack event carries the customer's details. If the routine doesn't need all of them, trim the body for that destination only. Your backend still gets the full event.
{
"event": {{printf "%q" .event}},
"reference": {{printf "%q" .data.reference}},
"amount_kobo": {{printf "%.0f" .data.amount}},
"currency": {{printf "%q" .data.currency}},
"paid_at": {{printf "%q" .data.paid_at}},
"email": {{printf "%q" .data.customer.email}}
}
Two things to know:
- Hooksnode runs the transform first, then the filter. Keep
eventin the transformed body, or the filter above stops matching. - A transform changes the body, so Paystack's signature no longer matches it. That's fine here: the Paystack check already happened at the Hooksnode source, and Grok Bot checks only the key.
Use the Test panel in the destination editor to run the transform and filter on a sample body before you save. Nothing is sent.
The routine's instruction
The body reaches the routine run together with its instruction. Write the instruction for that body, and make it safe to run twice:
When a webhook wakes you, read the Paystack event in the body. Act only if
eventischarge.success. First check whether you already handled thisreference. If you did, stop and report nothing. Otherwise look up the order for that reference, confirm the amount matches, and post a one-line summary in this chat: reference, amount in naira, customer email. Never contact the customer.
Handle duplicates
Hooksnode delivers at least once, never exactly once. Paystack can also send the same event again. So the routine and your backend can each see the same charge.success twice.
- Dedupe on Paystack's
data.reference. That's the ID Paystack gives the charge. Hooksnode adds no idempotency key of its own on delivery, so don't wait for one. - Your backend: store the reference in a table with a unique constraint, in the same transaction as the work. If it's already there, answer
200and stop. - Your routine: each routine run starts fresh and doesn't remember earlier runs. Give it somewhere to check, such as your own backend or a sheet the routine can read, and put the check first in the instruction.
Hooksnode does drop an exact resend of a signed request (same body, same signature) within 10 minutes. That cuts some repeats, but it isn't a guarantee, so keep the reference check.
Change the key or the routine without touching Paystack
- New routine key. Paste it into the Grok Bot destination's extra headers. Each delivery attempt reads the destination's current headers, so retries still waiting will use the new key. Paystack doesn't change.
- New routine URL. Update the destination's URL. Retries still queued for the old URL stop when the URL changes. Use Replay to one destination for any events the new routine should still get.
- Pause the routine. A paused routine doesn't answer
200, so Hooksnode keeps retrying for about 17.5 hours. Resume within that time and the events arrive. After that, the deliveries aredead. Retry them from the Needs retry view.
When things go wrong
| What you see | What it means | What to do |
|---|---|---|
Paystack gets 401 from Hooksnode |
Wrong or missing Paystack signature, or the wrong secret pasted | Check the secret in the source's Paystack preset |
| Grok Bot destination attempts fail | The routine is paused, the key is old, or the URL is wrong | Fix it in Grok Bot or the destination. Hooksnode keeps retrying, and you can retry dead deliveries |
Attempt shows 200, but no result in chat |
Grok Bot started the run. The run itself failed or is still going | Check the routine's run history in Grok Bot |
Paystack gets 202 with "status":"held" |
Your workspace is out of credits | Add credits or upgrade. Held events are then delivered, oldest first, without Paystack resending. Held events don't wait forever, so don't leave it for days |
Paystack gets 402 |
Out of credits and the hold is full | Add credits. Paystack retries for up to 72 hours in live mode |
More on Paystack's own retries and why the redirect isn't proof of payment: Paystack callback vs webhook.
A real setup: GlitchTip alerts waking an engineering bot
This is our own team's setup at Mantissa. Our engineering bot wakes from an endpoint that has to be authenticated. GlitchTip can send webhook alerts, but it can't add custom auth headers, so it couldn't call that endpoint directly. We put Hooksnode in the middle.
On a project Free plan ($0 a month), which allows one source, we created one Hooksnode source for GlitchTip and one destination pointing at the bot's wake link. On that destination we turned on outbound signing with the timestamped signature format. Every request to the bot now carries X-Hooksnode-Signature with a t= timestamp and a v1= signature. The bot's wake routine checks that signature, so no password or token ever had to live in GlitchTip.
In GlitchTip, an alert rule on a backend project fires on a single event in a 1 minute window and posts to the Hooksnode source URL. A test alert went from GlitchTip through Hooksnode to the bot and woke it, and it has been live since. Destinations also support extra headers (JSON), transforms and filters, but we didn't need them.
There are two ways to authenticate the last hop, and both work. You can put the receiver's own key in an extra header, as with a Grok Bot routine's Authorization: Bearer key. Or the receiver can check Hooksnode's signature, as our bot does. Either way, the sender only knows a Hooksnode URL, and you don't share a secret with every sender.
Flutterwave and Stripe
The same setup works with the Flutterwave and Stripe presets. Only the event name in the filter and the ID you dedupe on change:
| Provider | Filter example | Dedupe on | Guide |
|---|---|---|---|
| Paystack | {"event": "charge.success"} |
data.reference |
Verify a Paystack signature |
| Flutterwave | {"event": "charge.completed"} |
data.tx_ref |
Flutterwave redirect vs webhook |
| Stripe | {"type": "payment_intent.succeeded"} |
event id |
Stripe missed webhook events |
For the general pattern of one provider webhook going to many services, see Payment gateway webhooks: send one event to many services.
Credits and plans
Each event Hooksnode receives uses one credit, however many destinations it goes to. Each retry or replay you start uses one credit. Automatic retries don't use extra credits. A project Free plan is $0 a month with 100,000 credits and up to 5 destinations. A project Pro plan is $10 a month with 1,000,000 credits and up to 50 destinations. Both are hard caps. See pricing.
FAQ
Why not paste the routine URL straight into Paystack?
Grok Bot expects the key in an Authorization header, and Paystack doesn't send one. Even if it did, you'd be putting the routine's secret into the payment dashboard and checking Paystack's signature nowhere.
Does Hooksnode sign the request it sends to Grok Bot?
It can, if you turn on signing for that destination. Grok Bot's documented webhook check is the bearer key, so the main setup in this guide uses the Authorization extra header. If your wake routine checks X-Hooksnode-Signature instead, as in our GlitchTip setup above, signing alone works too.
Can I use this with GitHub?
Yes. Create the source with the Meta signature preset and use your GitHub webhook secret as the source secret. GitHub signs with X-Hub-Signature-256 (sha256 HMAC of the raw body), which is exactly what that preset checks. Hooksnode does not check the older sha1 X-Hub-Signature header. Then add the routine as a destination with the Authorization extra header, as above.