1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-11-28 09:08:38 +02:00

Создание MD файлов документации

This commit is contained in:
Vitaly the Alpaca 2024-06-21 06:43:00 +00:00 committed by Vitaly the Alpaca (bot)
parent 2f1965c686
commit 96b21493c5
20 changed files with 948 additions and 948 deletions

View File

@ -12,7 +12,7 @@ sidebar_position: 7
|-|-|-|-|
| URL | --url | String | URL of webhook or a Bitrix24 domain, when token used |
| PostID | --postid | String, Number | Post ID |
| Visibility | --vision | String | Array or a single post target: UA all, SG<X> work group, U<X> user, DR<X> depart., G<X> group |
| Visibility | --vision | String | Array or 1 recipient: UA all, SGn w. group, Un user, DRn department, Gn group |
| Token | --token | String | Access token, when not-webhook method used |

View File

@ -12,7 +12,7 @@ sidebar_position: 1
|-|-|-|-|
| URL | --url | String | URL of webhook or a Bitrix24 domain, when token used |
| Text | --text | String | Text of post |
| Visibility | --vision | String | Array or a single post target: UA all, SG<X> work group, U<X> user, DR<X> depart., G<X> group |
| Visibility | --vision | String | Array or 1 recipient: UA all, SGn w. group, Un user, DRn department, Gn group |
| Files | --files | String | Attachment data where key > filename, value > file path or binary data |
| Title | --title | String | Post title |
| Important | --important | Boolean | Mark post as important |

View File

@ -13,7 +13,7 @@ sidebar_position: 2
| URL | --url | String | URL of webhook or a Bitrix24 domain, when token used |
| PostID | --postid | String, Number | Post ID |
| Text | --text | String | Text of post |
| Visibility | --vision | String | Array or a single post target: UA all, SG<X> work group, U<X> user, DR<X> depart., G<X> group |
| Visibility | --vision | String | Array or 1 recipient: UA all, SGn w. group, Un user, DRn department, Gn group |
| Files | --files | String | Attachment data where key > filename, value > file path or binary data |
| Title | --title | String | Post title |
| Token | --token | String | Access token, when not-webhook method used |

View File

@ -1,24 +1,24 @@
---
id: Airtable
sidebar_class_name: Airtable
---
<img src={require('../../static/img/APIs/Airtable.png').default} width='64px' />
# Airtable
This section is dedicated to the library for working with Airtable API. On this page, all the steps necessary to start working are described
## Getting started
1. Sign in to Airtable and go to the **[personal tokens creation page](https://airtable.com/create/tokens)**, press **Create new token**
![BF](../../static/img/Docs/Airtable/1.png)
2. Enter a name for the new token, select the necessary **scopes** (permissions), and choose the databases and workspaces to which the token will have access
![BF](../../static/img/Docs/Airtable/2.png)
3. Copy the new **token**
![BF](../../static/img/Docs/Airtable/3.png)
---
id: Airtable
sidebar_class_name: Airtable
---
<img src={require('../../static/img/APIs/Airtable.png').default} width='64px' />
# Airtable
This section is dedicated to the library for working with Airtable API. On this page, all the steps necessary to start working are described
## Getting started
1. Sign in to Airtable and go to the **[personal tokens creation page](https://airtable.com/create/tokens)**, press **Create new token**
![BF](../../static/img/Docs/Airtable/1.png)
2. Enter a name for the new token, select the necessary **scopes** (permissions), and choose the databases and workspaces to which the token will have access
![BF](../../static/img/Docs/Airtable/2.png)
3. Copy the new **token**
![BF](../../static/img/Docs/Airtable/3.png)

View File

@ -1,62 +1,62 @@
---
id: Bitrix24
sidebar_class_name: Bitrix24
---
<img src={require('../../static/img/APIs/Bitrix24.png').default} width='64px' />
# Bitrix24
This section is dedicated to the library for working with Bitrix24 API. On this page, all the steps necessary to start working are described
## Getting started
There are two ways to work with Bitrix24 via API: via **Webhook** and via **local application**. For both options you need:
1. Go to **Developers** in the **Applications** section of the sidebar
![BF](../../static/img/Docs/Bitrix24/1.png)
2. Select **Other**
![BF](../../static/img/Docs/Bitrix24/2.png)
<hr/><br/>
### To work via Webhook
1. Select **Incoming Webhook**
![BF](../../static/img/Docs/Bitrix24/3.png)
2. Fill in the necessary permissions in **Permissions Settings** and save the URL of the webhook. This will be used to execute library methods as the **URL** parameter. The optional **Token** parameter will always remain empty in this case
![BF](../../static/img/Docs/Bitrix24/4.png)
<hr/><br/>
## To work via Local Application
1. Select **Local Application**
![BF](../../static/img/Docs/Bitrix24/5.png)
2. Select the path of the handler (if the application does not imply authorization of other users, but only Bitrix management through one administrator account, you can choose any address, for example https://localhost), tick **Use only API** (if you need only the functionality of calling library methods) and fill in the necessary permissions
![BF](../../static/img/Docs/Bitrix24/6.png)
3. Save the **application key** and **application code**
![BF](../../static/img/Docs/Bitrix24/7.png)
4. Using the application key, call the **GetAppAuthLink** function and follow the received link in the browser. After authorization, copy the received code from the address bar (or get it to the handler whose address was specified in point 2)
![BF](../../static/img/Docs/Bitrix24/8.png)
5. Pass the received code, along with the application key and secret, to the **GetToken** function. Save the received **access** and **refresh tokens**
6. Tokens have a limited lifetime. To get a new token, you can use the **UpdateToken** function, passing here the refresh token, key and application secret. The refresh creates not only a new access token, but also a refresh token as well
---
id: Bitrix24
sidebar_class_name: Bitrix24
---
<img src={require('../../static/img/APIs/Bitrix24.png').default} width='64px' />
# Bitrix24
This section is dedicated to the library for working with Bitrix24 API. On this page, all the steps necessary to start working are described
## Getting started
There are two ways to work with Bitrix24 via API: via **Webhook** and via **local application**. For both options you need:
1. Go to **Developers** in the **Applications** section of the sidebar
![BF](../../static/img/Docs/Bitrix24/1.png)
2. Select **Other**
![BF](../../static/img/Docs/Bitrix24/2.png)
<hr/><br/>
### To work via Webhook
1. Select **Incoming Webhook**
![BF](../../static/img/Docs/Bitrix24/3.png)
2. Fill in the necessary permissions in **Permissions Settings** and save the URL of the webhook. This will be used to execute library methods as the **URL** parameter. The optional **Token** parameter will always remain empty in this case
![BF](../../static/img/Docs/Bitrix24/4.png)
<hr/><br/>
## To work via Local Application
1. Select **Local Application**
![BF](../../static/img/Docs/Bitrix24/5.png)
2. Select the path of the handler (if the application does not imply authorization of other users, but only Bitrix management through one administrator account, you can choose any address, for example https://localhost), tick **Use only API** (if you need only the functionality of calling library methods) and fill in the necessary permissions
![BF](../../static/img/Docs/Bitrix24/6.png)
3. Save the **application key** and **application code**
![BF](../../static/img/Docs/Bitrix24/7.png)
4. Using the application key, call the **GetAppAuthLink** function and follow the received link in the browser. After authorization, copy the received code from the address bar (or get it to the handler whose address was specified in point 2)
![BF](../../static/img/Docs/Bitrix24/8.png)
5. Pass the received code, along with the application key and secret, to the **GetToken** function. Save the received **access** and **refresh tokens**
6. Tokens have a limited lifetime. To get a new token, you can use the **UpdateToken** function, passing here the refresh token, key and application secret. The refresh creates not only a new access token, but also a refresh token as well

View File

@ -1,40 +1,40 @@
---
id: Dropbox
sidebar_class_name: Dropbox
---
<img src={require('../../static/img/APIs/Dropbox.png').default} width='64px' />
# Dropbox
This section is dedicated to the library for working with Dropbox API. On this page, all the steps necessary to start working are described
## Getting started
1. Login to [Dropbox Developers](https://www.dropbox.com/developers)
![BF](../../static/img/Docs/Dropbox/1.png)
1. Go to **App Console**
![BF](../../static/img/Docs/Dropbox/2.png)
2. Click on **Create app**
![BF](../../static/img/Docs/Dropbox/3.png)
4. Enter a name for the new application and select **Full Dropbox**
![BF](../../static/img/Docs/Dropbox/4.png)
5. After creation, on the application page, click **Scoped app** and select the permissions that are necessary to solve your problems. Save **AppKey** and **AppSecret**
![BF](../../static/img/Docs/Dropbox/5.png)
6. Get the authorization link using the *GetAuthorizationLink()* function and pass it in the browser
![BF](../../static/img/Docs/Dropbox/6.png)
7. Pass the **received code**, **AppKey** and **AppSecret** to the function *GetToken()*, save the received **access_token** and **refresh_token**
8. After the access_token lifetime expires, it can be updated using the function *RefreshToken()*
---
id: Dropbox
sidebar_class_name: Dropbox
---
<img src={require('../../static/img/APIs/Dropbox.png').default} width='64px' />
# Dropbox
This section is dedicated to the library for working with Dropbox API. On this page, all the steps necessary to start working are described
## Getting started
1. Login to [Dropbox Developers](https://www.dropbox.com/developers)
![BF](../../static/img/Docs/Dropbox/1.png)
1. Go to **App Console**
![BF](../../static/img/Docs/Dropbox/2.png)
2. Click on **Create app**
![BF](../../static/img/Docs/Dropbox/3.png)
4. Enter a name for the new application and select **Full Dropbox**
![BF](../../static/img/Docs/Dropbox/4.png)
5. After creation, on the application page, click **Scoped app** and select the permissions that are necessary to solve your problems. Save **AppKey** and **AppSecret**
![BF](../../static/img/Docs/Dropbox/5.png)
6. Get the authorization link using the *GetAuthorizationLink()* function and pass it in the browser
![BF](../../static/img/Docs/Dropbox/6.png)
7. Pass the **received code**, **AppKey** and **AppSecret** to the function *GetToken()*, save the received **access_token** and **refresh_token**
8. After the access_token lifetime expires, it can be updated using the function *RefreshToken()*

View File

@ -1,98 +1,98 @@
---
id: GoogleCalendar
sidebar_class_name: GoogleCalendar
---
<img src={require('../../static/img/APIs/GoogleCalendar.png').default} width='64px' />
# Google Calendar
This section is dedicated to the library for working with API Google Calendar. On this page, all the steps necessary to start working are described
:::important
If you're already using the API to interact with other Google Workspace services and have completed the initial setup, you can skip the steps for **Creating a Project** and **Setting Up OAuth**. You just need to enable the Google Drive** service in your existing project and reacquire the token (the last two steps in the instructions).
:::
## Getting started
<hr/>
### Project creation
1. Go to the [Google Cloud Console](https://console.cloud.google.com) and create a project
![BF](../../static/img/Docs/GoogleCalendar/1.png)
2. Select the created project and in the side menu go to APIs and Services -> OAuth consent screen
![BF](../../static/img/Docs/GoogleCalendar/2.png)
3. Choose External
![BF](../../static/img/Docs/GoogleCalendar/3.png)
4. Fill in the fields: App name, User support email, and Email addresses (all fields with asterisks)
![BF](../../static/img/Docs/GoogleCalendar/4.png)
5. Click on Next and then Save and continue on the last tab
![BF](../../static/img/Docs/GoogleCalendar/5.png)
6. Click on Publish App
![BF](../../static/img/Docs/GoogleCalendar/6.png)
<hr/>
### OAuth settings
1. In the side menu, select Credentials -> Create Credentials -> OAuth client ID
![BF](../../static/img/Docs/GoogleCalendar/7.png)
2. Enter the name and choose Application type - Desktop app
![BF](../../static/img/Docs/GoogleCalendar/8.png)
3. Save ClientID and Client Secret
![BF](../../static/img/Docs/GoogleCalendar/9.png)
<hr/>
### Enable service - Google Calendar
1. Go to the [Calendar page on the Marketplace](https://console.cloud.google.com/marketplace/product/google/calendar-json.googleapis.com)
2. Click Enable
![BF](../../static/img/Docs/GoogleCalendar/12.png)
<hr/>
### Token retrieval
1. Pass the ClientID to the function OPI_GoogleWorkspace.FormCodeRetrievalLink() with boolean parameters of the services you use. The function will result in a URL that needs to be opened in the browser. Authorize with your Google account
![BF](../../static/img/Docs/GoogleCalendar/10.png)
2. Copy the code from the URL after authorization
![BF](../../static/img/Docs/GoogleCalendar/11.png)
3. Use the obtained code, ClientID, and Client Secret to call the function OPI_GoogleWorkspace.GetTokenByCode(ClientID, ClientSecret, Code)
```json title="Result of the function GetTokenByCode() if converted to JSON"
{
"token_type": "Bearer",
"refresh_token": "1//09au6OES3JN9oCgYIARAAGAkSNwF-L9Ir1B7uawfwafT1wE0FKO519Xj6JxawfawfyjMyJ_QlUZYLHZqw",
"scope": "https://www.googleapis.com/auth/calendar",
"expires_in": 3599,
"access_token": "ya29.a0AfB_byA344tXkIawdawdwadadhyZQV8bSZn_snNXtY2HLb7l71awdawdawdad-ASgpzyOSWIvEmPruhUa_1yCCq6jvoD0r_q-fNEsARrH8zpJ3c6LNGWvwdg8CXsSxYaCgYKAWkSawfwafawfrCK0EP5kZY_A0171"
}
```
4. Use the **access_token** to pass as a Token parameter when calling functions of the library, and the **refresh_token** - to obtain a new access_token (function OPI_GoogleWorkspace.RefreshToken(ClientID, ClientSecret, RefreshToken)), when the old one expires. When refreshing the token, the refresh_token is not updated - you can use the same one to get a new access_token each time.
---
id: GoogleCalendar
sidebar_class_name: GoogleCalendar
---
<img src={require('../../static/img/APIs/GoogleCalendar.png').default} width='64px' />
# Google Calendar
This section is dedicated to the library for working with API Google Calendar. On this page, all the steps necessary to start working are described
:::important
If you're already using the API to interact with other Google Workspace services and have completed the initial setup, you can skip the steps for **Creating a Project** and **Setting Up OAuth**. You just need to enable the Google Drive** service in your existing project and reacquire the token (the last two steps in the instructions).
:::
## Getting started
<hr/>
### Project creation
1. Go to the [Google Cloud Console](https://console.cloud.google.com) and create a project
![BF](../../static/img/Docs/GoogleCalendar/1.png)
2. Select the created project and in the side menu go to APIs and Services -> OAuth consent screen
![BF](../../static/img/Docs/GoogleCalendar/2.png)
3. Choose External
![BF](../../static/img/Docs/GoogleCalendar/3.png)
4. Fill in the fields: App name, User support email, and Email addresses (all fields with asterisks)
![BF](../../static/img/Docs/GoogleCalendar/4.png)
5. Click on Next and then Save and continue on the last tab
![BF](../../static/img/Docs/GoogleCalendar/5.png)
6. Click on Publish App
![BF](../../static/img/Docs/GoogleCalendar/6.png)
<hr/>
### OAuth settings
1. In the side menu, select Credentials -> Create Credentials -> OAuth client ID
![BF](../../static/img/Docs/GoogleCalendar/7.png)
2. Enter the name and choose Application type - Desktop app
![BF](../../static/img/Docs/GoogleCalendar/8.png)
3. Save ClientID and Client Secret
![BF](../../static/img/Docs/GoogleCalendar/9.png)
<hr/>
### Enable service - Google Calendar
1. Go to the [Calendar page on the Marketplace](https://console.cloud.google.com/marketplace/product/google/calendar-json.googleapis.com)
2. Click Enable
![BF](../../static/img/Docs/GoogleCalendar/12.png)
<hr/>
### Token retrieval
1. Pass the ClientID to the function OPI_GoogleWorkspace.FormCodeRetrievalLink() with boolean parameters of the services you use. The function will result in a URL that needs to be opened in the browser. Authorize with your Google account
![BF](../../static/img/Docs/GoogleCalendar/10.png)
2. Copy the code from the URL after authorization
![BF](../../static/img/Docs/GoogleCalendar/11.png)
3. Use the obtained code, ClientID, and Client Secret to call the function OPI_GoogleWorkspace.GetTokenByCode(ClientID, ClientSecret, Code)
```json title="Result of the function GetTokenByCode() if converted to JSON"
{
"token_type": "Bearer",
"refresh_token": "1//09au6OES3JN9oCgYIARAAGAkSNwF-L9Ir1B7uawfwafT1wE0FKO519Xj6JxawfawfyjMyJ_QlUZYLHZqw",
"scope": "https://www.googleapis.com/auth/calendar",
"expires_in": 3599,
"access_token": "ya29.a0AfB_byA344tXkIawdawdwadadhyZQV8bSZn_snNXtY2HLb7l71awdawdawdad-ASgpzyOSWIvEmPruhUa_1yCCq6jvoD0r_q-fNEsARrH8zpJ3c6LNGWvwdg8CXsSxYaCgYKAWkSawfwafawfrCK0EP5kZY_A0171"
}
```
4. Use the **access_token** to pass as a Token parameter when calling functions of the library, and the **refresh_token** - to obtain a new access_token (function OPI_GoogleWorkspace.RefreshToken(ClientID, ClientSecret, RefreshToken)), when the old one expires. When refreshing the token, the refresh_token is not updated - you can use the same one to get a new access_token each time.

View File

@ -1,98 +1,98 @@
---
id: GoogleDrive
sidebar_class_name: GoogleDrive
---
<img src={require('../../static/img/APIs/GoogleDrive.png').default} width='64px' />
# Google Drive
This section is dedicated to the library for working with API Google Drive. On this page, all the steps necessary to start working are described
:::important
If you're already using the API to interact with other Google Workspace services and have completed the initial setup, you can skip the steps for **Creating a Project** and **Setting Up OAuth**. You just need to enable the Google Drive** service in your existing project and reacquire the token (the last two steps in the instructions).
:::
## Getting started
<hr/>
### Project creation
1. Go to the [Google Cloud Console](https://console.cloud.google.com) and create a project
![BF](../../static/img/Docs/GoogleCalendar/1.png)
2. Select the created project and in the side menu go to APIs and Services -> OAuth consent screen
![BF](../../static/img/Docs/GoogleCalendar/2.png)
3. Choose External
![BF](../../static/img/Docs/GoogleCalendar/3.png)
4. Fill in the fields: App name, User support email, and Email addresses (all fields with asterisks)
![BF](../../static/img/Docs/GoogleCalendar/4.png)
5. Click on Next and then Save and continue on the last tab
![BF](../../static/img/Docs/GoogleCalendar/5.png)
6. Click on Publish App
![BF](../../static/img/Docs/GoogleCalendar/6.png)
<hr/>
### OAuth settings
1. In the side menu, select Credentials -> Create Credentials -> OAuth client ID
![BF](../../static/img/Docs/GoogleCalendar/7.png)
2. Enter the name and choose Application type - Desktop app
![BF](../../static/img/Docs/GoogleCalendar/8.png)
3. Save ClientID and Client Secret
![BF](../../static/img/Docs/GoogleCalendar/9.png)
<hr/>
### Enable service - Google Drive
1. Go to [page Drive in Marketplace](https://console.cloud.google.com/marketplace/product/google/drive.googleapis.com)
2. Click Enable
![BF](../../static/img/Docs/GoogleDrive/1.png)
<hr/>
### Token retrieval
1. Pass the ClientID to the function OPI_GoogleWorkspace.FormCodeRetrievalLink() with boolean parameters of the services you use. The function will result in a URL that needs to be opened in the browser. Authorize with your Google account
![BF](../../static/img/Docs/GoogleCalendar/10.png)
2. Copy the code from the URL after authorization
![BF](../../static/img/Docs/GoogleCalendar/11.png)
3. Use the obtained code, ClientID, and Client Secret to call the function OPI_GoogleWorkspace.GetTokenByCode(ClientID, ClientSecret, Code)
```json title="Result of the function GetTokenByCode() if converted to JSON"
{
"token_type": "Bearer",
"refresh_token": "1//09au6OES3JN9oCgYIARAAGAkSNwF-L9Ir1B7uawfwafT1wE0FKO519Xj6JxawfawfyjMyJ_QlUZYLHZqw",
"scope": "https://www.googleapis.com/auth/...",
"expires_in": 3599,
"access_token": "ya29.a0AfB_byA344tXkIawdawdwadadhyZQV8bSZn_snNXtY2HLb7l71awdawdawdad-ASgpzyOSWIvEmPruhUa_1yCCq6jvoD0r_q-fNEsARrH8zpJ3c6LNGWvwdg8CXsSxYaCgYKAWkSawfwafawfrCK0EP5kZY_A0171"
}
```
4. Use the **access_token** to pass as a Token parameter when calling functions of the library, and the **refresh_token** - to obtain a new access_token (function OPI_GoogleWorkspace.RefreshToken(ClientID, ClientSecret, RefreshToken)), when the old one expires. When refreshing the token, the refresh_token is not updated - you can use the same one to get a new access_token each time.
---
id: GoogleDrive
sidebar_class_name: GoogleDrive
---
<img src={require('../../static/img/APIs/GoogleDrive.png').default} width='64px' />
# Google Drive
This section is dedicated to the library for working with API Google Drive. On this page, all the steps necessary to start working are described
:::important
If you're already using the API to interact with other Google Workspace services and have completed the initial setup, you can skip the steps for **Creating a Project** and **Setting Up OAuth**. You just need to enable the Google Drive** service in your existing project and reacquire the token (the last two steps in the instructions).
:::
## Getting started
<hr/>
### Project creation
1. Go to the [Google Cloud Console](https://console.cloud.google.com) and create a project
![BF](../../static/img/Docs/GoogleCalendar/1.png)
2. Select the created project and in the side menu go to APIs and Services -> OAuth consent screen
![BF](../../static/img/Docs/GoogleCalendar/2.png)
3. Choose External
![BF](../../static/img/Docs/GoogleCalendar/3.png)
4. Fill in the fields: App name, User support email, and Email addresses (all fields with asterisks)
![BF](../../static/img/Docs/GoogleCalendar/4.png)
5. Click on Next and then Save and continue on the last tab
![BF](../../static/img/Docs/GoogleCalendar/5.png)
6. Click on Publish App
![BF](../../static/img/Docs/GoogleCalendar/6.png)
<hr/>
### OAuth settings
1. In the side menu, select Credentials -> Create Credentials -> OAuth client ID
![BF](../../static/img/Docs/GoogleCalendar/7.png)
2. Enter the name and choose Application type - Desktop app
![BF](../../static/img/Docs/GoogleCalendar/8.png)
3. Save ClientID and Client Secret
![BF](../../static/img/Docs/GoogleCalendar/9.png)
<hr/>
### Enable service - Google Drive
1. Go to [page Drive in Marketplace](https://console.cloud.google.com/marketplace/product/google/drive.googleapis.com)
2. Click Enable
![BF](../../static/img/Docs/GoogleDrive/1.png)
<hr/>
### Token retrieval
1. Pass the ClientID to the function OPI_GoogleWorkspace.FormCodeRetrievalLink() with boolean parameters of the services you use. The function will result in a URL that needs to be opened in the browser. Authorize with your Google account
![BF](../../static/img/Docs/GoogleCalendar/10.png)
2. Copy the code from the URL after authorization
![BF](../../static/img/Docs/GoogleCalendar/11.png)
3. Use the obtained code, ClientID, and Client Secret to call the function OPI_GoogleWorkspace.GetTokenByCode(ClientID, ClientSecret, Code)
```json title="Result of the function GetTokenByCode() if converted to JSON"
{
"token_type": "Bearer",
"refresh_token": "1//09au6OES3JN9oCgYIARAAGAkSNwF-L9Ir1B7uawfwafT1wE0FKO519Xj6JxawfawfyjMyJ_QlUZYLHZqw",
"scope": "https://www.googleapis.com/auth/...",
"expires_in": 3599,
"access_token": "ya29.a0AfB_byA344tXkIawdawdwadadhyZQV8bSZn_snNXtY2HLb7l71awdawdawdad-ASgpzyOSWIvEmPruhUa_1yCCq6jvoD0r_q-fNEsARrH8zpJ3c6LNGWvwdg8CXsSxYaCgYKAWkSawfwafawfrCK0EP5kZY_A0171"
}
```
4. Use the **access_token** to pass as a Token parameter when calling functions of the library, and the **refresh_token** - to obtain a new access_token (function OPI_GoogleWorkspace.RefreshToken(ClientID, ClientSecret, RefreshToken)), when the old one expires. When refreshing the token, the refresh_token is not updated - you can use the same one to get a new access_token each time.

View File

@ -1,98 +1,98 @@
---
id: GoogleSheets
sidebar_class_name: GoogleSheets
---
<img src={require('../../static/img/APIs/GoogleSheets.png').default} width='64px' />
# Google Sheets
This section is dedicated to the library for working with API Google Sheets. On this page, all the steps necessary to start working are described
:::important
If you're already using the API to interact with other Google Workspace services and have completed the initial setup, you can skip the steps for **Creating a Project** and **Setting Up OAuth**. You just need to enable the Google Sheets** service in your existing project and reacquire the token (the last two steps in the instructions).
:::
## Getting started
<hr/>
### Project creation
1. Go to the [Google Cloud Console](https://console.cloud.google.com) and create a project
![BF](../../static/img/Docs/GoogleCalendar/1.png)
2. Select the created project and in the side menu go to APIs and Services -> OAuth consent screen
![BF](../../static/img/Docs/GoogleCalendar/2.png)
3. Choose External
![BF](../../static/img/Docs/GoogleCalendar/3.png)
4. Fill in the fields: App name, User support email, and Email addresses (all fields with asterisks)
![BF](../../static/img/Docs/GoogleCalendar/4.png)
5. Click on Next and then Save and continue on the last tab
![BF](../../static/img/Docs/GoogleCalendar/5.png)
6. Click on Publish App
![BF](../../static/img/Docs/GoogleCalendar/6.png)
<hr/>
### OAuth settings
1. In the side menu, select Credentials -> Create Credentials -> OAuth client ID
![BF](../../static/img/Docs/GoogleCalendar/7.png)
2. Enter the name and choose Application type - Desktop app
![BF](../../static/img/Docs/GoogleCalendar/8.png)
3. Save ClientID and Client Secret
![BF](../../static/img/Docs/GoogleCalendar/9.png)
<hr/>
### Enable service - Google Sheets
1. Go to [page Sheets in Marketplace](https://console.cloud.google.com/marketplace/product/google/sheets.googleapis.com)
2. Click Enable
![BF](../../static/img/Docs/GoogleSheets/1.png)
<hr/>
### Token retrieval
1. Pass the ClientID to the function OPI_GoogleWorkspace.FormCodeRetrievalLink() with boolean parameters of the services you use. The function will result in a URL that needs to be opened in the browser. Authorize with your Google account
![BF](../../static/img/Docs/GoogleCalendar/10.png)
2. Copy the code from the URL after authorization
![BF](../../static/img/Docs/GoogleCalendar/11.png)
3. Use the obtained code, ClientID, and Client Secret to call the function OPI_GoogleWorkspace.GetTokenByCode(ClientID, ClientSecret, Code)
```json title="Result of the function GetTokenByCode() if converted to JSON"
{
"token_type": "Bearer",
"refresh_token": "1//09au6OES3JN9oCgYIARAAGAkSNwF-L9Ir1B7uawfwafT1wE0FKO519Xj6JxawfawfyjMyJ_QlUZYLHZqw",
"scope": "https://www.googleapis.com/auth/...",
"expires_in": 3599,
"access_token": "ya29.a0AfB_byA344tXkIawdawdwadadhyZQV8bSZn_snNXtY2HLb7l71awdawdawdad-ASgpzyOSWIvEmPruhUa_1yCCq6jvoD0r_q-fNEsARrH8zpJ3c6LNGWvwdg8CXsSxYaCgYKAWkSawfwafawfrCK0EP5kZY_A0171"
}
```
4. Use the **access_token** to pass as a Token parameter when calling functions of the library, and the **refresh_token** - to obtain a new access_token (function OPI_GoogleWorkspace.RefreshToken(ClientID, ClientSecret, RefreshToken)), when the old one expires. When refreshing the token, the refresh_token is not updated - you can use the same one to get a new access_token each time.
---
id: GoogleSheets
sidebar_class_name: GoogleSheets
---
<img src={require('../../static/img/APIs/GoogleSheets.png').default} width='64px' />
# Google Sheets
This section is dedicated to the library for working with API Google Sheets. On this page, all the steps necessary to start working are described
:::important
If you're already using the API to interact with other Google Workspace services and have completed the initial setup, you can skip the steps for **Creating a Project** and **Setting Up OAuth**. You just need to enable the Google Sheets** service in your existing project and reacquire the token (the last two steps in the instructions).
:::
## Getting started
<hr/>
### Project creation
1. Go to the [Google Cloud Console](https://console.cloud.google.com) and create a project
![BF](../../static/img/Docs/GoogleCalendar/1.png)
2. Select the created project and in the side menu go to APIs and Services -> OAuth consent screen
![BF](../../static/img/Docs/GoogleCalendar/2.png)
3. Choose External
![BF](../../static/img/Docs/GoogleCalendar/3.png)
4. Fill in the fields: App name, User support email, and Email addresses (all fields with asterisks)
![BF](../../static/img/Docs/GoogleCalendar/4.png)
5. Click on Next and then Save and continue on the last tab
![BF](../../static/img/Docs/GoogleCalendar/5.png)
6. Click on Publish App
![BF](../../static/img/Docs/GoogleCalendar/6.png)
<hr/>
### OAuth settings
1. In the side menu, select Credentials -> Create Credentials -> OAuth client ID
![BF](../../static/img/Docs/GoogleCalendar/7.png)
2. Enter the name and choose Application type - Desktop app
![BF](../../static/img/Docs/GoogleCalendar/8.png)
3. Save ClientID and Client Secret
![BF](../../static/img/Docs/GoogleCalendar/9.png)
<hr/>
### Enable service - Google Sheets
1. Go to [page Sheets in Marketplace](https://console.cloud.google.com/marketplace/product/google/sheets.googleapis.com)
2. Click Enable
![BF](../../static/img/Docs/GoogleSheets/1.png)
<hr/>
### Token retrieval
1. Pass the ClientID to the function OPI_GoogleWorkspace.FormCodeRetrievalLink() with boolean parameters of the services you use. The function will result in a URL that needs to be opened in the browser. Authorize with your Google account
![BF](../../static/img/Docs/GoogleCalendar/10.png)
2. Copy the code from the URL after authorization
![BF](../../static/img/Docs/GoogleCalendar/11.png)
3. Use the obtained code, ClientID, and Client Secret to call the function OPI_GoogleWorkspace.GetTokenByCode(ClientID, ClientSecret, Code)
```json title="Result of the function GetTokenByCode() if converted to JSON"
{
"token_type": "Bearer",
"refresh_token": "1//09au6OES3JN9oCgYIARAAGAkSNwF-L9Ir1B7uawfwafT1wE0FKO519Xj6JxawfawfyjMyJ_QlUZYLHZqw",
"scope": "https://www.googleapis.com/auth/...",
"expires_in": 3599,
"access_token": "ya29.a0AfB_byA344tXkIawdawdwadadhyZQV8bSZn_snNXtY2HLb7l71awdawdawdad-ASgpzyOSWIvEmPruhUa_1yCCq6jvoD0r_q-fNEsARrH8zpJ3c6LNGWvwdg8CXsSxYaCgYKAWkSawfwafawfrCK0EP5kZY_A0171"
}
```
4. Use the **access_token** to pass as a Token parameter when calling functions of the library, and the **refresh_token** - to obtain a new access_token (function OPI_GoogleWorkspace.RefreshToken(ClientID, ClientSecret, RefreshToken)), when the old one expires. When refreshing the token, the refresh_token is not updated - you can use the same one to get a new access_token each time.

View File

@ -1,38 +1,38 @@
---
id: Notion
sidebar_class_name: Notion
---
<img src={require('../../static/img/APIs/Notion.png').default} width='64px' />
# Notion
This section is dedicated to the library for working with Notion API. On this page, all the steps necessary to start working are described
## Getting started
1. Go to the **[section of integrations of the developer portal](https://www.notion.so/my-integrations)**
![BF](../../static/img/Docs/Notion/1.png)
2. Enter the name of your integration
![BF](../../static/img/Docs/Notion/2.png)
3. After finishing the integration creation, click *Show* and copy the **Token (Secret)**
![BF](../../static/img/Docs/Notion/3.png)
4. Go to the **[main interface of Notion](https://notion.so)** and create a new page. This page will serve as the parent for all other objects created through the API
![BF](../../static/img/Docs/Notion/4.png)
5. Click on the three dots in the upper right corner and at the very bottom find the item *Add connections*. Select your integration from items 1-3 there
![BF](../../static/img/Docs/Notion/5.png)
6. Get the ID of this page. You can do this by clicking Share -> Copy link or simply by copying it from the URL
![BF](../../static/img/Docs/Notion/6.png)
**Token** and **Page ID** are the two parameters required for working through the API.
---
id: Notion
sidebar_class_name: Notion
---
<img src={require('../../static/img/APIs/Notion.png').default} width='64px' />
# Notion
This section is dedicated to the library for working with Notion API. On this page, all the steps necessary to start working are described
## Getting started
1. Go to the **[section of integrations of the developer portal](https://www.notion.so/my-integrations)**
![BF](../../static/img/Docs/Notion/1.png)
2. Enter the name of your integration
![BF](../../static/img/Docs/Notion/2.png)
3. After finishing the integration creation, click *Show* and copy the **Token (Secret)**
![BF](../../static/img/Docs/Notion/3.png)
4. Go to the **[main interface of Notion](https://notion.so)** and create a new page. This page will serve as the parent for all other objects created through the API
![BF](../../static/img/Docs/Notion/4.png)
5. Click on the three dots in the upper right corner and at the very bottom find the item *Add connections*. Select your integration from items 1-3 there
![BF](../../static/img/Docs/Notion/5.png)
6. Get the ID of this page. You can do this by clicking Share -> Copy link or simply by copying it from the URL
![BF](../../static/img/Docs/Notion/6.png)
**Token** and **Page ID** are the two parameters required for working through the API.

View File

@ -1,64 +1,64 @@
---
id: Slack
sidebar_class_name: Slack
---
<img src={require('../../static/img/APIs/Slack.png').default} width='64px' />
# Slack
This section is dedicated to the library for working with the Slack Web API. On this page, all the steps necessary to start working are described
## Getting started
1. Log in to your account and go to the **Your Apps** page on the website [Slack API](https://api.slack.com)
![BF](../../static/img/Docs/Slack/1.png)
<br/>
2. Click **Create App** and choose **From scratch**
![BF](../../static/img/Docs/Slack/2.png)
3. Select the name and workspace where you need to create the application
![BF](../../static/img/Docs/Slack/3.png)
<br/>
4. Create a new token by clicking Generate Token and Scopes below on the application page
![BF](../../static/img/Docs/Slack/4.png)
<br/>
5. Select a name and add permissions
![BF](../../static/img/Docs/Slack/5.png)
<br/>
6. Go to **Premission scope** page
![BF](../../static/img/Docs/Slack/6.png)
<br/>
7. Add the permissions required for your purposes
![BF](../../static/img/Docs/Slack/7.png)
<br/>
8. Install the application
![BF](../../static/img/Docs/Slack/8.png)
<br/>
9. Save the generated token
![BF](../../static/img/Docs/Slack/9.png)
<br/>
---
id: Slack
sidebar_class_name: Slack
---
<img src={require('../../static/img/APIs/Slack.png').default} width='64px' />
# Slack
This section is dedicated to the library for working with the Slack Web API. On this page, all the steps necessary to start working are described
## Getting started
1. Log in to your account and go to the **Your Apps** page on the website [Slack API](https://api.slack.com)
![BF](../../static/img/Docs/Slack/1.png)
<br/>
2. Click **Create App** and choose **From scratch**
![BF](../../static/img/Docs/Slack/2.png)
3. Select the name and workspace where you need to create the application
![BF](../../static/img/Docs/Slack/3.png)
<br/>
4. Create a new token by clicking Generate Token and Scopes below on the application page
![BF](../../static/img/Docs/Slack/4.png)
<br/>
5. Select a name and add permissions
![BF](../../static/img/Docs/Slack/5.png)
<br/>
6. Go to **Premission scope** page
![BF](../../static/img/Docs/Slack/6.png)
<br/>
7. Add the permissions required for your purposes
![BF](../../static/img/Docs/Slack/7.png)
<br/>
8. Install the application
![BF](../../static/img/Docs/Slack/8.png)
<br/>
9. Save the generated token
![BF](../../static/img/Docs/Slack/9.png)
<br/>

View File

@ -1,44 +1,44 @@
---
id: Start
sidebar_class_name: NachaloRaboty
---
# Welcome!
![OPI](../../static/img/logo_long.png)
**Open Integrations Package** - is a set of tools for integration with some popular APIs via CLI, 1C, or OneScript. It consists of common modules, each responsible for its own API, as well as several utility modules that are common to all.
The implemented methods perform specific tasks (such as *SendMessage()* or *CreatePost()*), allowing them to be used without delving into the implementation details. However, the code is highly decomposed – authorization methods, data retrieval, etc., are separated into individual functions where possible. This makes it easy to add new methods, even if they are not yet implemented in the library at the current time.
<br/>
## Getting started
The library releases come in five variants:
- As a CLI application for Windows and Linux (exe, rpm, deb)
- As XML extension files for loading via the configurator
- As an EDT extension project
- As a standalone extension file in cfe format
- As a OneScript extension package in ospx format
Regardless of the chosen installation method, the files must be obtained from the [Release](https://github.com/Bayselonarrend/OpenIntegrations/releases) section, as the repository files may contain intermediate data and functions that are still in development.
For more details about each release variant, see the section [About Release Variants](/docs/Start/Release-variants)
<br/>
## Structure of modules
The project's common modules come in two types:
- Service
- OPI_Tools
- OPI_Cryptography
- Modules for direct interaction with APIs
- OPI_Telegram, OPI_VK...
:::warning
It is not recommended to use the methods of utility modules in other parts of your configuration (if you plan to update to new versions in the future). To maintain backward compatibility, the number/purpose of parameters and the return types for API interaction methods do not change, but this does not apply to utility modules, which can be modified in any way for optimization and adaptation to new requirements. If you need functionality from the utility modules, it is recommended to copy it separately.
:::
---
id: Start
sidebar_class_name: NachaloRaboty
---
# Welcome!
![OPI](../../static/img/logo_long.png)
**Open Integrations Package** - is a set of tools for integration with some popular APIs via CLI, 1C, or OneScript. It consists of common modules, each responsible for its own API, as well as several utility modules that are common to all.
The implemented methods perform specific tasks (such as *SendMessage()* or *CreatePost()*), allowing them to be used without delving into the implementation details. However, the code is highly decomposed – authorization methods, data retrieval, etc., are separated into individual functions where possible. This makes it easy to add new methods, even if they are not yet implemented in the library at the current time.
<br/>
## Getting started
The library releases come in five variants:
- As a CLI application for Windows and Linux (exe, rpm, deb)
- As XML extension files for loading via the configurator
- As an EDT extension project
- As a standalone extension file in cfe format
- As a OneScript extension package in ospx format
Regardless of the chosen installation method, the files must be obtained from the [Release](https://github.com/Bayselonarrend/OpenIntegrations/releases) section, as the repository files may contain intermediate data and functions that are still in development.
For more details about each release variant, see the section [About Release Variants](/docs/Start/Release-variants)
<br/>
## Structure of modules
The project's common modules come in two types:
- Service
- OPI_Tools
- OPI_Cryptography
- Modules for direct interaction with APIs
- OPI_Telegram, OPI_VK...
:::warning
It is not recommended to use the methods of utility modules in other parts of your configuration (if you plan to update to new versions in the future). To maintain backward compatibility, the number/purpose of parameters and the return types for API interaction methods do not change, but this does not apply to utility modules, which can be modified in any way for optimization and adaptation to new requirements. If you need functionality from the utility modules, it is recommended to copy it separately.
:::

View File

@ -1,41 +1,41 @@
---
id: Telegram
sidebar_class_name: Telegram
---
<img src={require('../../static/img/APIs/Telegram.png').default} width='64px' />
# Telegram
This section is dedicated to the library for working with Telegram API. On this page, all the steps necessary to start working are described
## Getting started
- Create a Telegram bot
1. All actions with the Telegram API are carried out through bots. To create a new bot, you need to start a conversation with [@BotFather](https://t.me/BotFather)
![BF](../../static/img/Docs/Telegram/2.png)
2. Choose */newbot* command
![BF](../../static/img/Docs/Telegram/3.png)
3. BotFather will prompt you to choose a name and a username for the bot, after which the creation process will be completed
- Save the **token** that BotFather sent you after completing the bot creation
![BF](../../static/img/Docs/Telegram/1.png)
- (Optional) Determine the purpose of the interaction
The bot you created can now be used in two ways
- Like a chat-bot
- For automating channel management
Depending on the chosen path, the way to obtain the **ChatID** (the parameter responsible for identifying the interaction object) will differ.
In the case of a chat bot, the chat ID will be the user ID with whom the bot is conversing. If the bot is to be used for channel management, after adding it as an administrator, you can use the channel's name with @ (e.g., @MyChannel) instead of the chat ID
The token and chat ID are the primary parameters for all methods of working with the Telegram API
---
id: Telegram
sidebar_class_name: Telegram
---
<img src={require('../../static/img/APIs/Telegram.png').default} width='64px' />
# Telegram
This section is dedicated to the library for working with Telegram API. On this page, all the steps necessary to start working are described
## Getting started
- Create a Telegram bot
1. All actions with the Telegram API are carried out through bots. To create a new bot, you need to start a conversation with [@BotFather](https://t.me/BotFather)
![BF](../../static/img/Docs/Telegram/2.png)
2. Choose */newbot* command
![BF](../../static/img/Docs/Telegram/3.png)
3. BotFather will prompt you to choose a name and a username for the bot, after which the creation process will be completed
- Save the **token** that BotFather sent you after completing the bot creation
![BF](../../static/img/Docs/Telegram/1.png)
- (Optional) Determine the purpose of the interaction
The bot you created can now be used in two ways
- Like a chat-bot
- For automating channel management
Depending on the chosen path, the way to obtain the **ChatID** (the parameter responsible for identifying the interaction object) will differ.
In the case of a chat bot, the chat ID will be the user ID with whom the bot is conversing. If the bot is to be used for channel management, after adding it as an administrator, you can use the channel's name with @ (e.g., @MyChannel) instead of the chat ID
The token and chat ID are the primary parameters for all methods of working with the Telegram API

View File

@ -1,120 +1,120 @@
---
id: Twitter
sidebar_class_name: Twitter
---
<img src={require('../../static/img/APIs/Twitter.png').default} width='64px' />
# Twitter | X
This section is dedicated to the library for working with Twitter API. On this page, all the steps necessary to start working are described. This library allows you to work with the functionality of the free plan, meaning you can create tweets.
## Getting started
Working with Twitter involves using two APIs - v1 (1.1) and v2, which are not separate types of actions but simply different versions of the API. Despite Twitter's preference for v2, it turned out that some mechanisms (such as the file upload mechanism) did not appear in it. Therefore, even for creating a regular tweet with an image, you need to work with both API versions, resulting in a double set of authentication data. This set is described in the function *GetStandardParameters()*
```bsl
Parameters_.Insert("redirect_uri", "");
Parameters_.Insert("scope", "");
Parameters_.Insert("client_id", "");
Parameters_.Insert("client_secret", "");
Parameters_.Insert("access_token", "");
Parameters_.Insert("refresh_token", "");
Parameters_.Insert("oauth_token", "");
Parameters_.Insert("oauth_token_secret", "");
Parameters_.Insert("oauth_consumer_key", "");
Parameters_.Insert("oauth_consumer_secret", "");
```
You can define these parameters directly within the structure inside this function or pass them directly when calling the functions for working with the API - each of them accepts parameters as the last optional argument. When passing parameters in this way, the default parameters will be overwritten by keys. Let's consider the creation of an application and obtaining each field
### Creating an application
To work with the Twitter API, you need to go to the following address: [https://developer.twitter.com/](https://developer.twitter.com/), register, and create a new application
![BF](../../static/img/Docs/Twitter/1.png)
![BF](../../static/img/Docs/Twitter/2.png)
![BF](../../static/img/Docs/Twitter/3.png)
![BF](../../static/img/Docs/Twitter/4.png)
![BF](../../static/img/Docs/Twitter/5.png)
### Definition of fields
After creating the application, you can fill in the necessary data in 1C
- **redirect_uri**
redirect_uri - The URL of the HTTP request handler specified during registration. Authorization for API v2 requires confirmation of login through the browser, after which a request with a special code will be sent to this handler. Further details will be provided in the section on access_token and refresh_token.
- **scope**
The scope determines the functions available for operation. In GetStandardParameters(), the scope list is defined by default.
- **client_id**
![BF](../../static/img/Docs/Twitter/6.png)
- **client_secret**
![BF](../../static/img/Docs/Twitter/7.png)
- **access_token** and **refresh_token**
These tokens need to be obtained via an HTTP request with the code that comes during authorization on the HTTP service redirect_uri. The sequence of actions is as follows:
1. Create a link for authorization in the browser using the *GetAuthorizationLink* function
2. Add to the HTTP service module (GET) a call to the *HandleIncomingRequestAfterAuthorization* function, passing the HTTP service request as a parameter.
3. Authorize in the browser using the link from step 1
3. Save the access_token and refresh_token obtained from the *HandleIncomingRequestAfterAuthorization* function in step 2 into constants or another storage
```bsl title="Obtaining"
Function Twitterget(Request)
Code = Request.RequestParameters["code"];
TokenResponse = OPI_Twitter.GetToken(Code, Parameters);
Constants.TwitterRefresh.Set(ResponseToken["refresh_token"]);
Constants.TwitterToken.Set(ResponseToken["access_token"]);
Response = New HTTPServiceResponse(200);
Return Response;
EndFunction
```
```bsl title="Updating"
Procedure UpdateTokenEveryTwoHours(Val Parameters)
Response = OPI_Twitter.RefreshToken(Parameters);
Constants.TwitterToken.Set(Response["access_token"]);
Constants.TwitterRefresh.Set(Response["refresh_token"]);
EndProcedure
```
Hardcoding token data is not recommended because the access_token expires after only 2 hours. Upon expiration, the token needs to be refreshed using the RefreshToken function. During this update, both the access_token and refresh_token are refreshed. Therefore, when refreshing the expired access_token token next time, the refresh_token should be from the previous request.
![BF](../../static/img/Docs/Twitter/8.png)
- **oauth_token** and **oauth_token_secret**
![BF](../../static/img/Docs/Twitter/9.png)
- **oauth_consumer_key** and **oauth_consumer_secret**
![BF](../../static/img/Docs/Twitter/10.png)
After filling in the data fields, you can proceed to work with the API methods
---
id: Twitter
sidebar_class_name: Twitter
---
<img src={require('../../static/img/APIs/Twitter.png').default} width='64px' />
# Twitter | X
This section is dedicated to the library for working with Twitter API. On this page, all the steps necessary to start working are described. This library allows you to work with the functionality of the free plan, meaning you can create tweets.
## Getting started
Working with Twitter involves using two APIs - v1 (1.1) and v2, which are not separate types of actions but simply different versions of the API. Despite Twitter's preference for v2, it turned out that some mechanisms (such as the file upload mechanism) did not appear in it. Therefore, even for creating a regular tweet with an image, you need to work with both API versions, resulting in a double set of authentication data. This set is described in the function *GetStandardParameters()*
```bsl
Parameters_.Insert("redirect_uri", "");
Parameters_.Insert("scope", "");
Parameters_.Insert("client_id", "");
Parameters_.Insert("client_secret", "");
Parameters_.Insert("access_token", "");
Parameters_.Insert("refresh_token", "");
Parameters_.Insert("oauth_token", "");
Parameters_.Insert("oauth_token_secret", "");
Parameters_.Insert("oauth_consumer_key", "");
Parameters_.Insert("oauth_consumer_secret", "");
```
You can define these parameters directly within the structure inside this function or pass them directly when calling the functions for working with the API - each of them accepts parameters as the last optional argument. When passing parameters in this way, the default parameters will be overwritten by keys. Let's consider the creation of an application and obtaining each field
### Creating an application
To work with the Twitter API, you need to go to the following address: [https://developer.twitter.com/](https://developer.twitter.com/), register, and create a new application
![BF](../../static/img/Docs/Twitter/1.png)
![BF](../../static/img/Docs/Twitter/2.png)
![BF](../../static/img/Docs/Twitter/3.png)
![BF](../../static/img/Docs/Twitter/4.png)
![BF](../../static/img/Docs/Twitter/5.png)
### Definition of fields
After creating the application, you can fill in the necessary data in 1C
- **redirect_uri**
redirect_uri - The URL of the HTTP request handler specified during registration. Authorization for API v2 requires confirmation of login through the browser, after which a request with a special code will be sent to this handler. Further details will be provided in the section on access_token and refresh_token.
- **scope**
The scope determines the functions available for operation. In GetStandardParameters(), the scope list is defined by default.
- **client_id**
![BF](../../static/img/Docs/Twitter/6.png)
- **client_secret**
![BF](../../static/img/Docs/Twitter/7.png)
- **access_token** and **refresh_token**
These tokens need to be obtained via an HTTP request with the code that comes during authorization on the HTTP service redirect_uri. The sequence of actions is as follows:
1. Create a link for authorization in the browser using the *GetAuthorizationLink* function
2. Add to the HTTP service module (GET) a call to the *HandleIncomingRequestAfterAuthorization* function, passing the HTTP service request as a parameter.
3. Authorize in the browser using the link from step 1
3. Save the access_token and refresh_token obtained from the *HandleIncomingRequestAfterAuthorization* function in step 2 into constants or another storage
```bsl title="Obtaining"
Function Twitterget(Request)
Code = Request.RequestParameters["code"];
TokenResponse = OPI_Twitter.GetToken(Code, Parameters);
Constants.TwitterRefresh.Set(ResponseToken["refresh_token"]);
Constants.TwitterToken.Set(ResponseToken["access_token"]);
Response = New HTTPServiceResponse(200);
Return Response;
EndFunction
```
```bsl title="Updating"
Procedure UpdateTokenEveryTwoHours(Val Parameters)
Response = OPI_Twitter.RefreshToken(Parameters);
Constants.TwitterToken.Set(Response["access_token"]);
Constants.TwitterRefresh.Set(Response["refresh_token"]);
EndProcedure
```
Hardcoding token data is not recommended because the access_token expires after only 2 hours. Upon expiration, the token needs to be refreshed using the RefreshToken function. During this update, both the access_token and refresh_token are refreshed. Therefore, when refreshing the expired access_token token next time, the refresh_token should be from the previous request.
![BF](../../static/img/Docs/Twitter/8.png)
- **oauth_token** and **oauth_token_secret**
![BF](../../static/img/Docs/Twitter/9.png)
- **oauth_consumer_key** and **oauth_consumer_secret**
![BF](../../static/img/Docs/Twitter/10.png)
After filling in the data fields, you can proceed to work with the API methods

View File

@ -1,94 +1,94 @@
---
id: VK
sidebar_class_name: VK
---
<img src={require('../../static/img/APIs/VK.png').default} width='64px' />
# VKontakte
This section is dedicated to the library for working with VK API. It is geared towards working with communities and performing actions on their behalf. On this page, all the steps necessary to start working are described
## Getting started
To begin, you need to obtain certain parameters for the VK API.
<br/><br/>
The list of necessary data in the form of a structure is contained in the function *GetStandardParameters()*. You can specify parameter values directly within it or pass them as a structure when calling any other library methods as an optional parameter *Parameters* (the last one in all library methods). In the latter case, the standard parameters will be overwritten by the ones passed during the method call. Only the data with matching keys will be overwritten. If a parameter exists in the standard set but was not passed during the method call, it will retain its default value.
<br/><br/>
```bsl
_Parameters = New Structure;
_Parameters.Insert("v", "5.131");
_Parameters.Insert("from_group", "1");
_Parameters.Insert("group_id", "123456789");
_Parameters.Insert("owner_id", "-123456789");
_Parameters.Insert("app_id", "87654321");
_Parameters.Insert("access_token", "vk1.a.E-byuFeG1qcN7...");
```
Let's consider obtaining of each value:
**1. v**
The parameter `v` denotes the version of the VK API. Testing was conducted on version 5.131, and it is recommended to keep it as such
**2. from_group**
On behalf of the group. It should be set to 1
**3. group_id and owner_id**
Group ID. If you have a standard group URL, you can find the ID in the URL. Otherwise, it will be on the 'Manage' tab in the group, below the Address field. 'owner_id' is the same but with a '-' sign in front of it
![BF](../../static/img/Docs/VK/1.png)
**4. app_id**
app_id - Application ID. To create an application, you need to:
* Go to the https://id.vk.com/about/business/go, authorize and enter your personal or company information
![BF](../../static/img/Docs/VK/2.png)
* Enter the application name and select the **Web**
![BF](../../static/img/Docs/VK/3.png)
* Enter the domain name and the URL of the redirect handler. It's worth noting that this mechanism for creating VK applications is new. Until recently, VK applications were created differently, and having a redirect URL was unnecessary. At the moment, it's not entirely clear why it's needed for our server application - VK no longer distinguishes server applications as such. Theoretically, you can enter anything there - there is no need for receiving callback data to work with the library. However, this may change over time.
![BF](../../static/img/Docs/VK/4.png)
* Enter passport details or organization information, enable access to communities (in short, if you already had an application before, you're lucky, but if you don't have a Russian passport, you'll have to contact support)
![BF](../../static/img/Docs/VK/8.png)
* Get app_id at the application page
![BF](../../static/img/Docs/VK/5.png)
**5. access_token**
You can obtain a link for acquiring the access token using the function *CreateTokenRetrievalLink* or manually concatenate it
https://oauth.vk.com/authorize?client_id= + *app_id* + &scope=offline,wall,groups,photos,stats,stories,ads&v=5.131&response_type=token&redirect_uri=https://api.vk.com/blank.html
* You need to follow this link in your browser
* Authorize through VK and confirm access
* Retrieve the token from the URL parameter in the address bar
![BF](../../static/img/Docs/VK/6.png)
**(Additionally) communitytoken**
Some methods, such as those for working with community chat bots, accept the parameter 'communitytoken' instead of 'access_token'. To obtain it, you need to:
* Go to the 'Manage' section in the VK group
* Find the 'API usage' tab
* Click on 'Create key' and retrieve it
![BF](../../static/img/Docs/VK/7.png)
You don't need to obtain the 'communitytoken' if you're not using such methods at the moment
---
id: VK
sidebar_class_name: VK
---
<img src={require('../../static/img/APIs/VK.png').default} width='64px' />
# VKontakte
This section is dedicated to the library for working with VK API. It is geared towards working with communities and performing actions on their behalf. On this page, all the steps necessary to start working are described
## Getting started
To begin, you need to obtain certain parameters for the VK API.
<br/><br/>
The list of necessary data in the form of a structure is contained in the function *GetStandardParameters()*. You can specify parameter values directly within it or pass them as a structure when calling any other library methods as an optional parameter *Parameters* (the last one in all library methods). In the latter case, the standard parameters will be overwritten by the ones passed during the method call. Only the data with matching keys will be overwritten. If a parameter exists in the standard set but was not passed during the method call, it will retain its default value.
<br/><br/>
```bsl
_Parameters = New Structure;
_Parameters.Insert("v", "5.131");
_Parameters.Insert("from_group", "1");
_Parameters.Insert("group_id", "123456789");
_Parameters.Insert("owner_id", "-123456789");
_Parameters.Insert("app_id", "87654321");
_Parameters.Insert("access_token", "vk1.a.E-byuFeG1qcN7...");
```
Let's consider obtaining of each value:
**1. v**
The parameter `v` denotes the version of the VK API. Testing was conducted on version 5.131, and it is recommended to keep it as such
**2. from_group**
On behalf of the group. It should be set to 1
**3. group_id and owner_id**
Group ID. If you have a standard group URL, you can find the ID in the URL. Otherwise, it will be on the 'Manage' tab in the group, below the Address field. 'owner_id' is the same but with a '-' sign in front of it
![BF](../../static/img/Docs/VK/1.png)
**4. app_id**
app_id - Application ID. To create an application, you need to:
* Go to the https://id.vk.com/about/business/go, authorize and enter your personal or company information
![BF](../../static/img/Docs/VK/2.png)
* Enter the application name and select the **Web**
![BF](../../static/img/Docs/VK/3.png)
* Enter the domain name and the URL of the redirect handler. It's worth noting that this mechanism for creating VK applications is new. Until recently, VK applications were created differently, and having a redirect URL was unnecessary. At the moment, it's not entirely clear why it's needed for our server application - VK no longer distinguishes server applications as such. Theoretically, you can enter anything there - there is no need for receiving callback data to work with the library. However, this may change over time.
![BF](../../static/img/Docs/VK/4.png)
* Enter passport details or organization information, enable access to communities (in short, if you already had an application before, you're lucky, but if you don't have a Russian passport, you'll have to contact support)
![BF](../../static/img/Docs/VK/8.png)
* Get app_id at the application page
![BF](../../static/img/Docs/VK/5.png)
**5. access_token**
You can obtain a link for acquiring the access token using the function *CreateTokenRetrievalLink* or manually concatenate it
https://oauth.vk.com/authorize?client_id= + *app_id* + &scope=offline,wall,groups,photos,stats,stories,ads&v=5.131&response_type=token&redirect_uri=https://api.vk.com/blank.html
* You need to follow this link in your browser
* Authorize through VK and confirm access
* Retrieve the token from the URL parameter in the address bar
![BF](../../static/img/Docs/VK/6.png)
**(Additionally) communitytoken**
Some methods, such as those for working with community chat bots, accept the parameter 'communitytoken' instead of 'access_token'. To obtain it, you need to:
* Go to the 'Manage' section in the VK group
* Find the 'API usage' tab
* Click on 'Create key' and retrieve it
![BF](../../static/img/Docs/VK/7.png)
You don't need to obtain the 'communitytoken' if you're not using such methods at the moment

View File

@ -1,59 +1,59 @@
---
id: Viber
sidebar_class_name: Viber
---
<img src={require('../../static/img/APIs/Viber.png').default} width='64px' />
# Viber
This section is dedicated to the library for working with Viber API. On this page, all the steps necessary to start working are described
:::warning
Starting from February 5, 2024, this method of creating bots is no longer valid: Rakuten has canceled the ability to create bots for free, and now working with the API requires verification under a commercial model. More details [here](https://help.viber.com/hc/en-us/articles/15247629658525-Bot-commercial-model)
:::
## Getting started
For Viber, there are two REST APIs: one for working with channels and the other for chatbots. In both cases, the main parameters are **Token** and **UserID**
- If you need to manage a channel:
1. Open the Viber app and create a new channel
![BF](../../static/img/Docs/Viber/1.png)
2. After creation, go to the channel settings -> For developers, and copy the **Token**
![BF](../../static/img/Docs/Viber/2.png)
3. Set webhook (see Set webhook)
4. **UserID** - your ID (channel administrator). See Get Channel Information for details
<br/>
- If you need a chatbot:
1. Go to the link [https://partners.viber.com/account/create-bot-account](https://partners.viber.com/account/create-bot-account) and authorize yourself with your phone number linked to Viber
![BF](../../static/img/Docs/Viber/3.png)
2. Select the option to create a new bot
![BF](../../static/img/Docs/Viber/4.png)
3. In the bot creation menu, fill in all the required fields
![BF](../../static/img/Docs/Viber/5.png)
4. Copy the **Token**
![BF](../../static/img/Docs/Viber/6.png)
4. To find your new bot, you can scan the QR code on the creation page or in the settings (chat bots section) within the Viber app.
![BF](../../static/img/Docs/Viber/7.png)
5. You cannot start a conversation with the bot right now. First, you need to set up a webhook. See Set Webhook
6. After launch, the **User ID** will be the ID of the specific person engaging with the bot. You can obtain it from processing incoming messages via Webhook
**Important**: The ID of the same user in chat and channel is different. You cannot use the ID obtained from a message to the bot to invoke channel management methods and vice versa
---
id: Viber
sidebar_class_name: Viber
---
<img src={require('../../static/img/APIs/Viber.png').default} width='64px' />
# Viber
This section is dedicated to the library for working with Viber API. On this page, all the steps necessary to start working are described
:::warning
Starting from February 5, 2024, this method of creating bots is no longer valid: Rakuten has canceled the ability to create bots for free, and now working with the API requires verification under a commercial model. More details [here](https://help.viber.com/hc/en-us/articles/15247629658525-Bot-commercial-model)
:::
## Getting started
For Viber, there are two REST APIs: one for working with channels and the other for chatbots. In both cases, the main parameters are **Token** and **UserID**
- If you need to manage a channel:
1. Open the Viber app and create a new channel
![BF](../../static/img/Docs/Viber/1.png)
2. After creation, go to the channel settings -> For developers, and copy the **Token**
![BF](../../static/img/Docs/Viber/2.png)
3. Set webhook (see Set webhook)
4. **UserID** - your ID (channel administrator). See Get Channel Information for details
<br/>
- If you need a chatbot:
1. Go to the link [https://partners.viber.com/account/create-bot-account](https://partners.viber.com/account/create-bot-account) and authorize yourself with your phone number linked to Viber
![BF](../../static/img/Docs/Viber/3.png)
2. Select the option to create a new bot
![BF](../../static/img/Docs/Viber/4.png)
3. In the bot creation menu, fill in all the required fields
![BF](../../static/img/Docs/Viber/5.png)
4. Copy the **Token**
![BF](../../static/img/Docs/Viber/6.png)
4. To find your new bot, you can scan the QR code on the creation page or in the settings (chat bots section) within the Viber app.
![BF](../../static/img/Docs/Viber/7.png)
5. You cannot start a conversation with the bot right now. First, you need to set up a webhook. See Set Webhook
6. After launch, the **User ID** will be the ID of the specific person engaging with the bot. You can obtain it from processing incoming messages via Webhook
**Important**: The ID of the same user in chat and channel is different. You cannot use the ID obtained from a message to the bot to invoke channel management methods and vice versa

View File

@ -1,62 +1,62 @@
---
id: YandexDisk
sidebar_class_name: YandexDisk
---
<img src={require('../../static/img/APIs/YandexDisk.png').default} width='64px' />
# Yandex Disk
This section is dedicated to the library for working with Yandex Disk API. On this page, all the steps necessary to start working are described
## Getting started
To start working, you need to obtain an access token for the disk:
1. Go to [app creation page](https://oauth.yandex.ru/client/new/)
![BF](../../static/img/Docs/YandexDisk/1.png)
2. Enter the service name, select *Web services* as the platform. You can specify any *Redirect URI* or select the Insert debugging URL option - it will not be needed for working with the library.
![BF](../../static/img/Docs/YandexDisk/3.png)
3. In the **Data Access** field, add permissions as shown in the screenshot below, then click **Create Application**
![BF](../../static/img/Docs/YandexDisk/2.png)
4. Save **ClientID** and **ClientSecret** from the application page
![BF](../../static/img/Docs/YandexDisk/4.png)
5. Call the function *OPI_YandexID.GetConfirmationCode()*, passing ClientID as a parameter. It will return a response from the Yandex server, which will contain the fields:
- **user_code** - you will need to enter in the browser
- **device_code** - you will need to pass to another function
- **verification_url** - the URL that needs to be opened in the browser
<br/>
```json title="The result of the function GetConfirmationCode(), if convert it to JSON"
{
"verification_url": "https://ya.ru/device",
"user_code": "gjehyruw",
"interval": 5,
"expires_in": 300,
"device_code": "12207cafec1b40ad8d0052af3faf0d12"
}
```
6. Open the URL from **verification_url** in the browser. Most likely, it will be https://ya.ru/device. In the field that appears, enter the **user_code** from step 5
![BF](../../static/img/Docs/YandexDisk/5.png)
7. After entering the code in step 6, call the function *OPI_YandexID.ConvertCodeToToken()*, passing **ClientID** and **ClientSecret** from step 4, as well as **device_code** from step 5. Save the obtained **access_token** and **refresh_token**
```json title="The result of the function ConvertCodeToToken(), if convert it to JSON"
{
"token_type": "bearer",
"refresh_token": "1:Tj6nD2vgE2L8jwSm:YgWjQXPv6_y3e07GW70ig2AOyEXoRVsKKpApGHq2EOg7pfx0MKrXiCrfLBFtzgQawdawdwadad3Sasa9z2H0vSeZKNmZmA",
"expires_in": 31535956,
"access_token": "y0_AgAAAABWxxdkAAs0QgAAAAD59cawdawdwadadVKIiwGK__crw"
}
```
**access_token** is used in all other functions of the library, and with the help of **refresh_token**, it can be refreshed when its lifespan is nearing the end (using the function *RefreshToken()*)
---
id: YandexDisk
sidebar_class_name: YandexDisk
---
<img src={require('../../static/img/APIs/YandexDisk.png').default} width='64px' />
# Yandex Disk
This section is dedicated to the library for working with Yandex Disk API. On this page, all the steps necessary to start working are described
## Getting started
To start working, you need to obtain an access token for the disk:
1. Go to [app creation page](https://oauth.yandex.ru/client/new/)
![BF](../../static/img/Docs/YandexDisk/1.png)
2. Enter the service name, select *Web services* as the platform. You can specify any *Redirect URI* or select the Insert debugging URL option - it will not be needed for working with the library.
![BF](../../static/img/Docs/YandexDisk/3.png)
3. In the **Data Access** field, add permissions as shown in the screenshot below, then click **Create Application**
![BF](../../static/img/Docs/YandexDisk/2.png)
4. Save **ClientID** and **ClientSecret** from the application page
![BF](../../static/img/Docs/YandexDisk/4.png)
5. Call the function *OPI_YandexID.GetConfirmationCode()*, passing ClientID as a parameter. It will return a response from the Yandex server, which will contain the fields:
- **user_code** - you will need to enter in the browser
- **device_code** - you will need to pass to another function
- **verification_url** - the URL that needs to be opened in the browser
<br/>
```json title="The result of the function GetConfirmationCode(), if convert it to JSON"
{
"verification_url": "https://ya.ru/device",
"user_code": "gjehyruw",
"interval": 5,
"expires_in": 300,
"device_code": "12207cafec1b40ad8d0052af3faf0d12"
}
```
6. Open the URL from **verification_url** in the browser. Most likely, it will be https://ya.ru/device. In the field that appears, enter the **user_code** from step 5
![BF](../../static/img/Docs/YandexDisk/5.png)
7. After entering the code in step 6, call the function *OPI_YandexID.ConvertCodeToToken()*, passing **ClientID** and **ClientSecret** from step 4, as well as **device_code** from step 5. Save the obtained **access_token** and **refresh_token**
```json title="The result of the function ConvertCodeToToken(), if convert it to JSON"
{
"token_type": "bearer",
"refresh_token": "1:Tj6nD2vgE2L8jwSm:YgWjQXPv6_y3e07GW70ig2AOyEXoRVsKKpApGHq2EOg7pfx0MKrXiCrfLBFtzgQawdawdwadad3Sasa9z2H0vSeZKNmZmA",
"expires_in": 31535956,
"access_token": "y0_AgAAAABWxxdkAAs0QgAAAAD59cawdawdwadadVKIiwGK__crw"
}
```
**access_token** is used in all other functions of the library, and with the help of **refresh_token**, it can be refreshed when its lifespan is nearing the end (using the function *RefreshToken()*)

View File

@ -12,7 +12,7 @@ sidebar_position: 7
|-|-|-|-|
| URL | --url | Строка | URL внешнего вебхука или адрес Bitrix24 при использовании токена |
| IDНовости | --postid | Строка, Число | ID новости |
| Видимость | --vision | Строка | Массив|Один получатель: UA все, SGn раб. группа, Un пользователь, DRn отдел, Gn группа |
| Видимость | --vision | Строка | Массив или 1 получатель: UA все, SGn р. группа, Un пользователь, DRn отдел, Gn группа |
| Токен | --token | Строка | Токен авторизации, если используется не вебхук |

View File

@ -12,7 +12,7 @@ sidebar_position: 1
|-|-|-|-|
| URL | --url | Строка | URL внешнего вебхука или адрес Bitrix24 при использовании токена |
| Текст | --text | Строка | Текст новости |
| Видимость | --vision | Строка | Массив|Один получатель: UA все, SGn раб. группа, Un пользователь, DRn отдел, Gn группа |
| Видимость | --vision | Строка | Массив или 1 получатель: UA все, SGn р. группа, Un пользователь, DRn отдел, Gn группа |
| Файлы | --files | Строка | Данные вложений, где ключ > имя файла, значение > путь к файлу иди двоичные данные |
| Заголовок | --title | Строка | Заголовок новости |
| Важное | --important | Булево | Помечает новость как важную |

View File

@ -13,7 +13,7 @@ sidebar_position: 2
| URL | --url | Строка | URL внешнего вебхука или адрес Bitrix24 при использовании токена |
| IDНовости | --postid | Строка, Число | ID новости |
| Текст | --text | Строка | Текст новости |
| Видимость | --vision | Строка | Массив|Один получатель: UA все, SGn раб. группа, Un пользователь, DRn отдел, Gn группа |
| Видимость | --vision | Строка | Массив или 1 получатель: UA все, SGn р. группа, Un пользователь, DRn отдел, Gn группа |
| Файлы | --files | Строка | Данные вложений, где ключ > имя файла, значение > путь к файлу иди двоичные данные |
| Заголовок | --title | Строка | Заголовок новости |
| Токен | --token | Строка | Токен авторизации, если используется не вебхук |