Activate your API Access on your account

  1. Go to grytics.com or work.grytics.com
  2. Go to your “API Access” page
  3. Generate the access and you will have three parameters necessary for you to use the API :
  • Your App Key
  • Your secret Key
  • Your token
Note: the API is available for every Grytics for Workplace Communities  admin accounts but only available for Pro & Enterprise & Global accounts on Grytics.

Start coding

Grytics and Work API are based on the same system.

You can access both API respectively through these URLs :

In order to get your group list, you need to make this GET call:

https://api.grytics.com/groups/?token=MYTOKEN
https://api.work.grytics.com/workplace/{guid}/groups/?token={guid}

IMPORTANT :

The API requires you to sign every call.

To generate the app-secret proof, you’ll need your access token then create a SHA-256 hash of the string, using your app secret as the key. Here’s an example in PHP:

$appsecret_proof = hash_hmac('sha256', $access_token, $app_secret); 

Then pass it in the headers (appsecret-proof)

The API will return an array for your groups like this one:

[
	{
		fb_id: 29850707044,
		url: "spsodoid8dd6d5s53q3sfkcks",
		name: "C'est quoi ton mail ?",
		min_date: "2009-01-08",
		max_date: "2017-05-09",
		entity_data: {
			cover: "https://scontent.xx.fbcdn.net/v/t31.0-8/q82/s720x720/965990_10151484360561976_601709032_o.jpg?oh=8efe8410e22ff65cf50c2142189568b9&oe=59AE40B3",
			description: "#ADMISSION: Le groupe est ouvert par cooptation par l'un des membres : venez accompagnés à une soirée, nous en parlerons ! C'est quoi ton mail ? C'est du partage, du networking, de la déconne, bref c'est une soirée avec de gros morceaux de web dedans pour les jeunes professionnels de moins de 30 ans impliqués ou intéressés par : -les médias sociaux en général, -le community management, -la communication d'influence, -Le web marketing -le journalisme web, -la création web, -toute la publicité en ligne -la recherche scientifique liée à ces outils Et le métier que tu inventes jour après jour. ####################################### Les personnes qui ne connaissent pas de membre peuvent adresser une demande d'adhésion avec un gentil mail pour se présenter"
		},
		privacy: "CLOSED",
		type_id: 3,
		category_id: 10,
		is_delegated: false,
		timezone: "(UTC+00:00) UTC",
		last_update: "2017-05-12T08:13:04+00:00",
		history: "done",
		nb_members: 145,
		nb_active_members: 165,
		engagement_score: 14.99,
		activity_score: 10.16,
		contain_data: true,
		update_running: false,
		update_failed: false
	}
]

For Workplace Communities

If you want to get the data for a specific group, query following this rule :

https://api.work.grytics.com/workplace/{guid}/groups/{group_id}/?token=MYTOKEN

This will return an array with a single group.

Guidance

You need to specify workplace (or any other supported networks) at the beginning of the request followed by the network_guid

From there, you can query specific contexts:

  • Groups
  • Dashboard => corresponds to your dashboard on Grytics with all the groups added (that are not MCGs)
  • Segments => corresponds to a segment
  • Axes => corresponds to a specific axis
  • Mcgs=> corresponds to your MCGs dashboard on Grytics with all the MCGS groups added

If you want to get the data for a specific group, query following this rule :

https://api.work.grytics.com/workplace/{guid}/groups/{group_id}/?token=MYTOKEN

This will return an array with a single group.

If you want to get the key statistics for a specific group, query following this rule :

https://api.work.grytics.com/workplace/{guid}/groups/{group_id}/stats/?from=1231459200&to=1492253303&token=MYTOKEN

Let’s take a look at the basic parameters:

From & to corresponds to the date range in timestamps, you want the statistics. If you do not specify any timestamp, the min & max dates of the group will be selected. If you have specified a timezone for your group on Grytics, It will be automatically converted here. If not, the timezone is UTC.

For Facebook Groups

If you want to get the data for a specific group, query following this rule :

https://api.grytics.com/groups/{group_fb_id}/?token=MYTOKEN

This will return an array with a single group.

If you want to get the key statistics for a specific group, query following this rule :

https://api.grytics.com/groups/{group_fb_id}/stats/?from=1231459200&to=1492253303&token=MYTOKEN

Let’s take a look at the basic parameters:

From & to corresponds to the date range in timestamps, you want the statistics. If you do not specify any timestamp, the min & max dates of the group will be selected. If you have specified a timezone for your group on Grytics, It will be automatically converted here. If not, the timezone is UTC.

{
	"nb_posts":3304,
	"nb_shares":53,
	"nb_comments":21938,
	"nb_reactions":5634,
	"nb_likes":5573,
	"nb_love":22,
	"nb_haha":23,
	"nb_wow":11,
	"nb_angry":1,
	"nb_sad":4,
	"nb_former_members":1,
	"nb_active_users":165,
	"nb_members":145,
	"nb_members_count":147,
	"activity_score":10.24,
	"first_date":"2009-01-09T00:00:00+00:00",
	"last_date":"2017-04-15T10:48:23+00:00",
	"engagement_score":15
}

Go further and get all your groups data !

Browse the documentation on the website in order to get the data you need through the API.