# Alerts for Game Sales

Hey fellow dev’s,

I’m creating this topic because I’ve really not seen this asked before, either because it’s not been considered, or because I’m the only one unaware of it… So basically, I’m wondering if there’s IRC notifications for when a user purchases a game using the button below a stream. When I bought the E3 Digital Ticket, that alerted in the official Twitch channel’s chat, but I’m unsure if every game, such as Ghost Recon Wildlands, triggers a message in chat for the viewer to enter a message with (like resubs).
I can see it’s available for PubSub under “Commerce Events”, but does it trigger in IRC? If it does, is there a sample message to show the parameters?
If there isn’t, it could be a useful thing to implement!

Thanks!

This is an IRC capture from an old event back when the feature first launched:

You want the PubSub commerce topic outlined here: https://dev.twitch.tv/docs/v5/guides/PubSub/

But yes, seems that there is a UserNotice attached to it (still) as well

Collected and JSON formated (sorry I don’t have the RAW IRC line)

{ badges: [ [ 'subscriber', '0' ], [ 'premium', '1' ] ],
color: '#A60808',
display_name: '<removed>',
emotes: true,
id: '<removed>',
mod: '0',
msg_id: 'purchase',
msg_param_asin: 'B06XP9TRLC',
msg_param_bits: '10',
msg_param_channelID: '<removed>',
msg_param_crateCount: '1',
msg_param_emoticons: '158655',
msg_param_imageURL: 'https://images-na.ssl-images-amazon.com/images/I/819PHGQ9LBL.jpg',
msg_param_title: 'Darkest\\sDungeon',
msg_param_userID: '<removed>',
room_id: '<removed>',
subscriber: '1',
system_msg: 'Purchased\\sDarkest\\sDungeon\\sin\\schannel.',
tmi_sent_ts: '1498394697011',
turbo: '0',
user_id: '<removed>',
user_type: true }


It would seem that the UserNotice provides some additional information over the pubsub topic, such as the Crate contents if a crate is opened, assuming the crate(s) was opened before the user runs the share dialog, so you also gotcha watch for a message here.

@george Thank you for the IRC capture message, this seems very handy. I assume if we wanted to get the price of this game, we’d simply search an API for the parameter msg-param-asin=B06XK192R7; ? I’ll look into writing something that works around this, it seems nice and simple.

@BarryCarlyon Thank you for posting the PubSub sample, and for letting me know about the UserNotice providing extra information. I never actually knew it could share the contents of the crate, that’s a pretty neat feature!

I’ll get to work writing something that listens for these events, and does something with them. Thanks again for the help guys!

The price of the item doesn’t take into account that tax exists. I did find this end point: https://api.twitch.tv/kraken/games/Darkest%20Dungeon/details for example that contains price data.

But since thats a standard Amazon ASIN B06XK192R7 I’m sure theres a Amazon MWS endpoint of use somewhere…

Generally the game being purchased SHOULD be the current game that is being played, and msg_param_title in the user notice example will match for the /details lookup

Thank you Barry for responding, and this quickly too! I’ll check out the Amazon API’s, I’d guarantee there’s an endpoint somewhere containing that data. Also, the API link you posted returns an Error 404, not sure if it’s been changed or something. I’ll let you know how it goes!

Use APIv5 you made a call over v3

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