Skip to content

Instantly share code, notes, and snippets.

@mrtopf mrtopf/send_image.py
Created Apr 27, 2016

Embed
What would you like to do?
Die send_image()-Funktion für den Messenger-Bot
def send_image(recipient_id, image_url):
"""send an image to a recipient"""
recipient = { 'id' : recipient_id }
# create an image object
image = { 'url' : image_url }
# add the image object to an attachment of type "image"
attachment = {
'type' : 'image',
'payload' : image
}
# add the attachment to a message instead of "text"
message = { 'attachment' : attachment }
# now create the final payload with the recipient
payload = {
'recipient' : recipient,
'message' : message
}
send(payload)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.