queuebear 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -491,6 +491,76 @@ The signing secret is available in your QueueBear project settings. When configu
|
|
|
491
491
|
|
|
492
492
|
---
|
|
493
493
|
|
|
494
|
+
## Local Development
|
|
495
|
+
|
|
496
|
+
When developing locally, your webhook endpoints run on `localhost` which isn't accessible from QueueBear's servers. Use a tunnel service to expose your local server.
|
|
497
|
+
|
|
498
|
+
### Using ngrok (Recommended)
|
|
499
|
+
|
|
500
|
+
[ngrok](https://ngrok.com) provides stable URLs and a built-in request inspector.
|
|
501
|
+
|
|
502
|
+
**1. Install and authenticate:**
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
# Install
|
|
506
|
+
brew install ngrok # or download from ngrok.com/download
|
|
507
|
+
|
|
508
|
+
# Authenticate (free account required)
|
|
509
|
+
ngrok config add-authtoken YOUR_AUTH_TOKEN
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
**2. Start the tunnel:**
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
ngrok http 3000
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
**3. Use the forwarding URL:**
|
|
519
|
+
|
|
520
|
+
```typescript
|
|
521
|
+
// Use ngrok URL instead of localhost
|
|
522
|
+
await qb.messages.publish("https://abc123.ngrok.io/api/webhooks", {
|
|
523
|
+
event: "user.created",
|
|
524
|
+
userId: "123"
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
// Works for workflows too
|
|
528
|
+
await qb.workflows.trigger(
|
|
529
|
+
"onboarding",
|
|
530
|
+
"https://abc123.ngrok.io/api/workflows/onboarding",
|
|
531
|
+
{ userId: "123" }
|
|
532
|
+
);
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
**Debugging:** ngrok provides a web inspector at `http://localhost:4040` to view requests, responses, and replay failed deliveries.
|
|
536
|
+
|
|
537
|
+
### Using localtunnel
|
|
538
|
+
|
|
539
|
+
[localtunnel](https://localtunnel.me) is free and requires no signup.
|
|
540
|
+
|
|
541
|
+
```bash
|
|
542
|
+
npx localtunnel --port 3000
|
|
543
|
+
# Output: your url is: https://good-months-leave.loca.lt
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
**Note:** localtunnel shows a reminder page on first visit. Bypass it by adding a header:
|
|
547
|
+
|
|
548
|
+
```typescript
|
|
549
|
+
await qb.messages.publish(
|
|
550
|
+
"https://good-months-leave.loca.lt/api/webhooks",
|
|
551
|
+
{ event: "test" },
|
|
552
|
+
{ headers: { "bypass-tunnel-reminder": "true" } }
|
|
553
|
+
);
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### Tips
|
|
557
|
+
|
|
558
|
+
- Store your tunnel URL in `.env` for easy switching between local and production
|
|
559
|
+
- Both `callbackUrl` and `failureCallbackUrl` need public URLs for local testing
|
|
560
|
+
- ngrok URLs change on restart (stable URLs require a paid plan)
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
494
564
|
## License
|
|
495
565
|
|
|
496
566
|
MIT
|