Skip to content

How should apps call Messenger.startPhoneCall / startVideoCall from a placement iframe after BX24.im.phoneTo / im.callTo were deprecated? #331

Description

@IgorShevchik

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?

  1. 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).
  2. 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.
  3. 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.callTostartVideoCall
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcoreB24

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions