Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom deeplink image #58

Open
deficts opened this issue Apr 11, 2022 · 13 comments
Open

Add support for custom deeplink image #58

deficts opened this issue Apr 11, 2022 · 13 comments

Comments

@deficts
Copy link

deficts commented Apr 11, 2022

I'm aware that is possible to add a custom url image in native plugins, I think it's an important feature for us capacitor users.

@jf-branch
Copy link

Hi @deficts, could you provide additional detail as what you are referring too?

@deficts
Copy link
Author

deficts commented Apr 28, 2022

So, in our app we implemented the deeplinking for sharing posts, that works well, but we want to be able to set a custom image in our deeplinks (right now when you share a deeplink the image shown, for example, in whatsapp is the icon of the app, but we want that image to be the image of the post). Tell me if im wrong but it is possible by customizing the contentImageUrl variable right? but in capacitor we are not able to access this variables, right? @jf-branch

@jf-branch
Copy link

jf-branch commented Apr 28, 2022

Thank you for the clarification @deficts. You can still do this through the capacitor SDK as well.
When creating your properties, you can simply use the key as identified on the Universal Object , $og_image_url.

i.e

// optional fields
var analytics = {
  channel: 'facebook',
  feature: 'onboarding',
  campaign: 'content 123 launch',
  stage: 'new user',
  tags: ['one', 'two', 'three']
}

// optional fields
var properties = {
  $desktop_url: 'http://www.example.com/desktop',
  $android_url: 'http://www.example.com/android',
  $ios_url: 'http://www.example.com/ios',
  $ipad_url: 'http://www.example.com/ipad',
  $og_image_url: 'http://www.example.com/image.png',
  $match_duration: 2000,
  custom_string: 'data',
  custom_integer: Date.now(),
  custom_boolean: true
}

BranchDeepLinks.generateShortUrl({ analytics, properties }).then(function (res) {
  alert('Response: ' + JSON.stringify(res.url))
}).catch(function (err) {
  alert('Error: ' + JSON.stringify(err))
})

@deficts
Copy link
Author

deficts commented Apr 28, 2022

Great! are these properties available using the showShareSheet method too? Thanks for the clarification!! @jf-branch

@deficts
Copy link
Author

deficts commented Apr 28, 2022

Also, I think the $og_image_url property is not defined in this SDK see: https://github.com/BranchMetrics/capacitor-branch-deep-links/blob/master/src/definitions.ts#L27-L36

@jf-branch
Copy link

@deficts yes it will work for showShareSheet as well.

I'm nearly certain it doesnt have to be defined in definitions.ts.

@deficts
Copy link
Author

deficts commented Apr 28, 2022

image

I think the property must be included in definitions otherwise the project won't compile @jf-branch

@jf-branch
Copy link

Got it! Thanks for testing! I'll create an internal ticket to get this updated.

@deficts
Copy link
Author

deficts commented Apr 28, 2022

Thank you for the attention and support!!!

@jf-branch
Copy link

@deficts I'm gonna talk to the engineer on this, but I'm thinking about just making BranchShortURLProperties a [String:String] object, because the API can accept any key value pair within the nested 'data' dictionary as long as its String:String. https://help.branch.io/developers-hub/docs/deep-linking-api#sample-request---create

@deficts
Copy link
Author

deficts commented Apr 29, 2022

@deficts I'm gonna talk to the engineer on this, but I'm thinking about just making BranchShortURLProperties a [String:String] object, because the API can accept any key value pair within the nested 'data' dictionary as long as its String:String. https://help.branch.io/developers-hub/docs/deep-linking-api#sample-request---create

That sounds good, I'll keep an eye for any update, thanks again!

@nvahalik
Copy link
Contributor

Any updates on this?

@ppatino
Copy link

ppatino commented Oct 15, 2024

@jf-branch any update on this? I'm looking for this as well, but running into the same typescript issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants