Skip to content

Commit

Permalink
Merge pull request #29 from yehuda-lev/request-location
Browse files Browse the repository at this point in the history
[client] Added `request location`
  • Loading branch information
david-lev authored Dec 22, 2023
2 parents c41f6f7 + 1bd98fd commit 7a08888
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pywa/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,24 @@ def send_location(
address=address,
)["messages"][0]["id"]

def request_location(self, to: str | int, text: str) -> str:
"""
Send a text message with button to request the user's location.
Args:
to: The phone ID of the WhatsApp user.
text: The text to send with the button.
Returns:
The message ID of the sent message.
"""
return self.api.send_interactive_message(
to=str(to),
type_="location_request_message",
action={"name": "send_location"},
body=text,
)["messages"][0]["id"]

def send_contact(
self,
to: str | int,
Expand Down

0 comments on commit 7a08888

Please sign in to comment.