Skip to content

Whatsapp

SendWhatsappMessage

The SendWhatsappMessage() function sends a message to a specified phone number via WhatsApp. It requires a WhatsApp API key, the recipient's phone number, and the message content.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from blipperpy.api.whatsapp_api import WhatsappApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
whatsapp_api = WhatsappApi(api_client)

result = whatsapp_api.send_message({'waapi_apikey':'xxx','phone_number':'50687654321', 'message':'This is a test'}, _headers=custom_headers)

SendWhatsappMedia

The SendWhatsappMedia() function sends media (image, video, etc.) to a specified phone number via WhatsApp. It requires a WhatsApp API key, the recipient's phone number, and the URL of the media to be sent.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from blipperpy.api.whatsapp_api import WhatsappApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
whatsapp_api = WhatsappApi(api_client)

result = whatsapp_api.send_media({'waapi_apikey':'xxx','phone_number':'50687654321', 'mediaUrl':'https://example.com/media/image.jpg'}, _headers=custom_headers)

SendWhatsappAudioFromText

The SendWhatsappAudioFromText() function converts the provided text into an audio message and sends it to a specified phone number via WhatsApp. It requires a WhatsApp API key, the recipient's phone number, and the text to be converted to audio.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from blipperpy.api.whatsapp_api import WhatsappApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
whatsapp_api = WhatsappApi(api_client)

result = whatsapp_api.send_audio_from_text({'waapi_apikey':'xxx','phone_number':'50687654321', 'text':'text goes here'}, _headers=custom_headers)

createInstance

The create_instance() function creates a new WhatsApp API instance and associates it with an agent. It requires the agent's ID and returns the unique instance_id of the created WhatsApp instance.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from blipperpy.api.whatsapp_api import WhatsappApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

custom_headers = {
    "model": "lite",
    "blipper-api-key": configuration.api_key
}
whatsapp_api = WhatsappApi(api_client)

result = text_api.create_instance({'agent_id':'xxxxxxx'},_headers=custom_headers)

List instances

The list_instances() function retrieves a list of all existing WhatsApp API instances. It returns detailed information about each instance, enabling management and tracking of multiple WhatsApp sessions.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from blipperpy.api.whatsapp_api import WhatsappApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

whatsapp_api = WhatsappApi(api_client)
result = text_api.list_instances(_headers=custom_headers))

Retrieve QR Code

The retrieve_qr_code() function retrieves the QR code for a specific WhatsApp API instance. The QR code is returned as a Base64-encoded string, which can be used for authentication. It requires the instance_id of the instance for which the QR code is being requested.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from blipperpy.api.whatsapp_api import WhatsappApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

whatsapp_api = WhatsappApi(api_client)
result = text_api.retrieve_qr_code(instance_id="12345", _headers=custom_headers)

Get user data

The get_user_data() function retrieves user data associated with a specific WhatsApp API instance. It requires the instance_id of the instance and returns the user's information.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from blipperpy.api.whatsapp_api import WhatsappApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

whatsapp_api = WhatsappApi(api_client)
result = text_api.get_user_data(instance_id="12345", _headers=custom_headers)

Delete instance

The delete_instance() function deletes a specific WhatsApp API instance. It requires the instance_id of the instance to be deleted and returns the result of the deletion operation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from blipperpy.api.whatsapp_api import WhatsappApi
from blipperpy import ApiClient, Configuration

configuration = Configuration()
configuration.api_key = "lqqRYOOnSerIOP973hjskR"
configuration.host = "https://blipper.epystemic.com"
api_client = ApiClient(configuration)

whatsapp_api = WhatsappApi(api_client)
result = text_api.delete_instance(instance_id="12345", _headers=custom_headers)