Phonebook API coming back with HTTP 400 (bad request)

I’m trying to implement the phonebook API into my game. Whenever I try to call someone it comes back with a HTTP 400 error.

Call Invoke Script:

local SocialService = game:GetService(“SocialService”)
local TeleportService = game:GetService(“TeleportService”)

SocialService.OnCallInviteInvoked = function()
local placeId = 14943690250
local accessCode = TeleportService:ReserveServer(placeId)

return {ReservedServerAccessCode = accessCode, PlaceId = placeId}
end

PhoneBook Prompt

local plr = game.Players.LocalPlayer
local TextButton = script.Parent

local ss = game:GetService(“SocialService”)

local function inviteFriend()
local success, result = pcall(
function()
return ss:CanSendCallInviteAsync(plr)
end
)

if result == true then
ss:PromptPhoneBook(plr, “”)
game.ReplicatedStorage.Invite:FireServer(plr)
end
end

TextButton.MouseButton1Click:Connect(inviteFriend)

Error (After attempting to make a call):
image

1 Like

Not a bug. Per the documentation, you must return a dictionary with PlaceId and ReservedServerAccessCode keys.

Your code instead should return

{ReservedServerAccessCode = accessCode, PlaceId = placeId}

I already tried that and it does. It is a bug

Even after the change
image

Resolved. This is how it’s meant to look.

local SocialService = game:GetService(“SocialService”)
local TeleportService = game:GetService(“TeleportService”)

SocialService.OnCallInviteInvoked:Connect(function()
return {ReservedServerAccessCode = TeleportService:ReserveServer(PLACEID), PlaceId = PLACEID}
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.