I have created a slash command in Slack and am successfully receiving the relevant payload from that slash command. However, when the user creates a message that contains an embedded hyperlink, that link is being stripped out of the message and isn't included in the message payload.
For example:
This message contains a link
...gets converted to:
This message contains a link
Oddly, the link is successfully passed through as part of the payload if the user types a naked URL in their message, but it does not work if they create a link using the 'link' button in the Slack UI.
As per the docs, I have enabled the option "Escape channels, users, and links sent to your app" but this doesn't seem to fix the problem.
Can anyone help? How can ensure embedded hyperlinks aren't stripped out of the message payload?
Slack unfortunately haven't spent much time on slash commands since launch, and one of the things they don't support are links, as they were only added recently to the client's rich text editor.
Previously there was no way to create a link to a non-slack resource without pasting the full URL, so the slash command isn't sent it.
Your best option, if you are trying to do something with a link, would be to respond ephemerally to the user stating this and asking them to send the full URL via the slash command instead.
Related
I'm trying to get emoji's from a another server.
I creates a server object for the server, it is a constant because I want to only pull from this server.
for emoji in main_tuple:
emoji_name_id =await server.fetch_emoji(emoji)
emoji_array.append(f"<{emoji_name_id.name.lower()}:{emoji_name_id.id}>")
error:
nextcord.ext.commands.errors.CommandInvokeError: Command raised an
exception: NotFound: 404 Not Found (error code: 10014): Unknown Emoji
I should mention I want to display it another server, I know this is probably obvious but yeah.
main_tuple is a directionary in a database that has the emoji id and name.
the error
Also the bot is part of the server it's getting the id from.
I have looked at: discord.py emoji all servers bot in
and it does not work for me.
First Issue, you are making a wrong reference.
<:Name:ID> and not <Name:ID> (if you don't see it, you missed the first colon)
Another issue,
emoji_name_id.name.lower()
Custom emojis are to have to have 'exact' name and ID as they have, by using lower method, you would be trying to reference a wrong custom emote.
For example:
The actual emote which might have the following reference <:ThisIsACoolEmote:ID>, while you are appending <:thisisacoolemote:ID> which doesn't exist
To mitigate this, you can just append str(emoji_name_id) which will automatically give you the correct emote reference which is in the format <:Name:ID:> and yes, it also will format animated emojis too, i.e:<a:Name:ID>
also fetching here might not be the best practice, you can use bot.get_emoji instead which gets emote from internal cache if you have access to member Privileged Intent.
I would like to create a Slack command /command do-something-with-that-file with at the same time, the user uploading the file.
So far, my command is received but there is no files in the payload.
Is this possible?
I have also added files:read in the scope but no luck so far.
A Slack command can only accept text as input. If you upload a file at the same time, it wouldn't be a part of the payload and will be ignored (although uploaded, and accessible through file browser).
Some alternatives you could try though:
Use files.list method - Look for files uploaded within a few seconds of the moment when you receive the command. The method accepts ts_from and ts_to parameters for this purpose.
Use file_shared event - Subscribe to this event in your app configuration. This event fires every time a file is uploaded in a channel visible to your bot. You could ask the app user to use a certain format to provide with a file upload, and look for a pattern in the event submission.
Use message shortcut - Once a user uploads a file, you can ask them to use the context menu to fire a message shortcut associated with your app. This message shortcut contains a reference to the message ID, which can be used to fetch the uploaded file.
I want to display an adaptative card with an openUrl action to a sharepoint page.
The sharepoint url contains some filters and looks like : https://xxx.sharepoint.com/sites/main/Recherche/results.aspx?k=Annee:'2018' AND Group:'test'
From Teams client on windows, clicking on the team doesn't work at all (no action)
On web client, it opens a new teams on the source conversation I clicked the link on.
It probably comes from specials chars and encoding (stripping the last part after the colon make it work) but I didn't find the proper encoding to work with the full link.
BTW, the full link works in Bot Emulator and Skype for Business.
I'm not sure what encoding you tried, but the : characters in the URL are causing the problem because they aren't allowed. There's no way for me to test this, but if you call encodeURI on the string and set that as the value of url it should work:
encodeURI("https://xxx.sharepoint.com/sites/main/Recherche/results.aspx?k=Annee:'2018' AND Group:'test'")
returns
"https://xxx.sharepoint.com/sites/main/Recherche/results.aspx?k=Annee:'2018'%20AND%20Group:'test'"
I'm trying to implement the Sagepay payment gateway, but i'm having an issue with the notification url. This is how i'm generating it:
request.NotificationUrl = string.Format(
"{0}Notification.aspx?orderid={1}&vendortxcode={2}&amount={3}",
SagePaySettings.SiteFqdn,
Request.QueryString["orderid"],
request.VendorTxCode,
txtOnlineDepositAmount.Text.Trim()
);
When I submit a payment, within their my sagepay portal it reports the notification url as:
Callback URL: https://www.****.uk/Notification.aspx?orderid={3a35f950-5b7c-e311-8437-12d0d8a96a66}
It's missing all the parameters after orderid.
I submitted a ticket and they said:
"Your Notification URL should only respond with a Status, RedirectURL and optionally a StatusDetail field. No other HTML, headers, comments or text should be included either before or after these fields. Sage Pay will treat all such text as an error and fail the transaction. To answer your question ampersands can not be used as they do not conform to RFC1738 URL Encoding. Please note we are not developers here at Sage Pay however we will try to assist you in troubleshooting your issues. Here's a link to our Server Protocol Guide along with a link to StackOverflow a professional web developers forum"
I may have misunderstood, but I thought by using
&
for the ampersands that would be correct.
Has anyone come across this?
I can probably get around it by having a single parameter and seperating the parameters with a pipe or something. But it would be nice to do it properly with individual parameters.
You should be using URL encoding instead of entity character encoding.
Its being stripped of everything after & because the & character in & amp; separates parameters in the registration post body. If you want your parameter to contain & character you should replace it with %26, or just use a library that will perform the conversion for you.
Difference between Url Encode and HTML encode
Regards,
Adam
I want to send email using mailto tag with a single pdf file as attachment.
mailto tag opens the mail window with passed arguments like to and subject using:
Mail to Manager
But, attachments as a parameter isnt working.
Please suggest how to send pdf attachment in rhomobile.
Thanks
I think that you need to add the physical path to the PDF file for it to work (otherwise it may not know where the file is). This post on a forum says as follows:
The only problem is that this "mailto" command executes on the
client machine, therefore it tries to locate the attachment file by
a physical path, and not by a virtual path.
That is,
Using mailto:iudith.m#zim.co.il?subject=my report&body=see attachment&attachment="\myhost\myfolder\myfile.lis"
works ok, but only for local users (those connected to the same
network as the "myhost" machine).
Using mailto:iudith.m#zim.co.il?subject=my report&body=see attachment&attachment="http://myhost:myport/my_location_virtual_path/myfile.lis"
does not work, it does not recognize such a syntax as valid for
the attachment file.
In your case you would properbly need to look at this part of the Rhomobile docs (on file system access) to get the right path to your file.
EDIT:
From you comment I can see that you are trying to make it work on iOS (due to the iOS specific path).
In this discussion (from Rhomobile's Google Group) it is explained that mailto doesn't support attachments on iOS. It says as follows:
Don't know about other platforms, but you cannot do this on iOS. mailto: does not support attachments on iOS.
You can do it using a native API, MFMailComposeViewController.
This is a complete controller with UI, so you would have to write a Native View Extension to use it:
http://docs.rhomobile.com/rhodes/extensions#native-view-extensions
EDIT 2:
I've looked around and it seems that mailto doesn't support attachments on Android either. This is because Android supports the RFC 2368 mailto protocol, which doesn't include attachments. Here is a reference to the Android mailto url parser.
I would suggest that you do as suggested for iOS, write a native extension. I think this post would be relevant for you.