Chaitali
Chaitali

Reputation: 33

Team creation with C# for RC glip

We are trying to use C# code to create team in Glip.
I already referred to this article:

https://medium.com/ringcentral-developers/apis-for-ringcentral-team-messaging-tasks-a-brief-intro-4a2c38c8ce2d

Though it has Glip APIs references but not exactly what we are looking for. Still didn't find reference to start with the code.

Any reference for Team creation using C# code using Glip API. What other permission required for creating the app to access Glip API other than Glip?

Upvotes: 3

Views: 41

Answers (1)

Anirban Sen Chowdhary
Anirban Sen Chowdhary

Reputation: 8311

Step by step guidance is given for team creation in C# here:

https://developers.ringcentral.com/guide/team-messaging/quick-start#c#

using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using RingCentral;
using Newtonsoft.Json;

namespace Create_Team
{
class Program
{
    const string RINGCENTRAL_CLIENTID = "<ENTER CLIENT ID>";
    const string RINGCENTRAL_CLIENTSECRET = "<ENTER CLIENT SECRET>";
    const bool RINGCENTRAL_PRODUCTION = false;

    const string RINGCENTRAL_USERNAME = "<YOUR ACCOUNT PHONE NUMBER>";
    const string RINGCENTRAL_PASSWORD = "<YOUR ACCOUNT PASSWORD>";
    const string RINGCENTRAL_EXTENSION = "<YOUR EXTENSION, PROBABLY '101'>";

    static RestClient restClient;

    static void Main(string[] args)
    {
        restClient = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_PRODUCTION);
        restClient.Authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD).Wait();
        create_team().Wait();
    }
    static private async Task create_team()
    {
        var parameters = new GlipPostTeamBody();
        parameters.@public = true;
        parameters.name = "Fun team";
        parameters.description = "Let chit chat here";

        var member1 = new CreateGlipMember();
        member1.email = "[email protected]";
        var member2 = new CreateGlipMember();
        member2.email = "[email protected]";
        parameters.members = new CreateGlipMember[] { member1, member2 };

        var response = await restClient.Restapi().Glip().Teams().Post(parameters);
        var jsonStr = JsonConvert.SerializeObject(response);
        Console.WriteLine(jsonStr);
    }
}
}

Hope this above example help

Upvotes: 0

Related Questions