12-01-2020 21:40
12-01-2020 21:40
Hi sorry if this has come up before but I couldn't find anything.
I am trying to work out how to setup the webhooks / subscriptions and the docs just aren't that clear around the flow and was hoping someone could assist.
I get that we have to create an endpoint and have that verified which I have done but what I don't get is how you add people to the hook / subscription.
The docs say to do a Post but it has little context into where in the user flow that post has to take place.
Once you have setup the webhook and had it verified, do you then have to do a Post to ( https://api.fitbit.com/1/user/-/activities/apiSubscriptions/320json) when someone first connects and authorizes their account? and for each user? or do you just run that once for no one in particular and then all new users automatically get added to the subscription?
cheers
Scott.
Best Answer12-09-2020 17:50
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
12-09-2020 17:50
Hi @scottdogs,
Yes, you have to make a separate call for every user, using the token you get back from authorization. Keep in mind that you need to present the user with the scopes in your authorization URL to ensure that they consent to share that data with you when creating their subscription. The user must consent to the proper OAuth 2.0 scope before a subscription can be created for the collection. The list of requirements are:
activities collection requires activitybody collection requires weightfoods collection requires nutritionsleep collection requires sleepuserRevokedAccess collection has no scope requirementsactivity, nutrition, profile, settings, sleep, weight scopes are required.I hope this helps. Let me know if you have any additional questions.
Best Answer