# Is there a way to get the party id and presences for a PartyCreate runtime hook?

**URL:** <https://forum.heroiclabs.com/t/is-there-a-way-to-get-the-party-id-and-presences-for-a-partycreate-runtime-hook/4818>\
**Category:** Runtime Framework\
**Created:** [December 31, 2023, 1:33am UTC](https://forum.heroiclabs.com/t/is-there-a-way-to-get-the-party-id-and-presences-for-a-partycreate-runtime-hook/4818 "2023-12-31T01:33:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonbonazza](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/jonbonazza/32/141_2.png) [@jonbonazza](https://forum.heroiclabs.com/u/jonbonazza)\
**Post date:** [December 31, 2023, 1:33am UTC](https://forum.heroiclabs.com/t/is-there-a-way-to-get-the-party-id-and-presences-for-a-partycreate-runtime-hook/4818/1 "2023-12-31T01:33:53Z")

</div>

I’m trying to track some stuff on the server side whenever a client creates a party. I have registerd a hook with the nakama Go runtime via `initializer.RegisterAfterRt` using the `PartyCreate` id, however the `Envelope_PartyCreate` proto only includes whether the party is open and the max size. Is there a way to get the ID of the party that was created as well as the current presences?

Another option I’ve considered is trying to use the `PartyJoin` id instead, but:  
a) I’m not sure whther a join hook will be called for the person who creates a new party  
and  
b) The `Envelope_PartyJoin` proto only includes the party id, so I’m still not sure how I’d go about getting the presences. 🤔

---

<div class="post-metadata">

**Author:** ![surajTLabs](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/surajtlabs/32/1497_2.png) [@surajTLabs](https://forum.heroiclabs.com/u/surajTLabs)\
**Post date:** [January 9, 2024, 12:18pm UTC](https://forum.heroiclabs.com/t/is-there-a-way-to-get-the-party-id-and-presences-for-a-partycreate-runtime-hook/4818/2 "2024-01-09T12:18:40Z")

</div>

I was also facing same issue and here is the solution to access party id in GO,

```auto
func AfterPartyCreate(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, out *rtapi.Envelope, in *rtapi.Envelope) error {
	logger.Info("AfterPartyCreate Hook called")

	envelope, ok := out.Message.(*rtapi.Envelope_Party)
	if !ok {
		logger.Error("error getting envelope as AfterPartyCreate envelope")
		return runtime.NewError("error getting envelope as AfterPartyCreate envelope", 13)
	}

	logger.Info(envelope.Party.PartyId)

	return nil
}

```

---

<div class="post-metadata">

**Author:** ![jonbonazza](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/jonbonazza/32/141_2.png) [@jonbonazza](https://forum.heroiclabs.com/u/jonbonazza)\
**Post date:** [January 25, 2024, 6:34am UTC](https://forum.heroiclabs.com/t/is-there-a-way-to-get-the-party-id-and-presences-for-a-partycreate-runtime-hook/4818/3 "2024-01-25T06:34:49Z")

</div>

Thanks @surajTLabs. I didn’t think the `out` paramter was fully populated during this callback. I should have checked that. I was attempting to use the `in` parameter instead. This makes sense though.

My only other qualm, then, is that there doesn’t seem to be a way to get party data for a given party id via the nakama server api.
