Branch.io inetegration with cordova / ionic 1 app. Shared link generated by branch for snapchat does not show image preview and the link not clickable - ionic-framework

We have used Branch.io for implementing deep links in our mobile hybrid app which is developed using ionic 1 framework. We have used branch-cordova-sdk plugin and configured the deep links for sharing with social media apps. We are passing title, description and contentImageUrl for branch.io to create the link. It works great on almost all SM platforms except Snapchat.
When the content is shared on snapchat, the link is showing up along with content but it is not clickable from snapchat. There is no preview of the image is shown. I could not find any solution for this yet. Also please see the code down below in reply. thanks.
Here is the code i'm using:
var branchUniversalObj = null;
var props = {};
props.canonicalIdentifier = 100;
props.title = "my title";
props.contentDescription = "my description";
props.contentImageUrl = "http://lorempixel.com/400/400/";
//create branch object
Branch.createBranchUniversalObject(props).then(function (res) {
branchUniversalObj = res
console.log('Response: ' + JSON.stringify(res))
}).catch(function (err) {
console.log('Error: ' + JSON.stringify(err))
});
Somewhere in the code:
var analytics = {
campaign: "sharing cards"
}
var properties = {
cardId : 100,
cardType: "promo",
refUser: "John"
}
// share sheet
branchUniversalObj.showShareSheet(analytics, properties, "Hello awesome stuff");

When you share a Branch link on various Social Media platforms, it is scraped to display the OG related information (i.e. OG Title, OG Image and OG Description).
When scraped, Branch will return: 1st: any OG parameters that have been defined for the link; 2nd: any OG parameters that have not been defined for the link but that have been defined at the app level (in Social Media Display Customization on the Link Settings page); and finally: any meta tags present on the web site specified in the Default URL ($fallback_url) page.
In order, to ensure that the OG image is displayed correctly, you need to ensure that you have the OG parameters defined at atleast one of the three levels mentioned above.
Here are the various ways to set OG tags
To add the og_image for a particular Quick link on the dashboard:
Visit the Quick links page on your dashboard.
Click on 'Create new Link'
On the 'Configure Options' tab and 'Social Media' section either add the og_image or the og_image_url.
While creating links from the iconic SDK add image URL to the Branch Universal Object using contentImageURL tag as shown below:
Code snippet
var properties = {
canonicalIdentifier: 'content/123',
canonicalUrl: 'https://example.com/content/123',
title: 'Content 123 Title',
contentDescription: 'Content 123 Description ' + Date.now(),
contentImageUrl: 'http://lorempixel.com/400/400/',
price: 12.12,
currency: 'GBD',
contentIndexingMode: 'private',
contentMetadata: {
custom: 'data',
testing: 123,
this_is: true
}
}
// create a branchUniversalObj variable to reference with other Branch methods
var branchUniversalObj = null
Branch.createBranchUniversalObject(properties).then(function (res) {
branchUniversalObj = res
alert('Response: ' + JSON.stringify(res))
}).catch(function (err) {
alert('Error: ' + JSON.stringify(err))
})
To set these OG tags by default for your branch links:
Go to the Link Settings Page on your dashboard:
Scroll down to the "Social Media Display Customization" section
Set the Link Title, Description and an image. Here is a screen shot for your reference.
PS: As a final caution, make sure the image you specify as the OG Image adheres to the Snapchat accepted image dimesions, which I belive is 1080 x 1920 pixels.

Related

Deeplink not work with SocialSharing

I'm developing an ionic project.
I have follwed all steps to installa Social Sharing and Deeplinks.
This is my schema when I install plugin.
ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=app --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=app.com --variable ANDROID_PATH_PREFIX=/
But when I share with Social Sharing don't send a url, Social Sharing send as string or via email send some structure as string an other part as url.
e.g. via hangout as string
e.g. via email app://app.com/page --> app:// as string and app.com/page as url
In Social share documentation schema is share(meesage, subject, file, url)
message:string, subject:string, file:string|Array, url:string
this.socialSharing.share('Lorem ipsum', 'title', null, 'app://app.com/about')
.then( ()=> {
console.log('Success');
})
.catch( (error)=> {
console.log('Error: ', error);
});
The app open deeplinks when I tested using browser from codepen.io with hiperlink.
< h1 >< a href="app://app.com/about" >Click Me< /a>< /h1>
But when I share a deeplink send as string.
Why??? Can you help me???
I struggled with the same problem, the solution to this is very straight forward:
Do not use custom url schemes
The main reason for not using custom url schemes is that Gmail and other webmail provider indeed destroys links such as "app://...". So there is no way to get this work.
See the following links for details:
Make a link in the Android browser start up my app?
https://github.com/EddyVerbruggen/Custom-URL-scheme/issues/81
Use universal links instead
Universal links is supported by Android und iOS. Since you are already using the ionic-plugin-deeplinks plugin, you already configured a deeplink url.
All you have to do is change
href="app://app.com/about"
to
href="https://app.com/about"
For using universal links you need to create configuration files for android and iOS. These files must include application identifiers for all the apps with which the site wants to share credentials. See the following link for details:
https://medium.com/#ageitgey/everything-you-need-to-know-about-implementing-ios-and-android-mobile-deep-linking-f4348b265b49
The file has to be located on your website at exactly
https://www.example.com/.well-known/apple-app-site-association (for iOS)
https://www.example.com/.well-known/assetlinks.json (for android)
You can also use to get data from custom URL and deep link in our app if exist. Otherwise, redirect to play/app store like this:
index.html
$(document).ready(function (){
var lifestoryId = getParameterByName('lifestoryId');
if(navigator.userAgent.toLowerCase().indexOf("android") > -1){
setTimeout(function () {
window.location.href = "http://play.google.com/store/apps/details?id=com.android.xyz&hl=en";
}, 5000);
}
if(navigator.userAgent.toLowerCase().indexOf("iphone") > -1){
setTimeout(function () {
window.location.href = "https://itunes.apple.com/us/app/app/id12345678?ls=1&mt=8";
}, 5000);
}
window.location.href = "app://lifestory/info:"+lifestoryId;
});
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
Call link like: BASE_URL/index.html?lifestoryId=123

Post to my timeline in Facebook

Please suggest how to post some text which is entered by an end user after clicking on a button. I searched in social plugins of Facebook. I found share plugin but it is sharing only links but not the text. How can I post the text to Facebook? In my application, I'm using normal "textarea" to enter the text/status and I'm using a submit button to post it. I want to post the entered text to my timeline in Facebook. Is there any plugin available for this? Please suggest.
Thanks,
Dinakar.
Using Javascript SDK
<script>
function share()
{
var obj = {
method: "feed",
link: "Facebook page hyperlink",
picture: "Picture hyperlink",
name: "Title",
caption: "A short caption right below the title",
description: "Description"
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
For More info: http://developers.facebook.com/docs/reference/dialogs/

BlackBerry WebWorks to invoke popping BB10 Share panel/screen

How can u get my webworks app to pop open the blackberry 10 share panel?
Ex: open a website in the browser, click the overflow button and then click share
Thank you!
You'll want to look at the invokeTargetPicker API.
Essentially, you create a request
var request = {
action: 'bb.action.SHARE',
// for a file
uri: 'file://' + path,
// for text you'd use 'data'
data: 'I am awesome',
target_type: ["APPLICATION", "VIEWER", "CARD"]
};
Then you call the API
blackberry.invoke.card.invokeTargetPicker(request, "Your Title",
// success callback
function() {
console.log('success');
},
// error callback
function(e) {
console.log('error: ' + e);
}
);
API Documentation is available here: https://developer.blackberry.com/html5/apis/blackberry.invoke.card.html#.invokeTargetPicker
I wrote a sample app, which you can test out on our GitHub repo: https://github.com/ctetreault/BB10-WebWorks-Samples/tree/master/ShareTargets
This should be an option that appears on any link, image or Text: "Share". Is the item not present in the Cross Cut menu shown?

Facebook Post Publishing without any Dialogue using Javascript SDK

I have been searching for facebook publishing without showing Dialogue.
While reading Facebook developers doc, there are several things which seems to answer the question but after using them, I concluded those are not for this functionality.
Display Modes: They are different type of display mode for dialogues, but there is no way to define if I don't want to show the dialogue.
Explicit Sharing: This seems to be most close. But there is no way to use it in JS SDK. And the parameter mentioned there, I tried in JS but no resolution.
Then here what came to be most successful for me, to use
methode: '/me/feed'
But the problem is, it says:
[User] shared a link
Which I don't want. I want a normal publishing, but without any dialogue to be displayed.
Code I am using for simple publishing is below:
function publishNewsFeed(picURL, name, caption, description)
{
var obj =
{
method: 'feed',
link: fbAppURL,
picture: picURL,
name: name,
caption: caption,
description: description
};
function callback(response)
{
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
Any help will be appreciated.
Thanks
-WI
Display Modes: They are different type of display mode for dialogues, but there is no way to define if I don't want to show the dialogue.
That would be nonsense – if you don’t want to use a dialog, then don’t use a dialog.
But if you want to use a dialog, then it has to be “shown” in some way – otherwise it would not be a dialog.
But the problem is, it says [User] shared a link Which I don't want.
That is current “bug” – if you supply action links with your post, it will show up normal.
https://developers.facebook.com/bugs/485696594791863
Try this:
function jesseSays(){
var body = 'Yeah science Mr. White!!';
FB.api('/me/feed', 'post', {
message: body,
link: 'http://www.neoapps.com.br',
picture: 'http://www.neoapps.com.br/assets/img/logo-big.png'
}, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
}

Select a single 'featured' post in Tumblr?

I would like my Tumblr homepage to show a single Question/Answer post that is selected by a 'featured' tag, or rather by being the most recent Question/Answer post tagged 'featured'. I don't see any built in Tumblr tags that will do this.
I am using jQuery to get the featured post (n number of them) from a category 'featured' by default. I have implemented this solution to my theme - Purely
Here is a screen-shot (displaying three featured posts)
Add this line 's meta section
<meta name='text:Featured Tag' content='featured' />
Add jQuery library in
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
Add these lines in where you want to display the featured post
{block:IndexPage}
{block:IfFeaturedTag}
<h1 class="featured-subhead">
Featured Posts +
</h1>
{/block:IfFeaturedTag}
{/block:IndexPage}
Add these lines just before the closing tag
{block:IndexPage}{block:IfFeaturedTag}
<script>
var rssurl = '/tagged/{text:Featured Tag}/rss';
$.get(rssurl, function(data) {
$('.featured-subhead').append('<div class="featured-posts">');
var $xml = $(data);
var vari = 0;
$xml.find("item").each(function() {
var $this = $(this),
item = {
title: $this.find("title").text(),
link: $this.find("link").text(),
description: $this.find("description").text(),
pubDate: $this.find("pubDate").text(),
author: $this.find("author").text()
}
vari = vari +1;
if(vari <4){
$('.featured-subhead').append('<div class="featured-post" style="overflow:hidden;"><h2 class="featured-title">' + item.title + '</h2><div class="featured-post-description' + vari + '">' + item.description + '</div><div class="featured-post-link">Read More</div></div>');
//Do something with item here...
}
});
$('.featured-subhead').append('</div>');
});
{/block:IndexPage}{/block:IfFeaturedTag}
You can change if(vari <4){ line according to the numbers of posts you want to display as featured. For example, to display a single post, it would be if(vari <2){ .
I have also added few CSS classes to design the output. This can be declared in segment in
h1.featured-subhead
{
/* Heading of featured post */
}
.featured-posts
{
/* Outer box of all featured posts */
}
.featured-post
{
/* Inner box of each featured post */
}
h2.featured-title
{
/* Heading of each featured post */
}
.featured-post-description
{
/* Description or body of each featured post */
}
.featured-post-link
{
/* Link to Permalink page of each featured post */
}
Here only featured-subhead class is necessary. This must be added to the heading of featured post. jQuery will add the featured posts after that.
How does it work?
No surprises here. Tumblr generates a tag RSS page for each page. By using javascript, I am fetching that specific tag page and displaying 'n' number of elements from the XML elements. Sometimes, Tumblr takes a little more time (I don't know why) to generate the RSS page of newly added tags. Be patient and try to browse your-blog.tumblr.com/tagged/featured/rss page to check it is generated or not.
What you're asking is not a native setting to tumblr, in other words there's no preference setting you can simply check.
In order to do what you describes above, you will either need to edit your current theme code, or code a new theme from scratch.
In order to only show 1 question post, at the top, with a tag of featured, you will need to work with the jQuery/Javascript and the Tumblr API.
It's pretty complex coding, but if you're up for it, head on over to the Tumblr API Codex.
This is a little late, but in case it's of any help: Our free Single A theme has the sticky post feature built in. It's the first (and only) tumblr theme to have it. You can get it here: http://www.tumblr.com/theme/28638 or learn more about it here: http://singleatheme.tumblr.com/. Hope this helps!