Module: Selligent::Client::Transactionals

Included in:
Selligent::Client
Defined in:
lib/selligent/client/transactionals.rb

Overview

Implements the transactional endpoints

/organizations/:organization/journeys/transactional/*

Instance Method Summary collapse

Instance Method Details

#send_transactional(api_name, model) ⇒ Object

Sends (multiple) transactional messages (email, mobile push, sms)

The model has the following shape:

items: [
  recipient: "[email protected]",
  language: "EN',
  data: {,
  dtsdata: [
    {
      data_selection: "DTS1",
      content: [
        {
          id: "AB"
        },
        {
          id: "CD"
        }
      ]
    }
  ]
]

}

Parameters:

  • api_name (String)

    The name of the execution that should be sent

  • model (Hash)

    The model containing the data that should be sent

Options Hash (model):

  • :items (Array)

    The send requests



49
50
51
# File 'lib/selligent/client/transactionals.rb', line 49

def send_transactional(api_name, model)
  post "#{base_url}/journeys/transactional/#{api_name}/send", model
end

#transactional(api_name) ⇒ Object

Returns information on the transactional journey with the given api name.

Parameters:

  • api_name (String)

    The api name



17
18
19
# File 'lib/selligent/client/transactionals.rb', line 17

def transactional(api_name)
  get "#{base_url}/journeys/transactional/#{api_name}"
end

#transactional_status(id) ⇒ Object

Returns a transactional-status-object for the transactional journey with the given id on the given organization.

Parameters:

  • id (String)

    The message id



110
111
112
# File 'lib/selligent/client/transactionals.rb', line 110

def transactional_status(id)
  get "#{base_url}/journeys/transactional/status/#{id}"
end

#transactionalsObject

Returns a list of the transactional journeys defined on the organization.



10
11
12
# File 'lib/selligent/client/transactionals.rb', line 10

def transactionals
  get "#{base_url}/journeys/transactional"
end

#transactionals_status(ids) ⇒ Object

Returns a list of transactional-status-objects for the messages that correspond to the list of guids that is submitted, for the transactional journeys defined on the given organization.

Parameters:

  • ids (Array<String>)

    The message identifiers



102
103
104
# File 'lib/selligent/client/transactionals.rb', line 102

def transactionals_status(ids)
  post "#{base_url}/journeys/transactional/status", ids
end

#update_profile_and_send_transactional(api_name, model) ⇒ Object

Create and/or update a user profile and then trigger the transactional message with the given api-name on the given organization.

The model has the following shape:

{

items: [
  {
    recipient: "fff",
    language: "EN",
    profile: [
      {
        scope: "MASTER",
        fields: {
          "Name": "John",
          "LastName": "Smith"
        }
      }
    ],
    data: {},
    dtsdata: [
      {
        data_selection: "DTS1",
        content: [
          {
            id: "AB"
          },
          {
            id: "CD"
          }
        ]
      }
    ]
  }
]

}

Parameters:

  • api_name (String)

    The name of the execution that should be sent

  • model (Hash)

    The model containing the data that should be sent

Options Hash (model):

  • :items (Array)

    The request bodies



93
94
95
# File 'lib/selligent/client/transactionals.rb', line 93

def update_profile_and_send_transactional(api_name, model)
  post "#{base_url}/journeys/transactional/shortcut/#{api_name}/updateProfileAndSend", model
end