Last updated
Last updated
Use this lib to connect BJS with
Install GoogleAppLib and WebhooksLib to your bot
You will need to contact your Google Apps administrator, or else use a Gmail account.)
Now click Deploy. You may be asked to review permissions now. Project version - always "New".
Cloick in Deploy button. You will have Public App url.
The URL that you get will be the webhook that you need use in this Lib. You can test this webhook in your browser first by pasting it. Note that depending on your Google Apps instance, you may need to adjust the URL to make it work.
Go to App > Libs and install GoogleAppLib and WebhooksLib
/setup
Use any Google App script in BJS now
Example for command /task
You can turn on debug flag with true
command onRun
GACode - it is isolated function with Google App code. It can not have BJS code like Bot.sendMessage
and etc. Only GA code!
You need set permissions for Google App Script
Run Libs.GoogleApp.run()
in first time. You can have like such error:
Error on Google App script: "Exception"
If you have such error you need set access rights.
Open the script project.
At the left, click Project Settings settings.
Select the Show "appsscript.json" manifest file in editor checkbox:
At the left, click Editor code.
At the left, click the appsscript.json
file.
Locate the top-level field labeled oauthScopes
. If it's not present, you can add it.
The oauthScopes
field specifies an array of strings. To set the scopes your project uses, replace the contents of this array with the scopes you want it to use. For example:
Save the manifest file using Ctrl+S or the Save file icon in the menu bar.
Run Libs.GoogleAppLib.run
in first time. Then:
select "debug" function on Tab
press "Debug" button:
Google app is runs. Bot will sent execution result to you. Also you can receive email with error description.
You can use "debug" function anytime for debugging
Copy this to your Google account
as web app
Try to open web app via app
Create command
After this step you can this Lib and .
This is detail setup description. Please try to use before it.
Go to and create new project by button:
Paste the script from into the script code editor and hit Save.
You need to add
Then you can code
But you can use and pass data with for Bot.run method.
"The script does not have permission to perform that action. Required permissions: ( || || )"
Full help available . From that help:
", " - is mandatory scope
Publish your app again (see )
go to Google App Script Editor (See )
Also you can open web app by url (see ) in incognito mode. And look for any errors. For example we have permission error here:
home page
Google App Script - good examples for inspiration
Stack Overflow - ask your questions on SO
- Check out the Apps Script videos on YouTube
- The reference documentation provided in this section describes the various Apps Script services and the Apps Script manifest file structure.