Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

Latest commit

 

History

History
61 lines (48 loc) · 2.4 KB

File metadata and controls

61 lines (48 loc) · 2.4 KB

Joining the group.

Implementation note
This method is available in both synchronous and asynchronous implementations.

Request

Parameter Description The data type of the parameter Required parameter
InvitationCode Code from the invitation link String
  • Only InvitationCode is specified
  • Only InvitationLink is specified
InvitationLink An invitation link from the group information. String
  • Only InvitationLink is specified
  • Only InvitationCode is specified

Response

Parameter Description The data type of the parameter
ChatId Unique ID of the group String

Example

using System;

using ChatApi.Core.Connect;
using ChatApi.Core.Connect.Interfaces;
using ChatApi.Core.Response.Interfaces;

using ChatApi.WA.Dialogs;
using ChatApi.WA.Dialogs.Helpers.Collections;
using ChatApi.WA.Dialogs.Operations.Interfaces;

using ChatApi.WA.Dialogs.Requests;
using ChatApi.WA.Dialogs.Requests.Interfaces;
using ChatApi.WA.Dialogs.Responses.Interfaces;

using ChatApiClient.Properties;
namespace ChatApiClient
{
    internal class Program
    {
        internal static IWhatsAppConnect Connect { get; set; }

        internal static void Main()
        {
            // put your chat-api's data
            Connect = new WhatsAppConnect(WhatsApp_Server, WhatsApp_Instance, WhatsApp_Token); 
            IDialogOperations operation = new DialogOperations(Connect);
            IGroupOperations groupOperations = operation.GroupOperations.Value;

            IJoinGroupRequest request = new JoinGroupRequest
            {
                InvitationLink = "https://chat.whatsapp.com/GUF2kjFAFZKBRI8vhs2sqK"
            };

            var chatApiResponse = groupOperations.JoinGroup(request);
            if(!chatApiResponse.IsSuccess) throw chatApiResponse.Exception!;
            
            var response = chatApiResponse.GetResult();
            Console.WriteLine(response?.PrintMembers());
        }
    }
}