-
-
Notifications
You must be signed in to change notification settings - Fork 18
Sending images
When sending media(image, video, audio, gif and document ), you can either specify a link containing the media or specify object id, you can do this using the same method.
By default all media methods assume you're sending link containing media but you can change this by specifying the link=False
.
Here an example;
>>> messenger.send_image(
image="https://i.imgur.com/Fh7XVYY.jpeg",
recipient_id="255757xxxxxx",
sender=0,
)
Note: You can also send media from your local machine but you have to upload it first to Whatsapp Cloud API, you can do this using the
upload_media
method. and then use the returned object id to send the media.
Here an example;
>>> media_id = messenger.upload_media(
media='path/to/media',
)['id']
>>> messenger.send_image(
image=media_id,
recipient_id="255757xxxxxx",
link=False
sender=0,
)
Note: Don't forget to set the link to False, and also you can use the same technique for sending video, audio, gif and document from your local machine.
If you find any issue in the docs, please open an issue/pr and report it