I want to add Share to Slack feature in my web app. Facing issue in showing the popup to select the receipients - share

I am adding share to slack functionality in my web app.
But I cannot find any solution by which I can show my app users to select a user/channel or team in slack to share the content with.
I have added Sharing on Teams also. In that I am able to select the users or search the particular user. Please refer the below link to see how it is looking in teams.
https://learn.microsoft.com/de-de/power-bi/collaborate-share/media/service-share-report-teams/service-teams-share-to-teams-dialog.png
I want to know, is there any way by which we can implement the sharing to particular user or channel etc on slack same as it is there in teams.
Thanks.

Once the Web app shares content, it's very much up to the receiving app to decide what it makes of the incoming data.
try {
await navigator.share({
title: 'Title',
text: 'Text',
url: 'https://example.com/',
});
console.log('Successful share'))
} catch (err) {
console.log('Error sharing', err));
}
Possible values are:
url: A string representing a URL to be shared.
text: A string representing text to be shared.
title: A string representing a title to be shared. May be ignored by the target.
See the bold part. Try populating text and title differently and see if it makes any difference.

Related

Getting no application can do this action on Android while using Codename One share button

My Codename One app features a ShareButton that is used like this :
// Share this report on social networks (text plus screenshot)
ShareButton shareReportButton = new ShareButton();
shareReportButton.setText("Share this report!");
shareReportButton.getAllStyles().setBorder(
RoundBorder.create().rectangle(true));
FontImage.setMaterialIcon(shareReportButton, FontImage.MATERIAL_SHARE);
shareReportButton.getStyle().setBgColor(ParametresGeneraux.accentColor);
shareReportButton.getPressedStyle().setBgColor(ParametresGeneraux.darkPrimaryColor);
shareReportButton.setTextToShare("I reported this via the great app ABCD "!"
);
shareReportButton.setImageToShare(currentReport.getPhotoPath(), ImageIO.FORMAT_PNG);
I works as expected under the simulator but on an actual Android 4.4 device I get a Dialog menu with "No app can do this action".
Please note that it is possible to share eg a photo with the native apps.
I could not find any build hint to add in the doc. What should I do to make the share button offer a way to share a text + photo on the social networks ?
Any help appreciated,
Regards
EDIT
Following #James H and #Diamond answers, the image type has to be set as mime type. Consequently replacing ImageIO.FORMAT_PNG by "image/jpg" makes the share menu populated.
For completeness please notice that as stated in the doc
an image must be stored using the FileSystemStorage API and shouldn't use a different API like Storage!
So even if the photo is in the cache you have to copy it eg to your home folder and then use this copied version in the ShareButton.
I think the problem might be that
setImageToShare(String imagePath, String imageMimeType)
is looking for a Mime description with a different format, such as: "image/png"
I'm not sure that ImageIO.FORMAT_PNG works in this way. Looking at the sample in the JavaDoc, it uses:
sb.setImageToShare(imageFile, "image/png");
Use the native share functionality and check if sharing natively is support by doing the following:
// Share this report on social networks (text plus screenshot)
Button shareReportButton = new Button("Share this report!");
shareReportButton.getAllStyles().setBorder(create().rectangle(true));
FontImage.setMaterialIcon(shareReportButton, FontImage.MATERIAL_SHARE);
shareReportButton.getStyle().setBgColor(ParametresGeneraux.accentColor);
shareReportButton.getPressedStyle().setBgColor(ParametresGeneraux.darkPrimaryColor);
shareReportButton.addActionListener(e -> {
if (Display.getInstance().isNativeShareSupported()) {
Display.getInstance().share("I reported this via the great app ABCD ", currentReport.getPhotoPath(), "image/png"); // Or "image/jpg"
} else {
ToastBar.showErrorMessage("Your phone doesn't support sharing...");
}
});

Gigya using customized UI for email (Not using ShareBar)

I'm thinking of a way to implement share email function using gigya, and my website has very specific need for share bar(own template and css, animation, etc), so using buttonImages as below can not resolve my problem.
var params ={
userAction:ua,
shareButtons:'share,facebook,twitter,email', // list of providers
containerID: 'divButtons',
buttonImages:{buttonLeftImgUp:'Button_Left.png',buttonCenterBGImgUp:'Button_Middle.png',buttonRightImgUp:'Button_Right.png'}
};
I've successfully used another supported API, gigya.socialize.postBookmark(params), to implement this.
var params =
{
url: "http://www.gigya.com/",
provider:'tumblr',
facebookDialogType: 'share',
title: "Gigya"
};
gigya.socialize.postBookmark(params);
Unfortunately, this function does not support email as a provider, which means I can not add email into my own share bar. Does anyone know how to implement email share, while using my own template(not using customized image)?
Thanks a lot!
I am one of the engineers at Gigya. So that you can better understand what is happening under the hood, clicking on the email share button from the share bar UI ultimately boils down to a call that looks like this:
document.location.href = "mailto:?to=&subject=" + "Your email subject" + "&body=" + "The body of the email";
So really you can just write your own event handler to call a document.location.href like mentioned above with your own subject and body. Alternatively, you can just set the href of an tag to something equivalent.
Hope that helps,
-CodeMonkeyG

Post to timeline like Candy Crush Saga

I want to post to user time-line with their current activity with photo uploaded by them.
For example:
I voted 'xyz movie'.
..image1.. ..image2.. ..image3..
Question : Mutiple photos possible? If yes, Is there limit of photos.I need to show 3-5 photos
Similar to Candy crush saga game post:
(just for reference,not exactly like this. For curiosity I wanted to know whether this is two posts?)
Which api can we use for this?
Is this possible with FB.ui feed api?
FB.ui(
{
method: 'feed',
to:'the Facebook ID of the person you wanna send',
name: 'Facebook Dialogs',
link: 'http://emplido.com',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
What you want is called rich stories, you can create them with open graph, here you can see what are the options available.
This is no easy deal, since you have a lot of options, so you really need to read the open graph docs to find which action fits best. In the docs you have a complete "how to", including how to post an action on a users wall with graph api https://developers.facebook.com/docs/opengraph/using-actions/
Remember that you have to two types of actions, common (docs here) and custom (docs here)
I know that documentation isn't the best answer or the one you wanted to, but in this case it's really necessary, as I said before, you have too many options, that allows you to create the best user experience for your app.
Quoting the docs here's a little example on how to create a story with open graph
To publish an action, make an HTTP POST to the following Graph API endpoint:
/{user-id}/{action-type}
This call should be signed with a user access token with
publish_actions permission or with an app access token for a user who was previously logged in.
For common actions, the {action-type} is the name of the action, such as og.likes:
/{user-id}/og.likes
For custom actions, it is a composite of the app namespace and the custom action type:
/{user-id}/{namespace}:{action-type-name}
The namespace is unique to your app, and is set in your app's dashboard on the Basic tab.
This example is the simplest one.

Facebook Multiple invites using Requests 2.0

Is it possible to send multiple invites using new Requests 2.0? Documentation as of now saing that 'to' parameter can specify only one user, so it single user or standart request dialog even without possibility to set default filter! It's huge drawback from hidious by nature, but effective in purpose FBML.
Sure.
Look in the docs for Requests 2.0:
Send to Many
From your application front-end,
execute:
FB.ui({method: 'apprequests', message: 'You should learn more about this awesome game.', data: 'tracking data: 'tracking information for the user'});
This will open the facebook Dialog:
If you meant in your question whether or not you can filter multiple id's - meaning, you choose the list of uid's to send the request to and not the user - then the answer is no, it's not possible currently.
Of course.
FB.ui({
method: 'apprequests',
message: 'text for the receiving user',
data: '127', // to know what to do with it.
title: 'title of window.'
});
see this fanpage for an example:
http://www.facebook.com/NeonFashion?sk=app_176086155780033
or i missunderstand your questions and you actual looking for something like
Facebook requests 2.0 filter
It is (now?) possible to open a request dialog targeting multiple users at once, by passing an array of ids in the "to" field.
See the "sendRequestToManyRecipients" example in https://developers.facebook.com/docs/reference/dialogs/requests/

Google Chrome Extension - Accessing The DOM

I have been searching around the web to find out how to access the current tabs DOM to extract information out of a page from the background.html. So far I have had no luck, or at least nothing I could get to work properly.
To state the problem simply. I would like to get src of a iFrame on the page. Any Suggestions?
One way, you an treat this as a single one time request to the content-script which will fetch the dom you want to access.
http://code.google.com/chrome/extensions/messaging.html#simple
Basically, your content script sets up the listener:
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
if (request.greeting == "hello")
sendResponse({farewell: "goodbye"});
else
sendResponse({}); // snub them.
});
And your background page sends a single lived request:
chrome.tabs.getSelected(null, function(tab) {
chrome.tabs.sendRequest(tab.id, {greeting: "hello"}, function(response) {
console.log(response.farewell);
});
});
When you send your response, you send it as JSON data, you can fetch whatever you want (such as html, dom, text, etc).
That is currently the only way to let the background page know anything about the contents of a page. Remember you would need content scripts and tab permissions.