Package com.bytedesk.social.messenger
Class MessengerAdDirectService
java.lang.Object
com.bytedesk.social.messenger.MessengerAdDirectService
Messenger广告欢迎消息流API服务
https://developers.facebook.com/docs/messenger-platform/ads/ads-welcome-message-flows
实现Facebook Messenger广告直接API的欢迎消息流功能
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MessengerConfig
private final com.fasterxml.jackson.databind.ObjectMapper
private final org.springframework.web.client.RestTemplate
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateWelcomeMessageFlow
(String pageId, String name, String welcomeMessageFlow, List<String> eligiblePlatforms) 创建新的欢迎消息流boolean
deleteWelcomeMessageFlow
(String pageId, String flowId) 删除欢迎消息流为广告创意设置欢迎消息流IDgetWelcomeMessageFlow
(String pageId, String flowId) 获取特定欢迎消息流getWelcomeMessageFlows
(String pageId) 获取所有欢迎消息流列表getWelcomeMessageFlows
(String pageId, int limit) 获取欢迎消息流列表(带分页)boolean
isFlowUsedInAd
(String pageId, String flowId) 检查欢迎消息流是否正在广告中使用boolean
updateWelcomeMessageFlow
(String pageId, String flowId, String name, String welcomeMessageFlow, List<String> eligiblePlatforms) 更新现有的欢迎消息流
-
Field Details
-
messengerConfig
-
restTemplate
private final org.springframework.web.client.RestTemplate restTemplate -
objectMapper
private final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
MessengerAdDirectService
public MessengerAdDirectService()
-
-
Method Details
-
createWelcomeMessageFlow
public String createWelcomeMessageFlow(String pageId, String name, String welcomeMessageFlow, List<String> eligiblePlatforms) 创建新的欢迎消息流- Parameters:
pageId
- Facebook页面IDname
- 流名称welcomeMessageFlow
- 欢迎消息流JSONeligiblePlatforms
- 支持的平台列表 ["messenger", "instagram"]- Returns:
- 创建的流ID
-
updateWelcomeMessageFlow
public boolean updateWelcomeMessageFlow(String pageId, String flowId, String name, String welcomeMessageFlow, List<String> eligiblePlatforms) 更新现有的欢迎消息流- Parameters:
pageId
- Facebook页面IDflowId
- 要更新的流IDname
- 流名称(可选)welcomeMessageFlow
- 欢迎消息流JSON(可选)eligiblePlatforms
- 支持的平台列表(可选)["messenger", "instagram"]- Returns:
- 是否更新成功
-
getWelcomeMessageFlows
获取所有欢迎消息流列表- Parameters:
pageId
- Facebook页面ID- Returns:
- 欢迎消息流列表
-
getWelcomeMessageFlow
获取特定欢迎消息流- Parameters:
pageId
- Facebook页面IDflowId
- 要获取的流ID- Returns:
- 欢迎消息流信息
-
getWelcomeMessageFlows
获取欢迎消息流列表(带分页)- Parameters:
pageId
- Facebook页面IDlimit
- 限制返回数量- Returns:
- 欢迎消息流列表
-
deleteWelcomeMessageFlow
删除欢迎消息流- Parameters:
pageId
- Facebook页面IDflowId
- 要删除的流ID- Returns:
- 是否删除成功
-
isFlowUsedInAd
检查欢迎消息流是否正在广告中使用- Parameters:
pageId
- Facebook页面IDflowId
- 流ID- Returns:
- 是否正在广告中使用
-
generateAdCreativeWithWelcomeFlow
为广告创意设置欢迎消息流ID- Parameters:
flowId
- 欢迎消息流ID- Returns:
- 广告创意配置JSON字符串
-