A
A
Alexander Popov2018-02-15 21:00:00
PHP
Alexander Popov, 2018-02-15 21:00:00

Chatbot for Bitrix24. How to download message attachments (photo, audio, etc.)?

I am developing a bot for Bitrix24 (external (server) application). The task is to save message attachments (attached files). In $_REQUEST I get the following in the [FILES] field:
[urlPreview] => Array
(
[default] => /bitrix/components/bitrix/im.messenger/show.file.php?fileId=129&preview=Y&fileName=rFlrdgU4t0o.jpg
[ desktop] => /desktop_app/show.file.php?fileId=129&preview=Y&fileName=rFlrdgU4t0o.jpg
[mobile] => /mobile/ajax.php?mobile_action=im_files&fileType=show&fileId=129&preview=Y&fileName=rFlrdgU4t0o.jpg
)
[urlShow] => Array
(
[default] => /bitrix/components/bitrix/im.messenger/show.file.php?fileId=129&fileName=rFlrdgU4t0o.jpg
[desktop] => /desktop_app/show.file.php? fileId=129&fileName=rFlrdgU4t0o.jpg
[mobile] => /mobile/ajax.php?mobile_action=im_files&fileType=show&fileId=129&fileName=rFlrdgU4t0o.jpg
)
[urlDownload] => Array
(
[default] => /bitrix/components/bitrix/im.messenger/download.file.php?fileId=129
[desktop] => /desktop_app/download.file.php?fileId=129
[mobile] => /mobile/ ajax.php?mobile_action=im_files&fileType=download&fileId=129&fileName=rFlrdgU4t0o.jpg
)
Q: How do I download/get files?
I tried the link my.bitrix24.ru/bitrix/components/bitrix/im.messeng... - writes "Insufficient rights to access the file."
I tried to log in via curl - the same
Who will advise what? Thank you in advance
PS in general Open lines of Bitrix24 seemed a little buggy to me. Am I wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2018-02-15
@unilog

Well... try asking the Bot for Disk rights and use the dev.1c-bitrix.ru/rest_help/disk/file/disk_file_get.php
method to Download it.
In fact: in [urlDownload][default] in the fileId link, this is the ID of the file on disk and it can be obtained.
But it's more of a hack than an off. possibility.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question