Working in messengers

Checking Instagram subscription

check_insta_subscription()

Description

To check subscription to an Instagram account

check_insta_subscription()

Parameters: None

The function returns logical True if the user is subscribed to the account, False if not.

Examples

Code example for copying

r=check_insta_subscription()

Working with WhatsApp

check_whatsapp() | get_whatsapp_bot_id_by_phone()

Description

To check whether a phone number has WhatsApp

check_whatsapp(phone_number) method to check whether WhatsApp is connected to the given phone number

Parameters: phone_number - phone number in the format 79999999999 or 89999999999

The function returns logical True if the number is registered in WhatsApp, False if it is not.

To get WhatsApp bot_id by phone number

get_whatsapp_bot_id_by_phone(bot_phone) function to find WhatsApp bot_id by phone number

Examples

Let’s check if WhatsApp is connected to a phone number:

Example usage of the function check_whatsapp()
Code example for copying

Removing last message

last_message_id() | remove_last_message()

Description

last_message_id()- to get the number of the last bot's message

If both an image and text have been sent, the message numbers are separated by an underscore (_)

remove_last_message() – to delete the bot's last message

If the "Save to dialog history" toggle is enabled, then for Telegram and FB you can delete the last message via a mailing from a block. Simply use the function remove_last_message() in the calculator. This function removes the last message sent by the bot, but only if that message is saved in the dialog history.

Example

Example:

  1. Create a broadcast block:

2. Activate the checkbox "Save mailing in the client dialog history" in the "Sending" tab:

Now, feel free to send the mailing.

If you want to delete the last message (for example, a message with an error), you can do so in a single block using the function remove_last_message().

Next, send the mailing with the function to delete the last message.

Пример с получением ID последнего сообщения.

Code example for copying

Pausing bot's operation

| pause_bot(minutes)

Description

pause_bot(minutes) - pauses bot’s operation for the specified number of minutes.

minutes - required parameter representing the number of minutes. It can be passed as either an integer or a decimal number.

The function works like clicking the "Pause" button in a client dialogue, but lets you specify the duration to pause the bot. It returns True upon successful execution.

Deleting planned messages

| delete_pended_messages_from_list(message_id_list, with_not_delete)

Description

delete_pended_messages_from_list(message_id_list, with_not_delete)

The function helps delete specific messages from the scheduled ones.

! message_id_list - required parameter; a list of blocks whose messages need to be deleted from the scheduled ones.

with_not_delete - optional parameter; deletes messages marked as "Do not delete." Any value can be passed to this parameter.

The return value "wrong message_id_list" appears if message_id_list is not provided or is not an array.

How to pass parameters:

Where to get the required parameter:

Checking the operator's status

| check_operator_status(email, with_pause)

Descriptiom

check_operator_status(email, with_pause) - checks whether the operator is on shift. Returns True if the operator is on shift, and False if not.

! email - required parameter; an employee's email

with_pause - optional parameter with values 1 or 0. If set to 1, the function returns a positive result when the operator’s status is either "On shift" or "On break." If set to 0, it returns a positive result only when the operator’s status is "On shift." Default value: 1.

Last updated