How can I use links in Slack which deep link back into my Slack bot? - node.js

I have a Slack bot that, in response to a /command - a search query - can display a list of matched database entries. I would like to present this list as a clickable link + short summary for each of the DB entries (using blocks).
Example:
Clicking the link for any entry should tell the Slack bot to display the full database record as a new Slack message.
I can't figure out how to get a link to do anything other than open the browser. None of the options for deep linking, or linking to a bot mention appear to be suitable.
Can anyone think of a solution for this? I would prefer not to give each list entry a button or accessory to 'open' the link.
already tried :
Each item as an https:// link to the node app behind the bot, passing the title to be displayed. This works but opens a browser window in the interim.
Mentioning the bot in a link <#ABOTID>Title to open

You can only deep link to existing messages, but not use links the same way you can use buttons.
You could of course link directly to your app, but that would always also open the browser, which as you say you don't want.
So for blocks you are left with the option you already mentioned: putting a button next to each entry in the form of a Section with a button.
An alternative would be to use Secondary Attachments. Those are automatically collapsed for longer text and the user gets a button he can click to expand them.

Related

Chrome Extension overwrite existing webpage

I will try to make this as short as possible. I am making a Chrome extension and I wanted to have an integrated settings tab so users can customize their experience. Now, I want this settings tab to be somewhat of an "extension" to an existing settings tab in a website. Let me explain.
The website I am talking about is Roblox.com, a popular gaming platform. When logged in, you have the ability to visit your settings, which look something like this:
Now, in order to navigate the different setting "tabs," you simply click on a button and it takes you to another change. The URL corresponding to each page is https://www.roblox.com/my/account#!/TAB_NAME, with TAB_NAME being the name of the tab. What I want to do is make my own "tab" where once the player clicks, it will bring them to a settings tab where they can tweak the extension's settings. This would look something like this:
I am fully aware on how to this (inject a button into the list and customize said button), but what I don't know what to do is make it so that once the button is clicked, it will not redirect you to another website, but will simply "switch tabs" like it would with any other setting. There is an extension that already does that called "Roblox+", where it adds a button to the list, and once clicked, it takes you to a similar-looking page with the URL https://www.roblox.com/my/account?tab=rplus#!/info. From my understanding, since the tab name isn't a header, the URL does not change, which allows for a custom webpage. Now, if you were to paste that URL in a browser without the extension, then it would simply redirect you to the "Account Info" tab (although the URL remains). Here is how the Roblox+ extension settings page looks like:
Now, from what I can assume, what happens is that right after the normal account information page is loaded, it removes all the HTML elements that are related to the account information tab and re-creates the entire page using custom HTML elements. That is something similar to what I want to do. Regardless of this, I do have one question. Is it possible to somehow "overwrite" a certain domain so that, let's say, the URL https://www.roblox.com/my/account#!/my_plugin_settings led to my custom page (even if that means that the page is made from an HTML file) instead of where it was supposed to lead? If that isn't possible, would it be better to create a custom settings page outside of the Roblox website or somehow inject my own into the current settings?
This is the question that I have. Hopefully I explained it well. If someone could assist me on this, then that would be amazing. Thank you for your time and help, I truly appreciate it.

Gmail - Link to Draft in non-conversation view

I am importing/creating drafts in Gmail using the Gmail API. After creation I'd like to redirect the user to the Gmail UI with the opened Draft in the composer window.
I made it work properly for https://mail.google.com/mail/#drafts?compose=[MESSAGE ID]. Other urls I found here also worked well. Gmail is doing some redirects and eventually the composer window is opened with the draft.
Now my issue:
If the user has not enabled "Conversation view" this will not work at all. The redirect will then result in https://mail.google.com/mail/u/0/#drafts?compose=new and only an empty, new composer window is shown and a new draft is created by the UI.
If I open the draft directly the ID-format is different. https://mail.google.com/mail/u/0/#drafts?compose=hJzgZpSqgLQcCWgZqnlNRzRBfMbjZVnZklzvcFxhQCdwT... and I have no idea if this format can be generated somehow.
Does anybody has an idea or experience to also make it work with this UI setting. How I can force Gmail to load the draft into the composer window?
Thanks in advance.
If you have Email Threading > Conversation View enabled
Make use of the following URL
https://mail.google.com/mail/u/0/#inbox?compose=DRAFT_MESSAGE_ID
If you have disabled the Email Threading > Conversation View option
Make use of the following URL
https://mail.google.com/mail/u/0/#inbox/DRAFT_MESSAGE_ID
Additional information
The main difference between them is that the first is treated as a conversation while the second example is not.
You can use #drafts instead of #inbox in the URL.
The number after .../mail/u/ is the session you have opened
You can retrieve the DRAFT_MESSAGE_ID by making a request to the API
You can approximately generate the compose ID by yourself, there are some examples out there (not recommended). I strongly recommend you to use the DRAFT_MESSAGE_ID instead.
This appears to still be an issue the one solution I did find was that you can find your draft directly (even though it would be the last draft) and go through multiple accounts by redirecting to
https://accounts.google.com/AccountChooser?authuser={user account}&Email={email account}&continue=https://mail.google.com/mail/#search/rfc822msgid:CAMU-31NcJCVHyGNsAycRKfuS0nMonoaZ6wFMD90Sej996qjuPQ#mail.gmail.com
You need to get your message id toi replace the area from <> from your draft. So you'll have to create the draft first. Get the google message ID, then use that with messages/get to get the Global Message Id (also referred to as message id) and then use that with a search. At this point you'll open a page with a search to a single draft but it will not be opened. Your users will have to click on the one message. Unfortunately there does not seem to be a way to have the good way work for conversation view, and this way work for non.
I tried many different URLS and nothing worked. As noted in the original question, it might work that you could link to the full URL but I see no way to get that. If you spend long enough working with an email you'll even find that ID changes so they aren't even stable within a single day.
Another solution that could work is as explained:
https://mail.google.com/mail/u/0/#inbox/DRAFT_MESSAGE_ID
But as noted this does not open the draft on the first time you go there. It seems you have to travel to that link 2 times in a row to get the message to appear. I guess you could go to the page maybe inject some javascript to go to the page again but I don't know how to do that.

Kentico 8.2 Newsletter Link and unsubscribe link

I have created a contact form under Forms with first name, last name, and email that is designed to sign up people for a newsletter. I then created a page so when people click on the link placed on the home page it takes them to a page with the contact form.
Right now when I test the subscribe form out, the data does to to the "back office" where it can be retrieved. However, the information I entered is still in the text fields and, unless you notice the small flash of the web page, one might think nothing happened.
I'd like to know how (or be directed to somewhere in the Kentico 8.2 Documentation) I can make it so that the fields clear and a message appears saying "You have been subscribed to the newsletter." That message can either appear on a separate page on the web site, or send a message to the user email, or both. In the Email Marketing part under the templates there are Subscribe and Unsubscribe templates, but I don't know how to use those.
The other issue is creating an Unsubscribe link. Ideally that will open up to a new page saying "You have been unsubscribed." Kentico 8.2 has an unsubscribe page you can create where the user enters in an email address and then hits the Unsubscribe Request button, but I'd rather not do that. As it stands, I did create a page with that form and tested it, but it doesn't seem to work.
When you edit your form, under general tab, there are settings for what will happen after the form is submitted:
Display Text
Redirect to URL
Clear Form
Continue Editing.
Currently you're using the standard Forms application for something which can be managed through the Newsletter/Email Campaign module. Read the documentation more on how to configure this vs. using the Forms application.
Essentially the steps you will do are:
Create your newsletter following the directions in the linked documentation.
Place a newsletter subscription webpart on your page template and configure it to the newsletter you want them to subscribe to.
Use the out of the box unsubscribe feature to allow users to unsubscribe to your newsletter. No need to add any page to the content tree but you can if you want OR just use the OOTB functionality.
If you follow the documentation you should be able to get it setup properly vs. using an online form.

building chrome extension to read selected words from a web page

I would like to build a chrome extension to allow me select any word from any web page and by clicking a menu item to send it to a service of my company for tracking.
for example, if I am now reading some article on a page, I would like to select a specific word and right click on it, then I would like to make an http request to my service and track this word.
Is it possible to do with chrome extension? can you please link me to a tutorial that can be helpful?
Thanks.
Yes, you can use chrome extension to achieve that.
Refer Official Tutorial for more details.
Per your requirements, you may need:
Select a specific word. window.getSelection()
right click on it. You will need to listen to mousedown, mouseup or contextmenu event, the code looks like
document.addEventListener('contextmenu', function(event){...}, false);
make an http request. You can use XMLHttpRequest to transfer data between client and server.

Gmail Chat folder in Thunderbird

I just configured my gmail account in Thunderbird (Ubuntu) but I do not find "Chat" folder in it.
How do I get that chat folder in Thunderbird?
Open Gmail's web interface.
Go into settings (in the gear icon on the right).
Click on the Labels tab on top.
Check the checkbox that says "Show in IMAP" for the Chats label.
Refresh/restart Thunderbird.
Done!
Note: In some cases, you may need to follow the additional steps given below:
Right click on your email id in Thunderbird.
Click on Subscribe
Go to [GMail] and make sure that the checkbox for Chats is selected.
Warning: I can only read old chats in Thunderbird. New chats don't seem to show up. Seems like the IMAP folder acts like it's read-only. I can read the new chats in the web interface, nevertheless.

Resources