Skip to content

Instantly share code, notes, and snippets.

Created April 27, 2016 09:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment