Skip to content

Latest commit

 

History

History
694 lines (515 loc) · 18.4 KB

InstanceApi.md

File metadata and controls

694 lines (515 loc) · 18.4 KB

WhatsAPI.whatsapi.InstanceApi

All URIs are relative to /api

Method HTTP request Description
ChangeWebhookUrl PUT /instances/{instance_key}/webhook Change Webhook url.
CreateInstance POST /instances/create Creates a new instance key.
DeleteInstance DELETE /instances/{instance_key}/delete Delete Instance.
GetContacts GET /instances/{instance_key}/contacts Get contacts.
GetInstance GET /instances/{instance_key}/ Get Instance.
GetQrCode GET /instances/{instance_key}/qrcode Get QrCode.
ListInstances GET /instances/list Get all instances.
LogoutInstance DELETE /instances/{instance_key}/logout Logout Instance.

ChangeWebhookUrl

APIResponse ChangeWebhookUrl (string instanceKey, WebhookPayload data)

Change Webhook url.

Changes the webhook url of an instance.

Example

using System.Collections.Generic;
using System.Diagnostics;
using WhatsAPI.whatsapi;
using WhatsAPI.Client;
using WhatsAPI.models;

namespace Example
{
    public class ChangeWebhookUrlExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "/api";
            // Configure API key authorization: ApiKeyAuth
            Configuration.Default.AddApiKey("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("Authorization", "Bearer");

            var apiInstance = new InstanceApi(Configuration.Default);
            var instanceKey = "instanceKey_example";  // string | Instance key
            var data = new WebhookPayload(); // WebhookPayload | Message data

            try
            {
                // Change Webhook url.
                APIResponse result = apiInstance.ChangeWebhookUrl(instanceKey, data);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling InstanceApi.ChangeWebhookUrl: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
instanceKey string Instance key
data WebhookPayload Message data

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: /

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Instance not found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateInstance

APIResponse CreateInstance (CreateInstancePayload data)

Creates a new instance key.

This endpoint is used to create a new WhatsApp Web instance.

Example

using System.Collections.Generic;
using System.Diagnostics;
using WhatsAPI.whatsapi;
using WhatsAPI.Client;
using WhatsAPI.models;

namespace Example
{
    public class CreateInstanceExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "/api";
            // Configure API key authorization: ApiKeyAuth
            Configuration.Default.AddApiKey("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("Authorization", "Bearer");

            var apiInstance = new InstanceApi(Configuration.Default);
            var data = new CreateInstancePayload(); // CreateInstancePayload | Instance data

            try
            {
                // Creates a new instance key.
                APIResponse result = apiInstance.CreateInstance(data);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling InstanceApi.CreateInstance: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
data CreateInstancePayload Instance data

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: /

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Instance not found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteInstance

APIResponse DeleteInstance (string instanceKey)

Delete Instance.

Deletes the instance with the provided key.

Example

using System.Collections.Generic;
using System.Diagnostics;
using WhatsAPI.whatsapi;
using WhatsAPI.Client;
using WhatsAPI.models;

namespace Example
{
    public class DeleteInstanceExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "/api";
            // Configure API key authorization: ApiKeyAuth
            Configuration.Default.AddApiKey("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("Authorization", "Bearer");

            var apiInstance = new InstanceApi(Configuration.Default);
            var instanceKey = "instanceKey_example";  // string | Instance key

            try
            {
                // Delete Instance.
                APIResponse result = apiInstance.DeleteInstance(instanceKey);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling InstanceApi.DeleteInstance: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
instanceKey string Instance key

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Instance not found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetContacts

APIResponse GetContacts (string instanceKey)

Get contacts.

Fetches the list of contacts in the instance.

Example

using System.Collections.Generic;
using System.Diagnostics;
using WhatsAPI.whatsapi;
using WhatsAPI.Client;
using WhatsAPI.models;

namespace Example
{
    public class GetContactsExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "/api";
            // Configure API key authorization: ApiKeyAuth
            Configuration.Default.AddApiKey("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("Authorization", "Bearer");

            var apiInstance = new InstanceApi(Configuration.Default);
            var instanceKey = "instanceKey_example";  // string | Instance key

            try
            {
                // Get contacts.
                APIResponse result = apiInstance.GetContacts(instanceKey);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling InstanceApi.GetContacts: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
instanceKey string Instance key

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Instance not found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetInstance

APIResponse GetInstance (string instanceKey)

Get Instance.

Returns the instance data of single instance with connection status.

Example

using System.Collections.Generic;
using System.Diagnostics;
using WhatsAPI.whatsapi;
using WhatsAPI.Client;
using WhatsAPI.models;

namespace Example
{
    public class GetInstanceExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "/api";
            // Configure API key authorization: ApiKeyAuth
            Configuration.Default.AddApiKey("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("Authorization", "Bearer");

            var apiInstance = new InstanceApi(Configuration.Default);
            var instanceKey = "instanceKey_example";  // string | Instance key

            try
            {
                // Get Instance.
                APIResponse result = apiInstance.GetInstance(instanceKey);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling InstanceApi.GetInstance: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
instanceKey string Instance key

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Instance not found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetQrCode

APIResponse GetQrCode (string instanceKey)

Get QrCode.

Returns the qrcode in the base64 format.

Example

using System.Collections.Generic;
using System.Diagnostics;
using WhatsAPI.whatsapi;
using WhatsAPI.Client;
using WhatsAPI.models;

namespace Example
{
    public class GetQrCodeExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "/api";
            // Configure API key authorization: ApiKeyAuth
            Configuration.Default.AddApiKey("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("Authorization", "Bearer");

            var apiInstance = new InstanceApi(Configuration.Default);
            var instanceKey = "instanceKey_example";  // string | Instance key

            try
            {
                // Get QrCode.
                APIResponse result = apiInstance.GetQrCode(instanceKey);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling InstanceApi.GetQrCode: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
instanceKey string Instance key

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Instance not found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListInstances

APIResponse ListInstances ()

Get all instances.

Fetches the list of all Instances with login status.

Example

using System.Collections.Generic;
using System.Diagnostics;
using WhatsAPI.whatsapi;
using WhatsAPI.Client;
using WhatsAPI.models;

namespace Example
{
    public class ListInstancesExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "/api";
            // Configure API key authorization: ApiKeyAuth
            Configuration.Default.AddApiKey("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("Authorization", "Bearer");

            var apiInstance = new InstanceApi(Configuration.Default);

            try
            {
                // Get all instances.
                APIResponse result = apiInstance.ListInstances();
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling InstanceApi.ListInstances: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Instance not found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

LogoutInstance

APIResponse LogoutInstance (string instanceKey)

Logout Instance.

Logouts of the instance with the provided key.

Example

using System.Collections.Generic;
using System.Diagnostics;
using WhatsAPI.whatsapi;
using WhatsAPI.Client;
using WhatsAPI.models;

namespace Example
{
    public class LogoutInstanceExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "/api";
            // Configure API key authorization: ApiKeyAuth
            Configuration.Default.AddApiKey("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("Authorization", "Bearer");

            var apiInstance = new InstanceApi(Configuration.Default);
            var instanceKey = "instanceKey_example";  // string | Instance key

            try
            {
                // Logout Instance.
                APIResponse result = apiInstance.LogoutInstance(instanceKey);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling InstanceApi.LogoutInstance: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
instanceKey string Instance key

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Instance not found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]