Interactive message - slack

I would like to create Slack a interactive messages with a behaviour like:
The message is published via an incoming webhook, when the user clicks on Approve I POST a text message to the response_url.
Unfortunately the text message replace completely the original message and I get an ugly (edited) flag besides the posted message. I would like to replace only the buttons of the original message. Is that possible?

Ok, it turns out that I need to use replace_original attribute (see doc), taking the entire original message and replacing the buttons section with a text section.

Related

Alert message include label text

I'm writing a webhook implementation and would like to know if it is possible to include label information to the webhook alert message body.
So far, I've found that you can only include plot information. I've also looked for variables which provide all label objects within pinescript but couldn't find.

Mailchimp: re-confirm subscribers with a one-click button

I have been sent an example of a mailchimp HTML email which allows users to re-express their wish to stay on a mailing list. It just contains a brief message and one big button "Opt In" which users simply have to click once. The code of the button is as follows:
<img src=3D"https://somewebsite.us6.list-manage.com/track/open.php?u=3D=e57uw79a33&id=3Dhs7de4d771&e=3D936b9800f2" height=3D"1" width=3D"1">
(Obviously I've changed the URL and ID parameters for security). I'm trying to work out how the sender has done this. I'm not clear whether the result of hitting this button moves the subscriber onto a new list, flags them in some way, or removes subscribers that haven't clicked the button after some time limit- but any of those would suit our needs.
After a long time searching the net and options within Mailchimp, I still can't work out how to do this?
The most relevant article I can find about "Reconfirming a list" is this, but it seems a very roundabout way of doing it, plus the example email I have received appears to have been sent with Mailchimp which goes against what the article says, PLUS the article's instructions is to provide a link to a signup form rather than an embedded one-click button within the email itself, which is what I want.
A way to track the reconfirmations of your mailing within mailchimp:
Create a new campaign for your old list. Add a button 'Yes I want to continue to be on this list' and 'No thanks, remove me from the list'. The buttons should point to two different urls that undisputedly match the intent (e.g. example.com/stay-on-list or example.com/unsubscribe); prepare them on your website with whatever message you want to give them.
Send the mail; Mailchimp will track the links clicked for every user (this is by default, check your settings if you might have changed this) (this is actually why I hate to be on mailchimp, but for today it's convenient).
Wait a few days (or just before you want to send your next mailing)
Go to 'Reports' and click on your latest campaign
Click on the numbers clicked link and then do for the 'continue' link: Download the list as CSV; upload this CSV to a new list which is now 'cleaned'
For the 'unsubscribe' button; download the list, open it in your spreadsheet program (Excel, LO Sheet), grab the e-mailadresses and unsubscribe them manually from old list.
You now have two lists: one cleaned with properly confirmed addresses and one with members you're not sure of. You could try again with your next mailing but at a certain point you probably have to discard your old list (actually, EU-focussed organizations already should've already discarded these lists, but if you're a small org you might get away with it (AT YOUR OWN RISK: THIS IS NOT LEGAL ADVISE)).
But you may want some additional proof, because you don't have a list of who clicked what when. The risk is that someone someday might dispute his or her intent to be subscribed to your list. And the user dump you made from people who clicked on a link isn't really giving you much information that you can use and say, well at that day you did click on Subscribe. To the rescue is the MailChimp data dump (Click Username > Account > Settings > Manage my data), which actually gives you quite a simple table of timestamps, links and emailadresses. Will this hold in court? I really don't have a clue, it is easy to fake (it would've been better with ip-addresses etc), but at least it gives you some track record. Note that the data in mailchimp itself is not hard to fake, but maybe one day this data is gone, hence keep the MailChimp data dump.
(btw. before you do all this, maybe clean up your list beforehand: https://mailchimp.com/help/remove-inactive-subscribers/)
Actually, I quit mailchimp in favor of MailingBoss, but I believe AWeber also does this... they have what's called a "capture email" that is unique to each list... if you connect a button to it by using "mailto" link ... then it opens the users default email client and pre-populates their main email in it. Once they send that email to your capture email, it ads their email to your list. Pretty sweet stuff for mobile users.
Here's a vid on it
I couldn't figure out how to achieve this with MailChimp ...but in regards to the technique you want to use, after reading the MailChimp documentation I believe that the person likely achieved it by simply using segmentation... anyone that clicked the button was segmented and then perhaps only that segment was sent their follow up emails or maybe even the the segment that didn't click the link was manually unsubscribed on the back end...

Send an image link to telegram without display image url

I need send an image url to telegram without display image url and hidden url. I see a telegram bot and it's do it very well and send long message with image I'm attach this bot result image see it.
Now how can do it in my custom bot? It's possible hidden url with MARKDOWN style or any way? I want hidden image url in my text but telegram display my image. see my sample attach image.
thank you
Most of them use the dot (or some things like this character) for link description and you thought there is no link.
You can type the following line and select custom markdown:
#bold [.](http://www.planwallpaper.com/static/images/i-should-buy-a-boat.jpg)
If you want to add text to your link, you need to create a bot and use this approach in the bot.
Edit:
For sending hyperlink with the bot api you can simply send html markup and using parse_mode. See telegram documents:
To use this mode, pass HTML in the parse_mode field when using sendMessage. The following tags are currently supported:
<b>bold</b>, <strong>bold</strong>
<i>italic</i>, <em>italic</em>
inline URL
inline mention of a user
<code>inline fixed-width code</code>
<pre>pre-formatted fixed-width code block</pre>
sample:
According to the Telegram API, it seems if you set disable_web_page_preview to true, you should get the result you want.
The final message should look something like this:
{
chat_id: 1235,
message: "http://your/url",
disable_web_page_preview: true,
}
EDIT:
It seems I misunderstood the question, and you actually want the image to appear by itself rather than the url by itself.
Again, as per the Telegram API you can send an image directly. But as far as I can tell, you can't use a URL to do it. You would have to upload the photo from your telegram server directly. You could use the caption property to send text with it.
Here is an example of how you might be able do this in python. You will need to tweak this to whichever language you are using, but the concept is the same.
import requests
response = requests.post(
"https://your.bot.url.com/sendPhoto",
data={
"chat_id": 1234,
"caption": "Your extra text here"
}
files={
"photo": (
"image_name.jpg",
"contents of image",
"image/jpg",
{},
)
}
)
The caption property has a limit of 200 characters, so if you want to send more characters then that, you'll have to send two messages.
You can always ask Telegram to add this type of functionality in the future
The answer is zero-width non-joiner (ZWNJ) character. ZWNJ is encoded in Unicode as U+200C ZERO WIDTH NON-JOINER (HTML ‌ , ‌).
HTML mode:
‌
MARKDOWN mode:
[‌‌](https://example.com)
Update 2021:
The answer is still working but telegram doesn't let you send an empty text message that include only this character anymore, so you have to add at least one character in the whole text message. In addition you can also use the character Unicode Character 'WORD JOINER' (U+2060) instead.
You can use   character as hidden character.
This might help:
It works for both:
web links
telegram links
import requests
def telegram(channel,bot,text,img):
if(text==""):text="Refer - "
r = requests.get('https://api.telegram.org/bot'+bot+'/sendMessage?chat_id=#'+channel+'&parse_mode=markdown&text='+"[​​​​​​​​​​​]("+img+")"+text)
Use the above function. It will work perfectly. In case, there is no text and only image, it should break. So it will show a "." (dot) in those cases.
Now use the function -
telegram(your_channel_name,your_token_here,description,image_url)
To correctly send an image hosted on a website without showing any reference link, you must use the "html" parsing mode.
And in the content to send, for example, something like this (Python mode):
# We take the html address of the image.
image_address = 'https://picsum.photos/100.jpg'
# The unicode character to prevent the words from
# being separated, in this case, we take advantage
# of it so that the Telegram API accepts it and
# incidentally so that it does not take up space
# when including text in the message.
word_joiner = '&#8288'
# This would be the final pattern.
html_pattern = f'{word_joiner}'
With HTML parse mode. Keep empty space between the opening and closing tag.

How do I separate inline images and attaches using MAPI?

My program uses MAPI for working with Exchange mailboxes. The problem is if a user fires up Outlook, adds a file as an attachment and also opens Paint, selects a region there, copies it into clipboard and pastes into the message body the resulting message showns two attachments.
More specifically, the program calls IMAPIMessage::GetAttachmentsTable() to retrieve the attachments table and that table contains two objects. Is there a way a program can decide whether the "attachment" is really an attached file or a portion of inline content?
You will need to check whether the HTML body (through the img tag) refers to the attachment, either through img:cid and PT_ATTACH_CONENTS_ID property or though the file name (PR_ATTACH_LONG_FILENAME) or contnet location (PR_ATTACH_COMTENT_LOCATION).
The property you are looking for is PR_RENDERING_POSITION (0x370B0003). A -1 means that the attachment is a "normal" attachment and not in-line. If the value is anything other than -1, then that indicates an in-line attachment and the value is the position in the body that the attachment should be rendered at.
Here is the MSDN page describing it.
EDIT:
Dmitry, I do not agree with your comment. I have HTML email messages with in-line attachments and the PR_RENDERING_POSITION is working as described in the MSDN page I posted.

Long forms best way to display errors. Usability Question

We have a long for which has 3 sections:
requester, shipping and billing
each section screen or more long so the form is 3+ screens long. From usability perspective what is the best way to display messages on the form.
Grouped list of error messages at the top of the form.
Grouped messages for each section at the top of the section
Error messages near to the form field which actually has the error.
Personally, I would like, at the top of the page before the form headers, to have something like:
There was an error with your form submission in the following section(s):
Shipping, Billing
Where Shipping and Billing are anchors that will take me down to that section of the form.
Then, above that section, have the relevant messages to that section:
Shipping
- You need to fill in an address
[rest of form here]
Billing
- You need to fill in a name
[rest of form here]
Grouped messages for each section at the top of the section
with a visual change to the form field which actually has the error.
I find it most usable if there is a generic error at the top of the form saying something like "There were errors submitting your information, please correct the fields in red" then show the more specific error messages next to each form field that had an error.
Roger Hudson has a very good article on writing accessible forms
and an example on error handling.
I like to have a dialogue that shows the type of effected fields, let's them click okay, then scrolls them to the first error in the form.
The affected field is then indicated with a flag/border/marker of some kind and a message letting them know the type of problem.
So, if they entered a malformed email address like "me#me'com" if would let them know the email address is malformed. The exact wording is really dependent on the type of user you are targeting.
I HATE forms that tell you there are errors at the top, then have tiny little asterisks by the fields.... ugh.
P.S. It also drives me nuts when a form has a "password" or other sensitive field and it gets emptied without marking it as a required, corrected field as well.

Resources