¶
botcity.plugins.whatsapp.BotWhatsappPlugin
¶
__init__(access_token, whatsapp_number_id)
¶
BotWhatsappPlugin
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
access_token
|
str
|
The account access token. |
required |
whatsapp_number_id
|
str
|
The id referring to the Whatsapp number being used. |
required |
send_contact_message(to_number, contact_name, contact_phone=None, contact_email=None)
¶
Sends an message containing a card with contact information via Whatsapp to the specified number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_number
|
str
|
The Whatsapp number that will receive the message. |
required |
contact_name
|
str
|
Name of the contact. |
required |
contact_phone
|
str
|
Phone number of the contact. |
None
|
contact_email
|
str
|
Email address of the contact. |
None
|
send_location_message(to_number, longitude, latitude, name, address=None)
¶
Sends an message containing a location via Whatsapp to the specified number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_number
|
str
|
The Whatsapp number that will receive the message. |
required |
longitude
|
str
|
Longitude of the location. |
required |
latitude
|
str
|
Latitude of the location. |
required |
name
|
str
|
Name of the location. |
required |
address
|
str
|
Include location address in message. |
None
|
send_media_message(to_number, media_type, media_link, caption=None, filename=None)
¶
Sends an message containing media via Whatsapp to the specified number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_number
|
str
|
The Whatsapp number that will receive the message. |
required |
media_type
|
MediaType
|
The media type of the content that will be sent. |
required |
media_link
|
str
|
The URL of the media content that will be sent in the message. |
required |
caption
|
str
|
The caption of an image or document that will be sent. (can be used only with image or document media type). |
None
|
filename
|
str
|
The name of the document file that will be sent. (can be used only with document media type). |
None
|
send_text_message(to_number, msg_content, preview_url=False)
¶
Sends a text message via Whatsapp to the specified number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_number
|
str
|
The Whatsapp number that will receive the message. |
required |
msg_content
|
str
|
The message body content. |
required |
preview_url
|
boolean
|
Include a preview box when a link is being sent in the message. Defaults to False. |
False
|