ushu / branch_io Goto Github PK
View Code? Open in Web Editor NEWClient for branch.io public API
License: MIT License
Client for branch.io public API
License: MIT License
I don't have a good grasp on what is happening, but occasionally my Rails new user signup flow breaks on what appears to be a branch_io
error. Here's the error I am receiving. Note I am using the omniauth-google-oauth2
gem:
2020-06-15T12:25:32.979236+00:00 heroku[router]: at=info method=POST path="/auth/google/callback" host=XYZ.herokuapp.com request_id=34a5f001-cc1d-4e61-8663-621ca7784dc7 fwd="209.6.42.243" dyno=web.1 connect=0ms service=1660ms status=204 bytes=487 protocol=https
2020-06-15T12:25:32.949836+00:00 app[web.1]: W, [2020-06-15T12:25:32.949696 #26] WARN -- : [34a5f001-cc1d-4e61-8663-621ca7784dc7] Exception undefined method `errors' for #<BranchIO::Client::ErrorResponse:0x0000000641afb8>
2020-06-15T12:25:32.949878+00:00 app[web.1]: Did you mean? error
2020-06-15T12:25:32.974823+00:00 app[web.1]: I, [2020-06-15T12:25:32.974652 #26] INFO -- : [34a5f001-cc1d-4e61-8663-621ca7784dc7] No template found for ApplicationController#omniauth_callback, rendering head :no_content
2020-06-15T12:25:32.975322+00:00 app[web.1]: I, [2020-06-15T12:25:32.975229 #26] INFO -- : [34a5f001-cc1d-4e61-8663-621ca7784dc7] Completed 204 No Content in 1357ms
Here's my branch_io
related Ruby code:
after_create do |user|
follow_users_from_default_user!()
client = BranchIO::Client.new(Rails.application.config.branch_key, Rails.application.config.branch_secret)
url_configs = [
{
channel: "#{username}",
campaign: "Author",
data: {
'$og_type': "article",
'$og_image_url': "XYZ",
'$og_title': "XYZ",
'$og_description': "XYZ",
'$fallback_url': "https://XYZ.com/u/#{username}",
'$canonical_url': "https://XYZ.com/u/#{username}",
author_id: "#{id}"
}
},
{
channel: "#{username}",
campaign: "Author",
data: {
'$og_type': "article",
'$og_image_url': "http://www.XYZ.com/media/social.png",
'$og_title': "XYZ",
'$og_description': "XYZ",
'$canonical_url': "https://XYZ.com/u/#{username}",
author_id: "#{id}"
}
}
]
res = client.links(url_configs)
if res.success?
set author_deep_link: res.urls[0]
set author_deep_link_app_store: res.urls[1]
logger.info "Successfully created #{res.urls[0]} and #{res.urls[1]}"
else
logger.error "Error creating URLs: #{res.errors.join(',')}"
# There has been errors, but some URLs might be valid
if res.urls.count > 0
logger.error "Successfully created #{res.urls.count} URLs out of #{url_configs.count}: #{res.urls.join(',')}"
end
end
end
Can you see what could be going on? I'm probably not handling potential errors correctly (as it breaks my entire signup flow when this happens), but any help you can provide would be greatly appreciated. Note I am using the 0.2.0 version of branch_io
- Please let me know if I can get you any further info or debug. Thanks!
The branch.io API now supports a delete
method: https://docs.branch.io/apps/deep-linking-api/#link-delete. As a current user, I would like to be able to use this feature through the gem.
As a developer, I have prepared a solution: #6
Will someone merge this and release a new gem version?
client.link(feature: "test") when i am calling this getting execution expired error.
I am facing very strange issue with $desktop_url
. as I have created deep link with $desktop_url
, and send that link via email.
but link is auto calling on server without clicking on it.
here is my code
client = BranchIO::Client.new(ENV['BRANCH_KEY'], ENV['BRANCH_SECRET'])
res = client.link(
feature: 'confirmation_link',
data: {
token: token,
"$desktop_url": "#{ENV['DOMAIN_URL']}/api/v1/users/confirmation.html?confirmation_token=#{token}"
})
res.url
If I removed $desktop_url
then all things work like charm.
Thanks in advance.
Hi, @ushu
I have a question about this gem.
I am developing an application that I have to create a deeplink for a product dynamically, to be opened in the browser on the pc or in the app (Android or iOS), but I could not use the date field to direct the urls to the mobiles, always the web page Is directed to the home the same happens in the mobile. But deeplinks work when I create on dashboard branch.io or when I create it dynamically on the mobile.
I would like to know if this functionality is implemented or if I am doing it wrong?
I used:
#...
res = client.link(
feature: "test",
date: {
$desktop_url => "mywebsite.com/product/id",
$android_url => "myapp: // product / id",
$ios_url => "myapp: // product / d"
}
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.