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

Latest commit

 

History

History
64 lines (52 loc) · 2.72 KB

File metadata and controls

64 lines (52 loc) · 2.72 KB

Leave group.

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

Request

Parameter Description The data type of the parameter Required parameter
Phone A phone number starting with the country code.
Messages to phone numbers from 8 will not be delivered.
USA example: 17472822486.
String
  • Only Phone is specified
  • Only ChatId is specified
ChatId Chat ID from the message list.
Examples:
17633123456@c.us for private messages
17680561234-1479621234@g.us for the group.
String
  • Only ChatId is specified
  • Only Phone is specified

Response

Parameter Description The data type of the parameter
Result The result of the query OperationMessageResult

Parameters of the OperationMessageResult

Parameter Description The data type of the parameter
Message The result of the query 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;
            
            ILeaveGroupRequest request = new LeaveGroupRequest
            {
                ChatId = "79269014589-1613397458@g.us"
            };

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