Module: Teleflow::Api::Events
- Included in:
- Client
- Defined in:
- lib/teleflow/api/events.rb
Overview
Module Teleflow::Api::Events provides an API for managing events in the Teleflow application.
This module includes methods for trigger, bulk trigger, broadcast and cancel events.
For more information on the Teleflow API(api-teleflow.khulnasoft.com/api#/Events), see docs.teleflow.khulnasoft.com/api/trigger-event/.
Instance Method Summary collapse
-
#broadcast_event(body) ⇒ Hash, number
Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc.
-
#cancel_triggered_event(transaction_id) ⇒ number
Using a previously generated transactionId during the event trigger, will cancel any active or pending workflows.
-
#trigger_bulk_event(body) ⇒ Hash, number
Using this endpoint you can trigger multiple events at once, to avoid multiple calls to the API.
-
#trigger_event(body) ⇒ Hash, number
Trigger event is the main (and the only) way to send notification to subscribers.
Instance Method Details
#broadcast_event(body) ⇒ Hash, number
Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc. In the future could be used to trigger events to a subset of subscribers based on defined filters.
@bodyparams:
72 73 74 |
# File 'lib/teleflow/api/events.rb', line 72 def broadcast_event(body) post("/events/trigger/broadcast", body: body) end |
#cancel_triggered_event(transaction_id) ⇒ number
Using a previously generated transactionId during the event trigger, will cancel any active or pending workflows. This is useful to cancel active digests, delays etc…
@pathparams:
83 84 85 |
# File 'lib/teleflow/api/events.rb', line 83 def cancel_triggered_event(transaction_id) delete("/events/trigger/#{transaction_id}") end |
#trigger_bulk_event(body) ⇒ Hash, number
Using this endpoint you can trigger multiple events at once, to avoid multiple calls to the API. The bulk API is limited to 100 events per request.
@bodyparams:
52 53 54 |
# File 'lib/teleflow/api/events.rb', line 52 def trigger_bulk_event(body) post("/events/trigger/bulk", body: body.to_json, headers: {'Content-Type': 'application/json'}) end |
#trigger_event(body) ⇒ Hash, number
Trigger event is the main (and the only) way to send notification to subscribers. The trigger identifier is used to match the particular template associated with it. Additional information can be passed according the body interface below
@bodyparams:
29 30 31 |
# File 'lib/teleflow/api/events.rb', line 29 def trigger_event(body) post("/events/trigger", body: body) end |