DEV Community

πŸ”₯ Chatfuel Image Gallery from Google Sheets with Google Apps Script

TheNiqabiCoderMum on July 10, 2019

Let’s say you are making a bot for a restaurant on Chatfuel. The bot can tell the users the daily specials. The daily specials would change, well...
Collapse
 
rob_stuart_za profile image
Rob Stuart

Hi. Great post. I am really new to GAS and JSON in Chatfuel. I have the GAS in the google sheet linked to Chatfuel. I am not sure what is needed in Chatfuel to make it work. Does the code in the Google sheet automatically create the Gallery? I'm trying to use JSON and GAS to send and receive data between Google sheet and Chatfuel.

Collapse
 
nqcm profile image
TheNiqabiCoderMum

Hi Rob,
I am glad you liked the post. Yes the code in sheets script editor automatically creates the gallery. On the Chatfuel end you just need to use the JSOn block with the url of your web app.

Collapse
 
rob_stuart_za profile image
Rob Stuart

Wow thank you for the reply. So many of these boards you never hear from the authors. Keep it up. :) So something really weird. I followed the process above and then eventually replaced the code with your final code above. When testing the JSON link in Chatfuel I still get the "Hello World!" from the first section of building the code? No matter how many times I published or saved made no change.

I created a new sheet and pasted the final code first. Now it works. :) Thank for for the help.

Are there any other resources (yours or others) that I could use to link Google to Chatfuel?

So I started over this time copying the final code first publishing and linking the new URL to the JSON. This time when running a test JSON instead of the "Hello World!" I got the following:

Thread Thread
 
rob_stuart_za profile image
Rob Stuart

Okay this reply may help others where the Gallery is not displaying.

After inserting the final code in the GAS, the code must be published.... and here's the trick.... when publishing the GAS be sure to select "Project version" and select "NEW". This will publish the latest code in the script. If you don't do this the latest code is not published. Hope this helps all those where the gallery is not displayed. :)

Thread Thread
 
nqcm profile image
TheNiqabiCoderMum

100% correct! this is exactly what I wanted to suggest to your last comment.

Thread Thread
 
rob_stuart_za profile image
Rob Stuart

Is there anyway I can point the gallery to a block instead of a web URL? I'm trying to keep the user in the bot instead of pointing them away out of the bot?

Thread Thread
 
nqcm profile image
TheNiqabiCoderMum

If you go through the Chatfuel docs you will find the other options there, including redirecting to a block.

Collapse
 
cdeepak profile image
Deepak Kumar

Hi.. this is a very detailed tutorial for setting up gallerycards through GAS.

Can you write similar tutorials for Manychat platform as well? Their API doc is at manychat.github.io/dynamic_block_d...

Collapse
 
nqcm profile image
TheNiqabiCoderMum

Thanks Deepak! I am working on a kind of cookbook with easy to follow tutorials like this one, to make your ChatFuel and ManyChat bots more powerful. I will share it on Dev.to platform once I am done.

Collapse
 
cdeepak profile image
Deepak Kumar

Hi buddy... Any updates regarding the cookbook? Can you also include steps on how to use conditions to check for tags and send content accordingly?

Thread Thread
 
nqcm profile image
TheNiqabiCoderMum

Thanks Deepak for the reminder! I am working on the book, hopefully I would be able to roll it out soon :) And yes that will be covered in the book.

Thread Thread
 
cdeepak profile image
Deepak Kumar

That's awesome mate... Looking forward to this

Collapse
 
rohanparak profile image
rohanparak

The JSON API documentation with Chatfuel says

Documentation update (August 14th - 2019)
β€’ Removed the "type":"element_share", as it was deprecated by Facebook API. Read more details here: bit.ly/2Z5rwCW

Collapse
 
nqcm profile image
TheNiqabiCoderMum

Thank you for mentioning this. I will revise the article when I get a bit of time.

Collapse
 
haziqisa profile image
Haziq Md Isa

Thanks man for the code. Any chance you have updated the code or revise the article? I'm so noob in coding, so a bit struggling until I found this article 😁

Thread Thread
 
nqcm profile image
TheNiqabiCoderMum

Hi Haziq, I have updated the code.

Thread Thread
 
haziqisa profile image
Haziq Md Isa

Great. Thank you. I will try this. I slowly learn from this, so one day I can do this myself. Thanks

Collapse
 
danhosd profile image
INNOVATION IT

nothing happen in chatfuel. The gallery don't display

Collapse
 
nqcm profile image
TheNiqabiCoderMum

Hi Innovation IT,

I have personally used this script and it works. Are you sure you have setup everything properly?

Collapse
 
aravindbandaru profile image
AravindBandaru

Same is the case in my case. Not sure where i have gone wrong

Thread Thread
 
nqcm profile image
TheNiqabiCoderMum

Hi Aravind,

Have you copy pasted the code? Are you sure your Google Sheet is setup exactly the same way? I went over the whole thing again and it is still working for me.

Are you publishing the script again as a new version of the app every time you make a change?