You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-29 22:27:42 +02:00
104 lines
2.8 KiB
Plaintext
Vendored
104 lines
2.8 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 9
|
|
description: Send contact and other functions to work with Telegram in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
|
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Telegram]
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Send contact
|
|
Sends a contact with name and phone number
|
|
|
|
|
|
|
|
`Function SendContact(Val Token, Val ChatID, Val Name, Val LastName, Val Phone, Val Keyboard = "") Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| Token | --token | String | ✔ | Bot token |
|
|
| ChatID | --chat | String, Number | ✔ | Target chat ID or ChatID*TopicID |
|
|
| Name | --name | String | ✔ | Contact name |
|
|
| LastName | --surname | String | ✔ | Contact last name |
|
|
| Phone | --phone | String | ✔ | Contact phone number |
|
|
| Keyboard | --keyboard | String, Structure Of KeyAndValue | ✖ | Keyboard. See FormKeyboardFromButtonArray |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Method at API documentation: [sendContact](https://core.telegram.org/bots/api#sendcontact)
|
|
:::
|
|
<br/>
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
Token = "6129457865:AAFyzNYOAFbu...";
|
|
ChatID = "461699897";
|
|
ChannelID = "@testsichee";
|
|
Name = "Петр";
|
|
LastName = "Петров";
|
|
Phone = "88005553535";
|
|
|
|
Result = OPI_Telegram.SendContact(Token, ChatID, Name, LastName, Phone);
|
|
|
|
Result = OPI_Telegram.SendContact(Token, ChannelID, Name, LastName, Phone);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
oint telegram SendContact \
|
|
--token "***" \
|
|
--chat "@testsichee" \
|
|
--name "Петр" \
|
|
--surname "Петров" \
|
|
--phone "88005553535"
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
oint telegram SendContact ^
|
|
--token "***" ^
|
|
--chat "@testsichee" ^
|
|
--name "Петр" ^
|
|
--surname "Петров" ^
|
|
--phone "88005553535"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"ok": true,
|
|
"result": {
|
|
"message_id": 17198,
|
|
"from": {
|
|
"id": 6129457865,
|
|
"is_bot": true,
|
|
"first_name": "Бот Виталий",
|
|
"username": "sicheebot"
|
|
},
|
|
"chat": {
|
|
"id": 461699897,
|
|
"first_name": "Anton",
|
|
"last_name": "Titovets",
|
|
"username": "bayselonarrend",
|
|
"type": "private"
|
|
},
|
|
"date": 1760516520,
|
|
"contact": {
|
|
"phone_number": "88005553535",
|
|
"first_name": "Петр",
|
|
"last_name": "Петров"
|
|
}
|
|
}
|
|
}
|
|
```
|