Context
The JS SDK methods BX24.im.phoneTo and BX24.im.callTo are now marked deprecated, with the recommended replacements:
BX24.im.phoneTo(number) → Messenger.startPhoneCall(number[, params])
BX24.im.callTo(userId, isVideo) → Messenger.startVideoCall(dialogId[, params])
The documented call form for the replacements is BX.Messenger.Public.startPhoneCall('8800…') — i.e. a top portal-window global (BX.Messenger.Public).
Question / problem
App code runs inside a placement iframe, where there is no top-level BX / Messenger global, and the parent window is cross-origin. So the recommended replacements are not directly callable from where app developers actually run. The deprecated BX24.im.phoneTo / im.callTo still work precisely because they postMessage a command to the parent window, where the real handler runs.
How are app developers expected to migrate?
- Is there a supported, iframe-accessible entry point for startPhoneCall / startVideoCall (an SDK method or a placement command) that we missed? If so, please document it on the messenger-start-phone-call / messenger-start-video-call pages with an in-app example (the current example starts with bare BX, which does not exist in an embed).
- If there is none, please add an SDK / placement wrapper that forwards to BX.Messenger.Public.startPhoneCall / startVideoCall from the iframe — exactly what BX24.im.phoneTo already does — so the recommended methods become reachable from apps.
- Until such an entry point exists, please clarify the recommended path for apps — i.e. whether BX24.im.phoneTo / im.callTo should keep being used from placements despite the deprecation banner.
Reproduction (cloud, inside an installed app placement iframe) — see attached findings.
Documentation to update
A. b24jssdk (this SDK)
| Page / file |
Currently |
Change to |
packages/jssdk/src/frame/parent.ts — JSDoc of imPhoneTo, imCallTo |
@link points only to the deprecated bx24-im-phone-to / bx24-im-call-to pages |
Add a one-line note that these are the in-frame bridge (post a command to the parent window); the Messenger.* replacements are top-window and not callable from a placement. (patch attached) |
docs/content/docs/2.working-with-the-rest-api/31.frame-parent.md — sections ### imPhoneTo, ### imCallTo, ### imOpenMessenger |
signatures only |
Add the same layer note + a short "use from a placement" example; state that Messenger.startPhoneCall/startVideoCall are top-window, not a from-iframe drop-in replacement |
packages/jssdk/README-AI.md (im* examples, ~lines 271–272) |
imCallTo / imOpenMessenger one-liners |
Note they are the in-frame path; no top-window Messenger.* from apps |
B. Bitrix apidocs (bitrix-tools/b24-rest-docs)
| Page |
Currently |
Change to |
sdk/bx24-js-sdk/additional-functions/outdated/bx24-im-phone-to.html (xxx1) |
DEPRECATED → "use Messenger.startPhoneCall" |
Clarify migration: Messenger.startPhoneCall is a top-window method; from an app placement iframe use BX24.im.phoneTo (or the new iframe entry once it exists). Don't present an unreachable method as the replacement |
sdk/bx24-js-sdk/additional-functions/outdated/bx24-im-call-to.html (yyy1) |
DEPRECATED → "use Messenger.startVideoCall" |
Same clarification for im.callTo → startVideoCall |
sdk/bx24-js-sdk/additional-functions/messenger-start-phone-call.html (xxx2) |
Example BX.Messenger.Public.startPhoneCall('8800…'); no context note |
Label as top portal-window (BX.Messenger.Public), explicitly say "not directly callable from an app placement iframe"; fix the example that starts with bare BX for the app context; add the supported from-app path |
sdk/bx24-js-sdk/additional-functions/messenger-start-video-call.html (yyy2) |
Same shape |
Same top-window labeling + from-app path |
The exact wording of "the supported from-app path" depends on the answer to the main question: either (1) document the existing iframe entry point, or (2) add an SDK/placement wrapper for startPhoneCall / startVideoCall (as im.phoneTo already does), or (3) keep im.phoneTo / im.callTo non-deprecated for placements.
Context
The JS SDK methods
BX24.im.phoneToandBX24.im.callToare now marked deprecated, with the recommended replacements:BX24.im.phoneTo(number)→Messenger.startPhoneCall(number[, params])BX24.im.callTo(userId, isVideo)→Messenger.startVideoCall(dialogId[, params])The documented call form for the replacements is
BX.Messenger.Public.startPhoneCall('8800…')— i.e. a top portal-window global (BX.Messenger.Public).Question / problem
App code runs inside a placement iframe, where there is no top-level
BX/Messengerglobal, and the parent window is cross-origin. So the recommended replacements are not directly callable from where app developers actually run. The deprecatedBX24.im.phoneTo/im.callTostill work precisely because theypostMessagea command to the parent window, where the real handler runs.How are app developers expected to migrate?
Reproduction (cloud, inside an installed app placement iframe) — see attached findings.
Documentation to update
A.
b24jssdk(this SDK)packages/jssdk/src/frame/parent.ts— JSDoc ofimPhoneTo,imCallTo@linkpoints only to the deprecatedbx24-im-phone-to/bx24-im-call-topagesMessenger.*replacements are top-window and not callable from a placement. (patch attached)docs/content/docs/2.working-with-the-rest-api/31.frame-parent.md— sections### imPhoneTo,### imCallTo,### imOpenMessengerMessenger.startPhoneCall/startVideoCallare top-window, not a from-iframe drop-in replacementpackages/jssdk/README-AI.md(im* examples, ~lines 271–272)imCallTo/imOpenMessengerone-linersMessenger.*from appsB. Bitrix apidocs (
bitrix-tools/b24-rest-docs)sdk/bx24-js-sdk/additional-functions/outdated/bx24-im-phone-to.html(xxx1)Messenger.startPhoneCall"Messenger.startPhoneCallis a top-window method; from an app placement iframe useBX24.im.phoneTo(or the new iframe entry once it exists). Don't present an unreachable method as the replacementsdk/bx24-js-sdk/additional-functions/outdated/bx24-im-call-to.html(yyy1)Messenger.startVideoCall"im.callTo→startVideoCallsdk/bx24-js-sdk/additional-functions/messenger-start-phone-call.html(xxx2)BX.Messenger.Public.startPhoneCall('8800…'); no context noteBX.Messenger.Public), explicitly say "not directly callable from an app placement iframe"; fix the example that starts with bareBXfor the app context; add the supported from-app pathsdk/bx24-js-sdk/additional-functions/messenger-start-video-call.html(yyy2)The exact wording of "the supported from-app path" depends on the answer to the main question: either (1) document the existing iframe entry point, or (2) add an SDK/placement wrapper for
startPhoneCall/startVideoCall(asim.phoneToalready does), or (3) keepim.phoneTo/im.callTonon-deprecated for placements.