getGroupBySlug( )


Gets a group by slug.

The getGroupBySlug() function returns a Promise that resolves to a group whose slug matches the given slug. The slug is the end of a group's URL that refers to a specific group. For example, if a group's URL is https:/example.com/groups/{my-fitness-group}, the slug is my-fitness-group. The slug is case-sensitive. It is generally based on the group name, but for secret groups it is an autogenerated string of characters, for example, https:/example.com/groups/{5D3yTX}.

Note: For SECRET groups, only site admins, group admins, and group members can see a group and its content.

Method Declaration
Copy
function getGroupBySlug(
  slug: string,
  options: GetGroupBySlugOptions,
): Promise<GetGroupBySlugResponse>;
Method Parameters
slugstringRequired

Unique part of the group's URL, for example group-1 in https:/example.com/groups/group-1. Pass only the slug. Case-sensitive.


optionsGetGroupBySlugOptions
Returns
Return Type:Promise<GetGroupBySlugResponse>
JavaScript
import { groups } from "wix-groups.v2"; async function getGroupBySlug(slug, options) { try { const result = await groups.getGroupBySlug(slug, options); return result; } catch (error) { console.error(error); // Handle the error } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?