# Troubleshooting

When something doesn't arrive: the most common causes and where to look.

When something doesn't arrive, it's almost always one of a few causes. Find the heading below that matches what you see.

## First: the activity log

Every packlet has an activity log. In the channel, tap the avatar or name at the top, then tap **Activity log**. It lists the last 50 calls with their status:

- Calls from your tool that arrived: successful ones and those with `400`.
- Every attempt by Packlets to reach your webhook, with the status of your response.

> **Note:** Calls with `401`, `409` and `429` aren't in the log. If the key is wrong, Packlets doesn't know which packlet the call belongs to. So if the log stays empty, look at the response your tool got.

## The call fails

The response tells you why. Have your tool print the status and body:

| You get | Cause | Fix |
|---|---|---|
| `401` `missing_key` | The header is missing. | Set `Authorization: Bearer <key>`. Watch for the word `Bearer` and the space. |
| `401` `invalid_key` | The key is wrong. | Is the environment variable set and complete (`pk_` plus 32 characters)? Did you create a new key in the app? Then only the new one works. |
| `400` `invalid_body` | A field doesn't fit. | `details` names the field. Common: `text` is missing or empty, a text is too long, an `id` appears twice. |
| `400` without `error` from Packlets | The body isn't valid JSON. | Check quotes and commas. In the shell, put the body in single quotes. |
| `409` `wrong_kind` | `PUT /v1/ui` on a channel. | Connect again and choose **Your own app**. |
| `429` `rate_limited` | More than 60 calls per minute for this packlet, or more than 300 for your account. Services in the same channel count together. | Wait as `retry-after` says. Is a loop sending too often? |
| no response | Your tool can't reach Packlets. | Check the address: `https://api.packlets.app`. Does the machine have internet? |

All codes are listed under [Error codes](https://packlets.app/en/docs/fehler.md).

## The message is there, but no push

The call answers with `200`, the message is in the channel, but nothing shows up on the lock screen. Then the push was deliberately not sent, or the phone isn't showing it:

1. **Is push on for the packlet?** In the packlet's settings: push on, channel not muted.
2. **Is it quiet hours?** Then only `priority: "high"` gets through.
3. **Are notifications allowed for Packlets?** In your phone's settings under notifications.
4. **Is a Focus or "Do Not Disturb" active?** The phone holds back pushes then.
5. **Is this exact channel open right now?** Then the message appears directly in the history, without a banner. For an app, the banner also appears while it's open.

A push that didn't go out isn't sent later. More in [Push, sound and quiet hours](https://packlets.app/en/docs/push.md).

## The webhook doesn't arrive

You tap a button or use an element, but your tool doesn't notice. Look in the activity log:

| In the log | Cause | Fix |
|---|---|---|
| no webhook entry | The packlet has no webhook URL, or the button has a `url` and so is a link button. | Enter the webhook URL in the settings. For the button, leave out `url`. |
| Status `0` | Packlets can't reach the address: wrong address, server off, tunnel closed, response later than 10 seconds, or the address is private. | Check the address in a browser or with `curl` from outside. Respond faster. |
| Status `401` or `403` | Your tool rejects it, usually because of the signature. | See the next section. |
| Status `404` or `405` | The path is wrong, or your receiver doesn't accept `POST`. | Compare the address with your receiver's path, for example `/packlets`. |
| Status `301`, `302`, `308` | Your address redirects. Packlets doesn't follow redirects. | Enter the final address, often with `https://` or with `www`. |
| Status `500` | Your tool crashed while processing. | Check your tool's log. Packlets tries several more times. |
| Status `200` or `204` | The webhook arrived. | The problem is further on, in your logic. Print the event. |

If the address can't even be saved, it isn't allowed: it must start with `https://`, be publicly reachable and contain no credentials.

Events from the time the webhook was unreachable don't arrive later. Only the most recent attempts, for about ten minutes.

## The signature doesn't match

Your receiver gets the request, but the check fails. The usual reasons:

- **The body was changed.** Compute over the raw bytes, not over the JSON your framework made from them. In Flask that's `request.get_data()`, in Express you need `express.raw()` instead of `express.json()`.
- **The secret is built wrong.** It's the SHA-256 hash of the key as hex text, and that text is the HMAC key. Not the key itself and not the raw hash bytes.
- **The key is old.** After "Generate new key", the new one also applies to the signature.
- **The `sha256=` is missing** in your comparison. The header starts with it.

The finished code is in [Set up a webhook](https://packlets.app/en/docs/webhook.md#4-verify-the-signature).

## The app doesn't show what I expect

| What you see | Cause |
|---|---|
| The app keeps waiting for "Connected". | It's waiting for the first successful `POST /v1/push`, or for an app, the first `PUT /v1/ui`. |
| An element is wider or taller than specified. | Minimum sizes, or the app made room for the label. See [Layout](https://packlets.app/en/docs/layout.md). |
| Formatting shows up as characters. | Only headings, lists and bold are converted. See [Formatting](https://packlets.app/en/docs/senden.md#formatting). |
| The image is missing. | `image` must be a public `http(s)` address that the phone can load directly. |
| An action button can't be tapped again. | That's by design: once per message. For repeated taps, use a [button as an element](https://packlets.app/en/docs/nachrichten-elemente.md). |
| An app's page stays empty. | `https://` only. Open it in a browser and check that it loads there. |
| An app notification shows no image and no buttons. | Under the bell, only title, text and link appear. See [Send notifications](https://packlets.app/en/docs/apps.md#6-send-notifications). |
| A service sends, but `401 invalid_key`. | The service was removed in the channel's settings. Add it again. See [Services](https://packlets.app/en/docs/dienste.md). |

## Still unclear

Send the call once by hand with `curl -i`. That way you see the status, headers and body of the response, without your own code in between:

```bash
curl -i https://api.packlets.app/v1/push \
  -H "Authorization: Bearer $PACKLETS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Test"}'
```
