### Install Userlist Gem Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Add the userlist gem to your application's Gemfile for integration. This is the standard method for including the gem in a Ruby project. ```ruby gem 'userlist' ``` -------------------------------- ### Generate JWT Tokens for In-App Messages in Ruby Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Provides an example of generating a JWT token for in-app messages using the `Userlist::Token.generate` method. This requires configuring `push_key` and `push_id` in the Userlist settings. The generated token is used to authenticate users for in-app messages. Assumes the Userlist gem is installed. ```ruby Userlist::Token.generate('user-1') ``` -------------------------------- ### Track User/Company Relationships in Ruby Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Demonstrates how to track relationships between users and companies using the Userlist Ruby gem. This can be done directly via the relationships push method or by specifying relationships within user or company push operations. It assumes the Userlist gem is installed and configured. ```ruby Userlist::Push.relationships.push( user: 'user-1', company: 'company-1', properties: { role: 'owner' } ) ``` ```ruby Userlist::Push.users.push( identifier: 'user-1', relationships: [ { company: 'company-1', properties: { role: 'owner' } } ] ) ``` ```ruby Userlist::Push.companies.push( identifier: 'company-1', relationships: [ { user: 'user-1', properties: { role: 'owner' } } ] ) ``` -------------------------------- ### Configure Userlist Push API Key and ID via Initializer Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Configure the Userlist Push API key and ID programmatically within a Ruby initializer. This method is an alternative to using environment variables. ```ruby Userlist.configure do |config| config.push_key = 'VvB7pjDrv0V2hoaOCeZ5rIiUEPbEhSUN' config.push_id = '6vPkJl44cm82y4aLBIzaOhuEHJd0Bm7b' end ``` -------------------------------- ### Configure Userlist Push API Key and ID via Environment Variables Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Set the Userlist Push API key and ID using environment variables. These values take precedence over configuration set in an initializer. ```shell USERLIST_PUSH_KEY=VvB7pjDrv0V2hoaOCeZ5rIiUEPbEhSUN USERLIST_PUSH_ID=6vPkJl44cm82y4aLBIzaOhuEHJd0Bm7b ``` -------------------------------- ### Send Transactional Messages in Ruby Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Illustrates how to send transactional messages using the `Userlist::Push.messages.push` method in the Userlist Ruby gem. The method accepts a hash containing the user identifier, message template, and custom properties. Ensure the Userlist gem is set up. ```ruby message = { user: 'user-1', template: 'welcome-email', properties: { account_name: 'Example, Inc.', billing_plan: 'Pro' } } Userlist::Push.messages.push(message) ``` -------------------------------- ### Track Custom Events in Ruby Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Shows how to track custom events using the `Userlist::Push.events.push` method. It covers basic event tracking with user identifiers and properties, as well as a more advanced method where user properties can be updated simultaneously with event tracking. Requires the Userlist gem. ```ruby Userlist::Push.events.push( name: 'project_created', user: 'user-1', properties: { project_name: 'Example project' } ) ``` ```ruby Userlist::Push.events.push( name: 'project_created', user: { identifier: 'user-1', properties: { projects: 5 } }, properties: { project_name: 'Example project' } ) ``` -------------------------------- ### Push User Data to Userlist Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Send user data to Userlist using the `Userlist::Push.users.push` method. Requires an identifier, and optionally accepts email and properties. ```ruby Userlist::Push.users.push( identifier: 'user-1', email: 'foo@example.com', properties: { first_name: 'Foo', last_name: 'Example' } ) ``` -------------------------------- ### Push Company Data to Userlist Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Send company data to Userlist using the `Userlist::Push.companies.push` method. Requires an identifier, and optionally accepts name and properties. ```ruby Userlist::Push.companies.push( identifier: 'company-1', email: 'Example, Inc.', properties: { industry: 'Software Testing' } ) ``` -------------------------------- ### Disable Userlist Push Strategy Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Configure the Userlist gem to use the ':null' push strategy to disable data transmissions. This is useful for development and test environments. ```ruby Userlist.configure do |config| config.push_strategy = :null end ``` -------------------------------- ### Delete User from Userlist Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Remove a user from Userlist by providing their identifier to the `Userlist::Push.users.delete` method. ```ruby Userlist::Push.users.delete('user-1') ``` -------------------------------- ### Delete Company from Userlist Source: https://github.com/userlist/userlist-ruby/blob/main/README.md Remove a company from Userlist by providing its identifier to the `Userlist::Push.companies.delete` method. ```ruby Userlist::Push.companies.delete('user-1') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.