1

Sorry I don't have much knowledge in how this stuff works so...

I have a Bitrix24 site running and it has an API, it uses OAuth 2.0 protocol.

I want to create a Google Apps Script web apps (or API executable if it's more appropriate) that will interact with that external API.

From what I understand from the process, I call a page in the Bitrix24 site, which includes a callback URL, and the authentication info is sent to that callback page (https://training.bitrix24.com/rest_help/oauth/authentication.php).

I need to know if I can use Google Apps Script as this callback page. I have been searching but I don't think it's possible to use a web app's function, but maybe I'm looking at it from a wrong angle.

I hope someone can help in how this should be done, or say it's not possible at all.

Thanks in advance!

4
  • What do you mean by use Google Apps Script as this callback page? You would like to call that API from Apps Script? Commented Jun 14, 2022 at 11:37
  • Probably doable. Looks like standard oauth. Use this Commented Jun 14, 2022 at 15:08
  • @Kessy it's when you call an external API, and you supply a URL as a parameter that the API method calls when it's done, to send feedback or data to. I can call Apps Script functions from the same Apps Script project, but I don't know if an external site can do that. Thanks! Commented Jun 15, 2022 at 0:33
  • Based on the last comment, have you checked Class google.script.run (Client-side API)? This allows you to run apps script functions from another client. Commented Jun 17, 2022 at 15:09

1 Answer 1

1

If it can help, I think there are 2 options :

1 - you can deploy a Web App with a doPost() function that will receive the Callback from Bitrix24. Example :

function doPost(e) { Logger.log(JSON.stringify(e)); }

Deploy your Web App to be accessible to anyone, and with "Execute the app as me" option. Then get this Web App's URL (something like https://script.google.com/..../exec) and pass it as your Callback URL parameter when calling Bitrix24

2 - you can also call Bitrix24 directly from you GAS Web App, using a state token to generate the CallBack URL. More information here : https://developers.google.com/apps-script/reference/script/state-token-builder

Sign up to request clarification or add additional context in comments.

2 Comments

Hi @Ujuj. Thank you, sorry for the late reply. It's been some time since I looked into this, but I think that my conclusion (for my needs) was it was not possible (limitation on the Bitrix24 side). Sorry I cannot remember the exact reason. Thanks again.
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.