AWS SQS Export
Export Lytics trigger events to AWS SQS. A Lytics trigger is an event that is raised and available for export when a user enters or leaves a segment for example "User x just entered at_risk_to_churn".
AWS SQS can be used for a variety of use cases such as:
- Use a Lytics trigger "User at risk to churn" (user enters the segment at risk to churn) to send an AWS Pinpoint message.
- Use a Lytics user profile update to write user profiles to an AWS database service such as Redshift, RDS, or DynamoDB for further analysis.
- Use a Lytics user profile update to send to AWS Lambda for custom scoring and then returning the event score back to lytics.
Before You Begin
Requires an AWS account with an existing SQS Queue. You will need an Access Key and Secert Key for authentication.
Authentication
- From Data > Integrations Select the Amazon Web Services tile.
- Navigate to the Authorizations section
- Click Add new authorization:
- Select Enter AWS Keys.
- Enter your Access Key, Secret Key, and a Description for the authorization.
- Click Authorize to save this authorization.
Export Triggers to SQS
Summary | |
---|---|
Frequency | Real-time Triggers (when event occurs for user) |
Exports to | JSON record of user with event info on which segments they entered or left. |
Export triggers to AWS SQS when users enter or exit selected audiences.
- From Data > Integrations Select the Amazon Web Services tile.
- Click on New workflow.
- Select SQS Event Hub Sink.
- Select the authorization you created during the authentication step.
- Complete the required fields:
- Audience(s): Select which Lytics audiences to emit events from.
- SQS URL Stream: Enter the AWS SQS stream url you have created and granted Lytics access to. IT will be in format like this: https://us-east-2.queue.amazonaws.com/111111111/test_lytics_sqs
- Region: Select the AWS region that the SQS stream resides in.
- Event/User Attributes: The user profile fields to use for SQS message attributes. (see sqs documentation for message attributes).
- Existing Users: Should we go back and find all user's currently in segment, and raise an event for them, then raise events in future for all users as they occur in real time? True means yes, back fill all current users. False means only raise events for users in the future as they occur.
Message format for Subscription Events.
When a user profile is updated, it may be due to:
- A new data event.
- Scoring gets updated ocassionally.
- A scheduled trigger evaluation. A trigger of "has not logged in last 7 days" may get scheduled to be evaluated 7 days after last x event.
When the user gets updated, segment membership is reevaluated and segments a user has moved into or out of triggers a message.
Here is an example of the message that is produced.
{
"data": {
"_created": "2016-06-29T18:50:16.902758229Z",
"_modified": "2017-03-18T06:12:36.829070108Z",
"email": "[email protected]",
"user_id": "user123",
"segment_events":[
{
"id": "d3d8f15855b6b067709577342fe72db9",
"event": "exit",
"enter": "2017-03-02T06:12:36.829070108Z",
"exit": "2017-03-18T06:12:36.829070108Z",
"slug": "demo_segment"
},
{
"id": "abc678asdf",
"event": "enter",
"enter": "2017-03-02T06:12:36.829070108Z",
"exit": "2099-03-18T06:12:36.829070108Z",
"slug": "another_segment"
}
]
},
"meta":{
"object":"user",
"subscription_id": "7e2b8804bbe162cd3f9c0c5991bf3078",
"timestamp": "2017-03-18T06:12:36.829070108Z"
}
}