Adding a private feedback box to Bear
My Bear homepage has a feedback box that lets people send private messages:
Here's how to add your own feedback box:
Open https://frogtab.com/help#registering-for-a-personal-link on your preferred device for receiving messages. (Side note: Frogtab is the task management app I've been blogging about here.)
Write a comment in the "Your experience" box, then click Send & Register. It doesn't really matter what you write - I suggest writing the address of your Bear blog so that I can check out your blog!
Click Open My Personal Link, then make a note of the ID in the URL.
For example, my personal link is:
https://frogtab.com/send#03ae6b6f-1134-4e7b-83ed-deaae4b53af7
and my ID is:
03ae6b6f-1134-4e7b-83ed-deaae4b53af7
Add the following code to your Bear homepage:
<input id="message-box" type="text" placeholder="Send me a message…"> <button id="send-message" type="submit" onclick="onClickSend()">Send</button> <span id="message-status"></span> <script> const domMessageBox = document.getElementById("message-box"); const domMessageStatus = document.getElementById("message-status"); let encryptAndSend = null; async function onClickSend() { const message = domMessageBox.value.trim(); if (message == "") { return; } domMessageBox.value = ""; domMessageStatus.textContent = "⏳"; let success = false; try { if (!encryptAndSend) { const frogtab = await import("https://frogtab.com/open/sdk.js"); encryptAndSend = await frogtab.connectToInbox("YOUR ID GOES HERE"); } success = await encryptAndSend(`Message from Bear: ${message}`); } catch (err) {} if (success) { domMessageStatus.textContent = "👍"; setTimeout(() => { domMessageStatus.textContent = ""; }, 3000); } else { domMessageBox.value = message; domMessageStatus.textContent = ""; } } </script>
Replace
YOUR ID GOES HERE
by your ID from step 3.You might want to customize the style of the feedback box and the send button. Here's the CSS I've added to my Bear theme:
#message-box { background-color: inherit; color: inherit; border: 1px solid; padding: 8px; font-size: 16px; width: calc(100% - 15px); } #send-message { font-size: 16px; }
That's it!
When someone sends a message, the message appears in your Frogtab inbox:
FAQs
Are messages really private?
Yes. Messages are encrypted on the sender's device and can only be decrypted using a private key that is stored on your device. For technical details, see Data flow in GitHub.
If you like, you can back up your private key. See Exporting your data in the Frogtab docs.
Help! Why haven't I received the test message I just sent?
Make sure you're checking for messages using the device you registered in step 2.
Also, messages may take up to 10 minutes to appear in Frogtab. To force Frogtab to check for new messages, refresh Frogtab.
How reliable/safe is this?
Although reliability and safety are important to me, I can't provide any guarantees. Frogtab is a hobby project that I'm primarily building for myself - but hopefully it can also be a positive contribution to the awesome Bear community 🙌