Answered

Can i create canvas kit apps with google apps script?


hi, i am trying to create an intercom canvas kit, i create a url for initialize and submit flow on google apps script but it don't work well 

 

this is my google apps script code

 

INITIALIZE

function doPost(e) {
var Json = JSON.parse(e.postData.contents);
sendDataSocket(Json)
 
var CanvasBody = {
"canvas": {
"content": {
"components": [
{ "type": "button",
"label": "Click ME!!!!",
"style": "primary",
"id": "url_button",
"action": {
"type": "submit"
}
},
],
},
},
};
 
return ContentService.createTextOutput(JSON.stringify(CanvasBody)).setMimeType(ContentService.MimeType.JSON);
}

SUBMIT

function doPost(e) {
var Json = JSON.parse(e.postData.contents);
 
var CanvasBody = {
"canvas": {
"content": {
"components": [
{
"type": "text",
"text": "This is a text component"
}
]
}
},
"event": { "type": "completed" }
}
 
return ContentService.createTextOutput(JSON.stringify(CanvasBody)).setMimeType(ContentService.MimeType.JSON);
}

 

Is it possible to create workflows for canvas kit in google apps script?

 

what am I doing wrong?

 

icon

Best answer by Diana Tripac 12 May 2022, 14:24

View original

2 replies

Userlevel 3
Badge +2

Hi @user1202​ 👋 You can use whatever language you like when creating Intercom apps. Have you followed our tutorial in the docs here for creating an app on the messenger? I can't debug the snippet you sent because I am not an expert in the google apps script, but as long as you are using our canvas kit reference as specified here then it should work 👍

Hi @user1202​ 

 

I am about to start a project to build a sidebar app using google apps script. I was interested to see if you were able to get this figured out

Reply