You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用ActionType.SEND/ASKFOR时,如何获取GameRequestContent所需的objectId?

How to Get objectId for ActionType.SEND/ASKFOR with Pre-built Objects

Got it, let's clear up the confusion around getting the objectId you need when using ActionType.SEND or ActionType.ASKFOR in your game. Since you're restricted to pre-built objects (no custom ones allowed in newer versions), here's a straightforward breakdown:

1. Understand Pre-built Object IDs

Pre-built Open Graph objects (like game items, levels, achievements) have standardized identifiers you can retrieve via the Graph API or reference from official game development resources. These are exactly the objectId values you need to pass to setObjectId().

2. Retrieve Object IDs via Graph API

The most reliable way to get valid objectIds for your app is to query the Graph API directly:

  • Use the endpoint GET /me/objects/{object-type} where {object-type} is the pre-built object category you need (e.g., game.item, game.level, game.achievement).

  • This call will return a list of all pre-built objects available for your app. Each entry in the response includes an id field — that's your target objectId.

    Example request (replace {object-type} with your desired category):

    GET /me/objects/game.item?access_token=YOUR_APP_ACCESS_TOKEN
    

3. Use Known Global IDs for Common Objects

For widely used pre-built objects (like generic game props), Facebook provides fixed global IDs that you can directly reference. These are often listed in Facebook's Game Developer documentation under sections about pre-built Open Graph objects.

The tool link you mentioned asks for an ActionType ID, but that's for custom action types — which you don't need here. Since you're using the pre-built SEND/ASKFOR actions, you don't need an ActionType ID at all. Focus entirely on retrieving the pre-built object's ID as outlined above.

Important Notes

  • Make sure your app has the required permissions (like game-specific publish permissions) to access these objects via the API.
  • Never use custom-created object IDs — newer API versions only allow pre-built objects for these actions, so custom IDs will throw errors.

内容的提问来源于stack exchange,提问作者Umer Khaldi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 05:25:38