How to Send a Media Block Using Dialogflow

Written by Muhammad Aamir
Posted On Apr, 22, 2019

In the previous guides, we explained how to connect your Dialogflow account to Botsify and send a Story from Dialogflow Now we will demonstrate how you can send your Media blocks directly from Dialogflow.


For this guide, we will be adding a media block to the previous Dialogflow intent we created (in the previous guides) so that you can understand easily what is going on.


So let’s get started!


Go to your Botsify Dashboard and click Design → Media Blocks



Select an existing Media Block or create a new one.



I am creating a new Image Slider here:



Once you have created or picked your desired media block, click on the first option on the right side here:



This will copy the media block payload that you will be needing in order to send this Mediablock from Dialogflow.



Now go to Dialogflow, choose the ‘Agent’ connected to Botsify and go to ‘Intents’.



Select the intent you want to add this MediaBlock to



Now go to your ‘Response’ and click on the ‘Add response’ option below.



Select ‘custom payload’ from the options.



Now type the following JSON payload here:



{
  "facebook": {
    "template_postback": ""
  }
}

Now paste the template payload you copied from your Botsify media block in between the inverted commas like this:



This is how your custom payload should look like. Click save once you have successfully created your custom payload.



Now go to your Botsify dashboard and test if your media block is working or not.




Great!


You have successfully sent your Botsify Media Block from Dialogflow using custom payload.


For more such guides you can visit our help section here