Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Facebook attachment upload api #899

Merged
merged 8 commits into from
Jun 27, 2017

Conversation

ouadie-lahdioui
Copy link
Collaborator

@ouadie-lahdioui ouadie-lahdioui commented Jun 24, 2017

Hello,

This PR add Facebook attachment upload API to allow us uploading an attachment that we may later send out to many users, without having to repeatedly upload the same data each time it is sent.

🍺 in honor of @jonchurch 🍺

Enjoy,

@ouadie-lahdioui ouadie-lahdioui changed the title Ass Facebook attachment upload api Add Facebook attachment upload api Jun 24, 2017
@benbrown
Copy link
Contributor

Is this the same as #870?

@ouadie-lahdioui
Copy link
Collaborator Author

ouadie-lahdioui commented Jun 26, 2017

No it isn't, the aim of #870 is to allow to the user to send a local file, audio, video or an image instead of sending a cloud hosted files, for example if i want to send an image :

with Botkit today :

controller.hears(['doIt'], 'message_received', function(bot, message) {
    var image = {
        "attachment":{
            "type":"image",
            "payload":{
                "url": "http://CLOUD-HOSTED-SITE/images/image.png"
            }
        }
    };
    bot.reply(message, image);
});

To allow Facebbok render the images, we must provide a public link in payload.url, but what if i want to send an image from my local /User/Doc/images folder ?

With Botkit + #870 :

controller.hears(['doIt'], 'message_received', function(bot, message) {
    var image = {
        "attachment":{
            "type":"image",
            "payload":{
                "url": ""
            },
            filedata: FILE_FROM_LOCAL_FOLDER
        }
    };
    bot.reply(message, image);
});

In this way, FILE_FROM_LOCAL_FOLDER can be a file from my /User/Doc/images folder.

Furthermore, what if i want to upload an image that i can later send out to many users ? in this case Facebook Attachment Upload API is the answer, and with #899 Botkit will be able to upload (and just upload) files (audio, video, images ...) to send them later.

access_token: process.env.page_token,
verify_token: process.env.verify_token,
app_secret: process.env.app_secret,
access_token: 'EAAShWXeInZCcBAGD9z7ffW3Dmflwh2X8otTTH1R1OzBniNe6vQPyGduijVwk68Of3r1nZAVte76LdQ00P2qSCQip5hbnqxpaGZAFEibAiDZCHHd3JE0caYzD3cHP7U3rEnSSghMcTITCesrgsWWDhT6SyF7dl5HwJINvht0HFwZDZD',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @ouadie-lahdioui can you take out these actual keys?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something is wrong with examples/facebook_bot.js, i will clean it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@benbrown benbrown merged commit ba64ec6 into howdyai:master Jun 27, 2017
@jonchurch
Copy link
Contributor

👍🐙🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants