Skip to main content
Best Answer

Creating Audiences (Groups) in the API

  • April 2, 2024
  • 10 replies
  • 391 views

dwilburn
Guide III
Forum|alt.badge.img+4

We use a LOT of groups (audiences). As a result, I need a way to create them more quickly.

I previously found out that everything in the API is now referred to as Audiences. Does anyone have any experience creating groups in the API that I could use as a starting point?

Once I have some basic idea, I hope to set it up in Postman to pull the data from a CSV file. Or possibly Python. My skillset in those is minimum but I can use AI to help. 

Best answer by dwilburn

Below is the JSON that I put. 3x Net Inc is the company name. Now I can just change the company name for each new company, and update the text file and copy and past it into the API to create it. 

{
"name": "Test 2024.04.02",
"description": "Test 2024.04.02",
"type": "automatic",
"exclude_deactivated_users": true,
"ruleset": {
"status": "READY",
"operator": "OR",
"sets": [
{
"id": "27986329-3a51-04",
"rules_operator": "AND",
"rules": [
{
"id": "04c64849-d18d-2b",
"type": "BranchMembership",
"payload": {
"branch_ids": [
2
],
"branch_ids_descendants": [
{
"branch_id": 2,
"descendants": false
}
]
}
},
{
"id": "128262a8-db05-de",
"type": "UserAdditionalField",
"payload": {
"field": "27",
"predicate": {
"text": [
"3x NET INC"
],
"operator": "equal"
}
}
}
]
},
{
"id": "d319354f-231b-cc",
"rules_operator": "AND",
"rules": [
{
"id": "407ec588-7768-91",
"type": "BranchMembership",
"payload": {
"branch_ids": [
7
],
"branch_ids_descendants": [
{
"branch_id": 7,
"descendants": false
}
]
}
},
{
"id": "93687ab6-dfac-94",
"type": "UserAdditionalField",
"payload": {
"field": "27",
"predicate": {
"text": [
"3x NET INC"
],
"operator": "equal"
}
}
}
]
}
]
}
}

 

10 replies

KMallette
Hero II
Forum|alt.badge.img+9
  • Hero II
  • April 2, 2024

@dwilburn Hiya … @Bfarkas has a great adage that just because you could do something with an API doesn’t necessarily mean you should.  Creating Groups with API sounds like that to me. The UI tool is so easy to use and it is so well integrated into the rest of the platform.

Are you creating manual groups instead of automatic? If yes, then I would recommend thinking about how you can use automatic groups instead. This makes the power of the group function really come to life.

I’m interested in why (other than you have a lot of audiences) you are looking at the API approach.


captainzelda
Helper II
Forum|alt.badge.img

We’re sitting at approximately 4300 groups, but most of the work is still manual. We rely heavily on the additional field matrix to populate the appropriate values, but actually creating the groups has always been manual for us. Docebo Connect (API) is how we’re populating those values from SFDC. We have so many sub branches and intense criteria to make the groups I can’t imagine a use case for us where we’d “automate” the group creation itself.

I’d love to hear other feedback on what they’re doing though, because this number will only continue to grow for us. 


dwilburn
Guide III
Forum|alt.badge.img+4
  • Author
  • Guide III
  • April 2, 2024

@KMallette thanks for the response. Always great to hear from you. We support internal managers as well as external vendors. Automatic groups.

We have separate branches for internal and external (synced with Salesforce) and I use groups to keep vendor A from seeing vendor B.

Each of our 500+ external vendors have an automatic group based on an additional field (Company Name) in the user’s profile.

I also want to build groups for the managers, as trying to manage this all branches (especially with the Salesforce integration) seems even more cumbersome. 

But I could be wrong, always willing to learn something.


dwilburn
Guide III
Forum|alt.badge.img+4
  • Author
  • Guide III
  • April 2, 2024

@captainzelda 4300, impressive! And painful. We are just shy of 600, and I need to make quite a few to support internal org, but I doubt we will be anywhere near that. 


dwilburn
Guide III
Forum|alt.badge.img+4
  • Author
  • Guide III
  • April 2, 2024

Now that I think about it I can pull an existing audience from the API and use that as a basis for building a new one. Most of ours are using the same rule, just different values. Seems to me I had a similar discussion with bfarkus.


captainzelda
Helper II
Forum|alt.badge.img

Now that I think about it I can pull an existing audience from the API and use that as a basis for building a new one. Most of ours are using the same rule, just different values. Seems to me I had a similar discussion with bfarkus.

That would make sense. Since we’d have to edit the group regardless to make the adjustment we always create a base template and then duplicate. Most of our groups are a duplicate of an original, variation based on country, language, or some other SFDC business field. I would think in the API you could make those one time adjustments. Docebo Connect interface is pretty easy, but thankfully the group improvements Docebo has made make it fairly user friendly to edit. My only word of caution is use very consistent and very clear code naming conventions. Even with that many groups I know what the config will be before I ever open it since my codes are really clear. 

Now only if I could get a report…….


KMallette
Hero II
Forum|alt.badge.img+9
  • Hero II
  • April 2, 2024

@KMallette thanks for the response. Always great to hear from you. We support internal managers as well as external vendors. Automatic groups.

We have separate branches for internal and external (synced with Salesforce) and I use groups to keep vendor A from seeing vendor B.

Each of our 500+ external vendors have an automatic group based on an additional field (Company Name) in the user’s profile.

I also want to build groups for the managers, as trying to manage this all branches (especially with the Salesforce integration) seems even more cumbersome. 

But I could be wrong, always willing to learn something.

Like @captainzelda , I rely heavily on the additional fields matrix, several of which are “job title” or “role” related. It does mean that I have a larger administrative upkeep because those roles can/do change, but now that I have the automatic groups configured, the users in the groups update immediately (well, with the next data lake refresh 😉)


dwilburn
Guide III
Forum|alt.badge.img+4
  • Author
  • Guide III
  • April 2, 2024

Ok, the hardest part was fixing the JSON I came up with. I ended up looking at it in MS Visual Studio to help me see the issue, since Notepad ++ syntax highlighting wasn’t helping.

@captainzelda I pulled a typical group (one of the early ones) using Services = audiences, and the

GET    /audiences/v1/audience .

I then used that info and the POST    /audiences/v1/audience to create the new group.

This is a pretty complicated group with two rules based on the branch and the company name value, using the OR function. Meaning either rule will add the user to the group.

I can post what I actually loaded but I am not sure it would be much help here. Let me know what else you would like to see.

To @KMallette point I have to figure out what I am going to do from here. I may just keep a text file around to create these. Doing one for each “kind” of automatic group I use. Anything else would likely require separate postman or python scripts for each “kind” of group. 

Please let me know what you think


dwilburn
Guide III
Forum|alt.badge.img+4
  • Author
  • Guide III
  • Answer
  • April 2, 2024

Below is the JSON that I put. 3x Net Inc is the company name. Now I can just change the company name for each new company, and update the text file and copy and past it into the API to create it. 

{
"name": "Test 2024.04.02",
"description": "Test 2024.04.02",
"type": "automatic",
"exclude_deactivated_users": true,
"ruleset": {
"status": "READY",
"operator": "OR",
"sets": [
{
"id": "27986329-3a51-04",
"rules_operator": "AND",
"rules": [
{
"id": "04c64849-d18d-2b",
"type": "BranchMembership",
"payload": {
"branch_ids": [
2
],
"branch_ids_descendants": [
{
"branch_id": 2,
"descendants": false
}
]
}
},
{
"id": "128262a8-db05-de",
"type": "UserAdditionalField",
"payload": {
"field": "27",
"predicate": {
"text": [
"3x NET INC"
],
"operator": "equal"
}
}
}
]
},
{
"id": "d319354f-231b-cc",
"rules_operator": "AND",
"rules": [
{
"id": "407ec588-7768-91",
"type": "BranchMembership",
"payload": {
"branch_ids": [
7
],
"branch_ids_descendants": [
{
"branch_id": 7,
"descendants": false
}
]
}
},
{
"id": "93687ab6-dfac-94",
"type": "UserAdditionalField",
"payload": {
"field": "27",
"predicate": {
"text": [
"3x NET INC"
],
"operator": "equal"
}
}
}
]
}
]
}
}

 


dwilburn
Guide III
Forum|alt.badge.img+4
  • Author
  • Guide III
  • April 2, 2024

Now that I think about it I can pull an existing audience from the API and use that as a basis for building a new one. Most of ours are using the same rule, just different values. Seems to me I had a similar discussion with bfarkus.

That would make sense. Since we’d have to edit the group regardless to make the adjustment we always create a base template and then duplicate. Most of our groups are a duplicate of an original, variation based on country, language, or some other SFDC business field. I would think in the API you could make those one time adjustments. Docebo Connect interface is pretty easy, but thankfully the group improvements Docebo has made make it fairly user friendly to edit. My only word of caution is use very consistent and very clear code naming conventions. Even with that many groups I know what the config will be before I ever open it since my codes are really clear. 

Now only if I could get a report…….

If I had it to do over again I would really push for Docebo Connect instead of Salesforce integration. The one added benefit of the Salesforce integration is that users can take training in Salesforce.

But my problem now is that I cannot report on if the user to the training through the Salesforce interface or in my system. It appears that Docebo also cannot tell.