Example #1
0
        public async Task <InstagramMetrics> GetInstagramMetrics(string accessToken, string instagramMediaId)
        {
            var response = await _facebookClient.GetAsync <dynamic>(
                accessToken, "insights", "metric=engagement,impressions,reach,saved");

            if (response == null)
            {
                throw new Exception("IG metrics not found. ");
            }

            // TODO: FB Api doesn't work
            InstagramMetrics instagramMetrics = _modelMapper.GetInstagramMetrics(response, instagramMediaId);

            return(instagramMetrics);
        }