2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 9
2025-05-05 11:15:20 +03:00
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
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Telegram]
2024-10-15 10:16:04 +03:00
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# 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`
2024-10-15 15:15:47 +03:00
| 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 |
2025-01-16 21:22:31 +03:00
| Keyboard | --keyboard | String, Structure Of KeyAndValue | ✖ | Keyboard. See FormKeyboardFromButtonArray |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
<br/>
:::tip
2024-11-21 13:27:18 +03:00
Method at API documentation: [sendContact](https://core.telegram.org/bots/api#sendcontact)
2024-10-15 10:16:04 +03:00
:::
<br/>
2024-12-16 19:38:57 +03:00
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2025-06-29 14:35:33 +03:00
Token = "6129457865:AAFyzNYOAFbu...";
ChatID = "461699897";
ChannelID = "@testsichee";
Name = "Петр";
LastName = "Петров";
Phone = "88005553535";
2024-10-15 10:16:04 +03:00
2025-03-06 20:58:59 +03:00
Result = OPI_Telegram.SendContact(Token, ChatID, Name, LastName, Phone);
2024-10-15 10:16:04 +03:00
Result = OPI_Telegram.SendContact(Token, ChannelID, Name, LastName, Phone);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint telegram SendContact \
2024-10-22 08:59:24 +03:00
--token "***" \
2025-07-04 23:24:42 +03:00
--chat "461699897" \
2024-10-22 08:59:24 +03:00
--surname "Петров" \
--phone "88005553535" \
--name "Петр"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint telegram SendContact ^
2024-10-22 08:59:24 +03:00
--token "***" ^
2025-07-04 23:24:42 +03:00
--chat "461699897" ^
2024-10-22 08:59:24 +03:00
--surname "Петров" ^
--phone "88005553535" ^
--name "Петр"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"ok": true,
"result": {
"message_id": 8313,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
"last_name": "Titowets",
"username": "JKIee",
"type": "private"
},
"date": 1728453435,
"contact": {
"phone_number": "88005553535",
"first_name": "Петр",
"last_name": "Петров"
}
}
}
```