question

Dalin Son avatar image
Dalin Son asked

Photon chat webhooks not firing

Hi,

I'm having trouble with 2 of my webhooks. I was able to make the PathChannelCreate, PathChannelUnsubscribe and PathPublishMessage work but wasn't able to make the PathChannelSubscribe and PathChannelDestroy work.

Is there any specific settings i forgot to make those 2 works or are they not supported yet?

photonwebhooks
6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dalin Son avatar image Dalin Son commented ·

Turns out PathChannelSubscribe is called. I didn't realize that it wasn't called when the PathChannelCreate is being called. Still doesn't get my PathChannelDestroy though.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Dalin Son commented ·

May I ask what's the title ID? As far as I know, PathChannelDestroy only occurs when a private channels get closed. Can you provide any reproduction steps?

0 Likes 0 ·
Hamza Lazaar avatar image Hamza Lazaar Seth Du ♦ commented ·

@SethDu

PathChannelCreate, PathChannelDestroy, PathChannelSubscribe and ChannelUnsubscribeare are called only for PUBLIC chat channels.

Private channels have one single webhook: PathPublishMessage.

1 Like 1 ·
Show more comments
Hamza Lazaar avatar image
Hamza Lazaar answered

I just checked the logs for @Dalin Son's Photon AppId, PathChannelDestroy was fired at least twice and PlayFab returned {"Message":"User not found","ResultCode":2}

PlayFab does some validation and checks for webhooks arguments.
The check here is for the UserId, it needs to be a valid PlayFabId for the corresponding PlayFab Title.

I think the exception for this is the Photon Realtime WebHooks' PathClose, the default handler/path name in PlayFab for that webhook is "RoomClosed". Maybe as a workaround, that path/handler name should be used for Photon Chat WebHooks' PathChannelDestroy.

For the long explanation:

Photon-PlayFab integration does not officially support Photon Chat WebHooks but you can use what was originally meant for Photon Realtime WebHooks.

The integration includes 3 features:

  • A PlayFab Custom Authentication provider for Photon
  • PlayFab CloudScript endpoints for Photon Realtime WebHooks
  • PlayFab CloudScript endpoints for Photon Realtime WebRPCs

The integration expects a single PlayFab Title to be bound to a single Photon App (one-to-one).
The Photon application is expected to be of type Realtime or equivalent (e.g. PUN) but not Chat.

So if you configured your PlayFab Title with a Photon Chat application, then you cannot use it with a Photon Realtime application.
Also, since we use the same common request and response arguments in Photon Chat WebHooks and Photon Realtime WebHooks, the Photon Chat WebHooks will be accepted by PlayFab since they have the expected pattern or format. The exception to this rule is for PathClose and PathChannelDestroy where there is no UserId argument which PlayFab uses to validate the request.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dalin Son avatar image Dalin Son commented ·

Sorry for the late response, yes, renaming my handler to RoomClosed actually worked. Thank you very much!

0 Likes 0 ·
hirensameja avatar image
hirensameja answered

Hi, @Hamza Lazaar can you help me with my webhook? all the webhooks are being triggered except ChannelDestroy i don't know what's causing the issue. Appreciate the help

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hamza Lazaar avatar image Hamza Lazaar commented ·
1 Like 1 ·
hirensameja avatar image hirensameja Hamza Lazaar commented ·
@Hamza Lazaar but we want to save public chat. Will the "roomClosed" provide the chat history ? Or is there any other practice we can do to save public chat? Appreciate the help
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.