# Sending events via SQS queue

Posting messages to an SQS queue is the recommended method to send events to the Ringier event bus.

# Obtaining SQS queue URL and credentials

To initiate the process, please reach out to the bus team to request the creation of an SQS queue for your business(es). Upon approval, you will receive essential credentials for both production and staging environments, including:

  • SQS queue URL
  • IAM access key
  • IAM secret key

# Posting events to the SQS queue

You can find the AWS SDK and installation instructions here (opens new window).

The method for sending a message to the SQS queue varies depending on the programming language. Below, you'll find examples for both PHP and JavaScript.

# Message parameters

# Version 2.0.0 (current)

Name Type Required Description
events array of strings Array of event names.
from string Your node id. It must be the same as the one used to authenticate.
reference string A unique reference for the event instance.
created_at string Date and time when the event was created, including timezone, following ISO 8601 (YYYY-MM-DDThh:mm:ss.sTZD) (opens new window), e.g.: "2022-05-09T16:59:14+02:00"
payload object JSON payload relevant to the specific event(s). See the specifications.
version string Event version. The version described here is "2.0.0".
route string Together with the event name, this field can be used to determine where the event will be routed. Optional and defaulted to empty. Learn more.

# Batch events

If you want to send several events with the same payload, you can send them in one object.
Example of use case: one user creates an account, ticks the newsletter subscription box and is logged in automatically.


{
    "events": ["UserCreated", "NewsletterSubscribed", "UserLogin"],
    "from": "04f9f5d9-d84c-4636-acae-2067eee4d81f",
    "reference": "123456",	
    "created_at": "2022-05-09T16:59:14+02:00",
    "payload": {
      "user": {}
    },
    "version": "2.0.0"
}

Event and payload specifications
View events sent
Event routing
Testing