Skip to main content

Amazon SNS Notifications

The AFL Sports Data Platform provides data update notifications via the Amazon Simple Notification Service. SNS messages are published whenever match data is changed, particularly during live matches and provide an instruction to subscribers to refresh their data from the AFL API.

The AFL Platform sends out the following types of SNS message:

  • Match Status
  • Match Metric Update
  • Match Score
  • Reference Data

Setting up a Subscription

Please contact Champion Data Support to arrange a subscription for your organisation - please review below what information from yourselves is required to do so. Note that you will need to create a means of receiving SNS messages and an understanding of how Amazon SNS works is required.

info

Follow this link to Amazon's SNS documentation - What is Amazon SNS?

Information Required

To set up a SNS subscription, we require the following:

  • Your AWS Amazon Resource Name (ARN)
  • Your endpoint URL that will receive the SNS messages
  • The name of your organisation within either the ARN or the endpoint URL so we can identify that is yours
  • Whether these messages will be received by a production environment
note

We ask to know if the messages are used by a production environment so we can respond to support enquiries appropriately on match day. SNS queries regarding a non-production environment will be given a lower priority over production environments.

Multiple Subscriptions

We can support multiple SNS subscriptions on your behalf providing each subscription is uniquely identifiable. Please note the following considerations:

  • Multiple subscriptions means receiving multiple copies of the same message, which may result in making multiple API calls as a result. This may impact your daily API call rate
  • We reserve the right to limit the number of subscriptions beyond a reasonable limit, particularly if they are generating a large amount of support enquiries.

SNS Message Types

Match Status Message

This message is sent when a match's Status changes, such as when a match starts, ends, breaks for half time. This message should be taken as an instruction to refresh the match state (typically from the match endpoint) to reflect its current position.

A list of all possible values for the matchStatus attribute in a Match Status message can be found from the following match status metadata endpoint: /v1/metadata/matchstatus. Note that it is the code attribute from matchstatus endpoint response that is sent in the matchStatus.Type message attribute.

Here are some examples of Match Status messages:

Example Match Status Message - Q1 begins
{
"Records": [
{
"EventSource": "aws:sns",
"EventSubscriptionArn": "",
"EventVersion": "1.0",
"Sns": {
"Message": "{"MatchId":"233041024","Type":"Q1"}",
"MessageAttributes": {
"competitionId": {
"Type": "String",
"Value": "2021011376"
},
"matchStatus": {
"Type": "String",
"Value": "Q1"
},
"seasonId": {
"Type": "String",
"Value": "2021"
},
"leagueId": {
"Type": "String",
"Value": "1"
},
"levelId": {
"Type": "String",
"Value": "14"
},
"phaseId": {
"Type": "String",
"Value": "11376"
},
"type": {
"Type": "String",
"Value": "MATCH_STATUS"
},
"matchId": {
"Type": "String",
"Value": "233041024"
}
},
"MessageId": "",
"Signature": "",
"SignatureVersion": "1",
"SigningCertUrl": "",
"Subject": null,
"Timestamp": "2023-12-13T06:30:10.454Z",
"TopicArn": "",
"Type": "Notification",
"UnsubscribeUrl": ""
}
}
]
}
Example Match Status Message - Quarter Time
{
"MatchStatus": "QT"
}
Example Match Status Message - Full Time
{
"MatchStatus": "FT"
}
Example Match Status Message - Stat Capture has ended
{
"MatchStatus": "COMP"
}

Match Metric Update Message

This message lists the most recent metrics that have been updated, either during a live match, or as a result of refreshing the match data to apply new/revised metrics. This message should be taken as an instruction to refresh the set of match statistics from the AFL API.

Example Match Metric Update Message
{
"Records": [
{
"EventSource": "aws:sns",
"EventSubscriptionArn": "",
"EventVersion": "1.0",
"Sns": {
"Message": "{"MatchId":"232990753","Type":"METRIC","MetricsUpdated":["KICK","TACKLE"]}",
"MessageAttributes": {
"competitionId": {
"Type": "String",
"Value": "2021011375"
},
"matchStatus": {
"Type": "String",
"Value": "COMP"
},
"seasonId": {
"Type": "String",
"Value": "2021"
},
"leagueId": {
"Type": "String",
"Value": "2"
},
"levelId": {
"Type": "String",
"Value": "101"
},
"phaseId": {
"Type": "String",
"Value": "11375"
},
"metrics": {
"Type": "String",
"Value": "["KICK","TACKLE"]"
},
"type": {
"Type": "String",
"Value": "METRIC"
},
"matchId": {
"Type": "String",
"Value": "232990753"
}
},
"MessageId": "",
"Signature": "",
"SignatureVersion": "1",
"SigningCertUrl": "",
"Subject": null,
"Timestamp": "2023-12-13T07:08:35.764Z",
"TopicArn": "",
"Type": "Notification",
"UnsubscribeUrl": ""
}
}
]
}

Match Score Message

This message is sent when a team has scored during a match and should be taken as an instruction to refresh the match score from the AFL API.

Example Match Score Message
{
"Records": [
{
"EventSource": "aws:sns",
"EventSubscriptionArn": "",
"EventVersion": "1.0",
"Sns": {
"Message": "{"MatchId":"232990753","Type":"SCORE","MetricsUpdated":null}",
"MessageAttributes": {
"competitionId": {
"Type": "String",
"Value": "2021011375"
},
"matchStatus": {
"Type": "String",
"Value": "COMP"
},
"seasonId": {
"Type": "String",
"Value": "2021"
},
"leagueId": {
"Type": "String",
"Value": "2"
},
"levelId": {
"Type": "String",
"Value": "101"
},
"phaseId": {
"Type": "String",
"Value": "11375"
},
"type": {
"Type": "String",
"Value": "METRIC"
},
"matchId": {
"Type": "String",
"Value": "232990753"
}
},
"MessageId": "",
"Signature": "",
"SignatureVersion": "1",
"SigningCertUrl": "",
"Subject": null,
"Timestamp": "2023-12-13T07:08:35.764Z",
"TopicArn": "",
"Type": "Notification",
"UnsubscribeUrl": ""
}
}
]
}

Reference Data Message

This message is sent whenever 'reference data' is updated - see below for a list of what this covers. This message should be taken as an instruction to refresh the whole set of reference data, as this message does not specify which reference data elements have changed.

  • Leagues & Levels
  • Season Fixture
  • Season Ladder
  • Season Squads & Persons
  • Season Conferences
  • Venues
Example Reference Data Message
{
"Records": [
{
"EventSource": "aws:sns",
"EventSubscriptionArn": "",
"EventVersion": "1.0",
"Sns": {
"Message": "{"Type":"REF_DATA"}",
"MessageAttributes": {
"type": {
"Type": "String",
"Value": "REF_DATA"
}
},
"MessageId": "",
"Signature": "",
"SignatureVersion": "1",
"SigningCertUrl": "",
"Subject": null,
"Timestamp": "2023-12-13T20:01:25.068Z",
"TopicArn": "",
"Type": "Notification",
"UnsubscribeUrl": ""
}
}
]
}