Legacy Dev Forum Posts

 View Only

Sign Up

Is there a golang example of subscribing to the Notifications API?

  • 1.  Is there a golang example of subscribing to the Notifications API?

    Posted 06-05-2025 18:20

    draeder | 2021-09-08 16:33:59 UTC | #1

    I have written an entire application in node.js / javascript that I am working on porting over to golang. I have REST API calls to the Platform API working fine, but I'm struggling a bit to work with the Notifications API using the platforemclientv2 package.

    Can anyone point me to an example for golang?

    Thanks!


    anon11147534 | 2021-09-08 16:51:13 UTC | #2

    Hi,

    We haven't yet added support for notifications in the Golang SDK. The best example at the moment would be taking a look at how the CLI subscribes to notifications. listenchannel.go has the functionality required for subscribing to a channel and printing the messages to STDOUT when provided with a channelId.

    Installation information for the CLI can be found on the developer centre.

    To create a channel and listen to it using the CLI, firstly run

    gc notifications channels create

    Fetch the id from the response and use

    gc notifications channels listen [CHANNEL_ID]

    to subscribe to the websocket.


    draeder | 2021-09-08 16:51:35 UTC | #3

    Thank you - this should get me started!


    John_Carnell | 2021-09-08 17:12:38 UTC | #4

    Hi Dan,

    While we don't have anything immediately available, I am going to talk to one of our team members and see if we can throw some Golang examples. Thanks and we can go from there. Also, we are getting ready to post a devdrop walking through the API, but using Python. Keep your eyes out for that

    Thanks, John Carnell


    draeder | 2021-09-28 17:48:53 UTC | #5

    Any news on a Notifications API example for Golang?

    Thanks, Dan


    draeder | 2021-09-30 23:52:35 UTC | #6

    I managed to get my code connected to the Notifications API in Golang. I'll post it here for anyone else who needs it after I clean it up a little bit and get it subscribed to a topic. Stay tuned...


    system | 2021-10-31 23:53:08 UTC | #7

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


    This post was migrated from the old Developer Forum.

    ref: 11955