Send Data to Your Atom Account

Once you’ve set up your first stream on ironSource.Atom, you are ready to start sending data to your data warehouse and enjoy the tools our dashboard offers! Follow this article to learn how to send data to ironSource.Atom.

Before You Start

Make sure you’ve set up your Atom Account with your Redshift cluster and have built your first data stream.

Send HTTP Requests to our API Endpoint

To send your data, simply send HTTP requests to our API endpoint.

Send a Single Event

To send a single event to your stream, the best way is to make a POST request to https://track.atom-data.io with a JSON payload structured like below example:

{
   "stream": "<Stream Name>",
   "data": "{\"name":\ "iron", \ "last_name\": \ "source\"}"
   "auth": "<SHA-256 checksum of the 'data' field using pre-shared key>"
}

Parameters:

  • table: The name of the stream you’re sending to. You can find a list of your existing streams using the streams screen in the console.
  • data: A JSON.stringified representation of the event you want to send
  • auth: If you’re sending this event to a secured stream, you must add this parameter, as explained in the next section.

Send an Event Using HTTP GET

Depending on how you integrate with ironSource atom, you might need to send events using HTTP GET instead of HTTP POST.

To send a single event to ironSource atom using this method make a GET request to https://track.atom-data.io?data=<payload>.

Parameters:

  • data: a base64 encoded version of a JSON.stringified representation of your request, as you would make using a POST request.

Implementation example:

// creating a payload for a GET request in node.js
var payload = {
  stream : "<stream name>",
  data  : JSON.stringify({event: 'buy', item: 'sword'})
};
var base64 = new Buffer(JSON.stringify(payload)).toString('base64');

Send an Event to a Secured Stream

Depending on your app’s architecture, you might want to require a form of authentication, which would prove that the data sent to your stream came from a trusted source. To do so, you can create set a stream to be secured by using authentication.

When you create a secured stream, you receive from ironSource atom a pre-shared authentication key. When sending an event to a secured stream, you need to calculate a SHA256 checksum of your JSON.stringified data (see above) using this pre-shared key and send this checksum in the auth field of the request.

For example, we have a secured stream named atom.example.secured, with the authentication key AZLUeMELSJ6E5M6tPSwwdEY6FdFIKS. Assume we want to send this event to the stream:

{
  "user_id": "DikCypAu0NCF",
  "event_type":"buy_sword",
  "ts":1465072499210
}

To send this event into this stream:

  • We would need to take the JSON.stringified representation of the event: “{“user_id”:”DikCypAu0NCF”,”event_type”:”buy_sword”,”ts”:1465072499210}”
  • Next, we’d calculate the SHA256 checksum using our authentication key, which equals: c997fd6e0a082ea7c43e32b715f37100ab8ae03afa98af30579e329b7a7d6cf5.
  • We would then send this payload in an HTTP POST request to https://track.atom-data.io:
    {
      "stream":"atom.example.secured",
      "data":"{\"user_id\":\"DikCypAu0NCF\",\"event_type\":\"buy_sword\",\"ts\":1465072499210}",
      "auth":"c997fd6e0a082ea7c43e32b715f37100ab8ae03afa98af30579e329b7a7d6cf5"
    }
    Note: To calculate an HMAC checksum, using SHA-256, in Node.js, do the following:

    // calculating an HMAC checksum in node.js
    var crypto = require('crypto');
    var key = 'AZLUeMELSJ6E5M6tPSwwdEY6FdFIKS';
    var data = JSON.stringify(data = {
       "user_id": "DikCypAu0NCF",
       "event_type":"buy_sword",
       "ts":1465072499210
    });
    hmac = crypto.createHmac('sha256', key).update(data, 'utf8').digest('hex');
    

Sending Events in Bulk

Depending on your app’s architecture, you might want to send events to ironSource atom in bulk. Sending events in bulk is cheaper since it saves the overhead of creating a connection and sending HTTP headers again and again for each event.

To send an event in bulk you simply need to make a POST HTTP request to https://track.atom-data.io/bulk with a payload structured like this:

{
    "stream": "<Stream Name>",
    "data": "[\"{\"name\": \"iron\", \"last_name\": \"source\"}\"
            ,\"{\"name\": \"iron2\", \"last_name\": \"source2\"}\"]",
    "auth": "<SHA-256 checksum of the 'data' field using pre-shared key>",
    "bulk": true
}

Parameters:

  • table: The name of the stream you’re sending to.
  • data: A JSON.stringified array of events.
  • auth: If you’re sending this event to a secured stream, you must add this parameter.
  • bulk: Required, must be set to true.

Sending Events Using a SDK

To ease your integration with ironSource atom, we provide SDKs in multiple languages for you to use: