Sending Video Content - Messenger


(Kellsey Shaw) #1

To send Video content via your bot, you simply need to use the Webhook service and have a video file that is hosted online and publically available :slight_smile:

Your message will show a preview and allow users to play the video. Some apps with autoplay the video.

Your URL should be:

https://graph.facebook.com/v2.6/me/messages?access_token=InsertYourPageToken

You’ll just need to pop your page token on the end there where indicated.

The Method should be POST.

The Content-Type should be Raw Body.

You then need to paste the following in the body:

{
  "recipient":{
    "id":"{{bot_new_message.user_id}}"
  },
  "message":{
    "attachment":{
      "type":"video",
      "payload":{
        "url":"http://clips.vorwaerts-gmbh.de/VfE_html5.mp4"
      }
    }
  }
}

You will need to add a Header to the request and enter content-type in the first box and application/json in the second box.

You should end up with something that looks like this :slight_smile:

If you have renamed your trigger, you will need to update the output {{bot_new_message.user_id}} with the user id output from your bot trigger.


Web Messenger Shortlinks & Embed Options
How to use Messenger structured templates
Send a video in my flow
(Ian Lawrence) #2

Hi

i cannot get this example working. When you say Page Access Token you are referring to the Page Access Token from developer.facebook.com fpr the page?
My flow does not error but no video is returned

Any ideas?


(Ian Lawrence) #3

Hi

sorry i needed to change the user_id as I had renamed the trigger. It works now


(Khashayar) #4

It’s easier to do this with the “custom request” action, now that flowxo has it!


(Anish Duggal) #5

@kcfl

Could you please share some more detail about how to get it to work with “custom request” action. I’ve been tring but it’s not working.

Thanks


(Karen Barker) #6

Hi Anish,

To send a video in Facebook messenger using a custom request you would use the following:

Hope this helps. :slight_smile:


(Anish Duggal) #7

@KarenBarker

Hello Karen, Thank you.

With using “custom request” action where do I put the PAGE_ACCESS_TOKEN ?

I keep getting this error:

Error validating access token: The session has been invalidated because the user changed their password or Facebook has changed the session for security reasons.

Thanks.


(daniel.beckett) #8

Hi Anish,

You shouldn’t need to include the page access token, the custom request takes care of that for you.

If you would like to share the request that you’re sending we can help troubleshoot it further. :slight_smile:


(Anish Duggal) #9

@DanielBeckett

Here is the share link

There are 2 actions. I got the webhook one to work but the second action for custom request doesn’t.

I’ve removed the access token from the webhook.


(Karen Barker) #10

Hi Anish,

Did you get this fixed since sharing the flow? Both the webhook and the custom request worked for me when I installed the flow. :confused:


(Anish Duggal) #11

Nope, still not working.


(daniel.beckett) #12

Hi Anish,

How strange! I’ve tested the Flow you shared and it seems to work okay for me; admittedly the video did take a bit of time to load at first (around 5-6 seconds).

If you’re still running into problems can you please email support@flowxo.com and we’ll pick it up from there? :slightly_smiling_face:

Thanks,
Dan


(Anish Duggal) #13

@DanielBeckett

Hi Daniel,

So after going thru the actions mentioned in your email. The video is delivering thru ‘Custom Request’.

The video for some reason still does not play on any IOS device. it plays fine on messenger.com and on Messenger Android. Not sure what is going on I’ve also tried different carriers in case that was the problem and still nothing.

Not sure where to go with this.


(daniel.beckett) #14

Hi Anish,

Sorry for the delay in getting back to you. We ran a few internal tests to see if we could recreate the issue and what we’ve found is that the problem seems to be specifically related to the video that you’re sending - either due to it being shared from Dropbox or possibly something to do with the video file itself.

We can’t say for certain why there’s a problem with the particular file or hosting site but hopefully this points you in the right direction for a solution. Perhaps you could try hosting your video elsewhere and test the custom request again?

Thanks,
Dan


(Anish Duggal) #15

@DanielBeckett

Hi Daniel,

Thank you. I came to that conclusion as well. Even though the videos were made on an Ipad they wouldn’t play on any IOS devices.

I screen ripped them from Vimeo and voila it worked like a charm. Though there seems to be an intermittent 5 to 8 second delay in delivery, people on other platforms are experiencing the same as well so I don’t think it’s a FlowXo issue.

I think the problem was with how Vimeo does the encoding and then re downloading from Vimeo screws something up.

Thank you for all the help working this out.


(Veron) #16

Hello! Tell me how I can send the video to the user in the telegrams?Thank you!


(Karen Barker) #17

Hi Veron,

You’ll need to use a custom request to send a video in Telegram. There’s a flow here that you can install which should help with how to set this up. :slight_smile:


#18

Hello,

Using the custom request option works fine but it takes too much time load for my taste. In my case it was over 10 secs :smirk:. I opted to send an attachement already uploaded on FB server (I guess) instead of a .mp4 URL in order to significantly decrease the load time. I just tried it for both a GIF & Video file and it loads ALOOOOOTTTTTTT faster (it’s crazy) than uploading the gif via an URL or uploading it to FlowXO server. You can also find more info on the respective FB dev page. Hope it helps.

  1. To do that, first I did a HTTP Request (see first screenshot below) to upload the file to FB servers. The output will be the attachment ID which you’ll use in step 2 below:

{
“message”:{
“attachment”:{
“type”:“image”,
“payload”:{
“is_reusable”: true,
“url”:“https://s3-eu-west-1.amazonaws.com/flowxo-images/images/fc8f32b5-16a5-49f6-9102-8cd6f7ec9450
}
}
}
}

  1. Then I did a custom request (see 2nd screenshot below) to display the attachment (instead of a public video url):

{

“attachment”:{
“type”:“image”,
“payload”:{
“attachment_id”: “1600923133276962”
}
}
}

Request URL: https://graph.facebook.com/v2.6/me/message_attachments?access_token=“YourPageToken”

Find your Page Token here
.