Module: Teleflow::Api::Subscribers
- Included in:
- Client
- Defined in:
- lib/teleflow/api/subscribers.rb
Overview
Module Teleflow::Api::Subscribers provides an API for managing subscribers in the Teleflow application.
This module includes methods for creating, retrieving, updating, and deleting subscribers. It also includes methods for updating subscriber credentials, online status, preferences etc.
For more information on the Teleflow API(api-teleflow.khulnasoft.com/api#/Subscribers), see docs.teleflow.khulnasoft.com/api/get-subscribers/.
Instance Method Summary collapse
-
#bulk_create_subscribers(body) ⇒ number
Status - The status code.
-
#chat_oauth(subscriberId, providerId, query = {}) ⇒ number
Handle chat OAUTH.
-
#create_subscriber(body) ⇒ Hash, number
Creates a subscriber entity, in the Teleflow platform.
-
#delete_subscriber(subscriber_id) ⇒ Hash, number
Deletes a subscriber entity from the Teleflow platform.
-
#delete_subscriber_credentials(subscriberId, providerId) ⇒ number
Delete subscriber credentials by providerId Delete subscriber credentials such as slack and expo tokens.
-
#mark_all_subscriber_messages(subscriber_id, body) ⇒ number
Marks all the subscriber messages as read, unread, seen or unseen.
-
#mark_message_action_seen(subscriber_id, message_id, type) ⇒ Hash, number
Mark message action as seen.
-
#mark_subscriber_feed_seen(subscriber_id, body) ⇒ Hash, number
Mark a subscriber feed message as seen.
-
#provider_oauth_redirect(subscriberId, providerId, query = {}) ⇒ Hash, number
Handle providers OAUTH redirect.
-
#subscriber(subscriber_id) ⇒ Hash, number
Retrieves the subscriber with the given ID.
-
#subscriber_notification_feed(subscriber_id, query = {}) ⇒ Hash, number
Returns a notification feed for a particular subscriber.
-
#subscriber_preferences(subscriber_id) ⇒ Hash, number
Used to get the subscriber preference.
-
#subscriber_unseen_notification_count(subscriber_id, query = {}) ⇒ Hash, number
Returns the unseen notification count for subscribers feed.
-
#subscribers(query = {}) ⇒ Hash, number
Returns a list of subscribers, could paginated using the ‘page` query parameter.
-
#update_subscriber(subscriber_id, body) ⇒ Hash, number
Used to update the subscriber entity with new information.
-
#update_subscriber_credentials(subscriber_id, body) ⇒ Hash, number
Update subscriber credentials from the Teleflow platform.
-
#update_subscriber_online_status(subscriber_id, body) ⇒ Hash, number
Used to update the subscriber isOnline flag.
-
#update_subscriber_preference(subscriber_id, template_id, body) ⇒ Hash, number
Used to update the subscriber preference.
Instance Method Details
#bulk_create_subscribers(body) ⇒ number
Returns status - The status code. Returns 201 if the subscribers were created successfully.
246 247 248 |
# File 'lib/teleflow/api/subscribers.rb', line 246 def bulk_create_subscribers(body) post("/subscribers/bulk", body: body.to_json, headers: {'Content-Type': 'application/json'}) end |
#chat_oauth(subscriberId, providerId, query = {}) ⇒ number
Handle chat OAUTH
@pathparams: @queryparams:
296 297 298 |
# File 'lib/teleflow/api/subscribers.rb', line 296 def chat_oauth(subscriberId, providerId, query = {}) get("/subscribers/#{subscriberId}/credentials/#{providerId}/oauth", query: query) end |
#create_subscriber(body) ⇒ Hash, number
Creates a subscriber entity, in the Teleflow platform. The subscriber will be later used to receive notifications, and access notification feeds. Communication credentials such as email, phone number, and 3 rd party credentials i.e slack tokens could be later associated to this entity.
@bodyparams:
41 42 43 |
# File 'lib/teleflow/api/subscribers.rb', line 41 def create_subscriber(body) post("/subscribers", body: body) end |
#delete_subscriber(subscriber_id) ⇒ Hash, number
Deletes a subscriber entity from the Teleflow platform
@pathparams:
86 87 88 |
# File 'lib/teleflow/api/subscribers.rb', line 86 def delete_subscriber(subscriber_id) delete("/subscribers/#{subscriber_id}") end |
#delete_subscriber_credentials(subscriberId, providerId) ⇒ number
Delete subscriber credentials by providerId Delete subscriber credentials such as slack and expo tokens.
@pathParams:
115 116 117 |
# File 'lib/teleflow/api/subscribers.rb', line 115 def delete_subscriber_credentials(subscriberId, providerId) delete("/subscribers/#{subscriberId}/credentials/#{providerId}") end |
#mark_all_subscriber_messages(subscriber_id, body) ⇒ number
Marks all the subscriber messages as read, unread, seen or unseen.
@bodyParams:
260 261 262 |
# File 'lib/teleflow/api/subscribers.rb', line 260 def (subscriber_id, body) post("/subscribers/#{subscriber_id}/messages/mark-all", body: body) end |
#mark_message_action_seen(subscriber_id, message_id, type) ⇒ Hash, number
Mark message action as seen
221 222 223 |
# File 'lib/teleflow/api/subscribers.rb', line 221 def (subscriber_id, , type) post("/subscribers/#{subscriber_id}/messages/#{}/actions/#{type}") end |
#mark_subscriber_feed_seen(subscriber_id, body) ⇒ Hash, number
Mark a subscriber feed message as seen
@bodyparams:
207 208 209 |
# File 'lib/teleflow/api/subscribers.rb', line 207 def mark_subscriber_feed_seen(subscriber_id, body) post("/subscribers/#{subscriber_id}/messages/markAs", body: body) end |
#provider_oauth_redirect(subscriberId, providerId, query = {}) ⇒ Hash, number
Handle providers OAUTH redirect
@pathparams: @queryparams:
279 280 281 |
# File 'lib/teleflow/api/subscribers.rb', line 279 def provider_oauth_redirect(subscriberId, providerId, query = {}) get("/subscribers/#{subscriberId}/credentials/#{providerId}/oauth/callback", query: query) end |
#subscriber(subscriber_id) ⇒ Hash, number
Retrieves the subscriber with the given ID.
53 54 55 |
# File 'lib/teleflow/api/subscribers.rb', line 53 def subscriber(subscriber_id) get("/subscribers/#{subscriber_id}") end |
#subscriber_notification_feed(subscriber_id, query = {}) ⇒ Hash, number
Returns a notification feed for a particular subscriber
@queryparams:
176 177 178 |
# File 'lib/teleflow/api/subscribers.rb', line 176 def subscriber_notification_feed(subscriber_id, query = {}) get("/subscribers/#{subscriber_id}/notifications/feed", query: query) end |
#subscriber_preferences(subscriber_id) ⇒ Hash, number
Used to get the subscriber preference
@pathparams:
142 143 144 |
# File 'lib/teleflow/api/subscribers.rb', line 142 def subscriber_preferences(subscriber_id) get("/subscribers/#{subscriber_id}/preferences") end |
#subscriber_unseen_notification_count(subscriber_id, query = {}) ⇒ Hash, number
Returns the unseen notification count for subscribers feed
@queryparams:
191 192 193 |
# File 'lib/teleflow/api/subscribers.rb', line 191 def subscriber_unseen_notification_count(subscriber_id, query = {}) get("/subscribers/#{subscriber_id}/notifications/unseen", query: query) end |
#subscribers(query = {}) ⇒ Hash, number
Returns a list of subscribers, could paginated using the ‘page` query parameter
@queryparams:
20 21 22 |
# File 'lib/teleflow/api/subscribers.rb', line 20 def subscribers(query = {}) get("/subscribers", query: query) end |
#update_subscriber(subscriber_id, body) ⇒ Hash, number
Used to update the subscriber entity with new information
@pathparams:
74 75 76 |
# File 'lib/teleflow/api/subscribers.rb', line 74 def update_subscriber(subscriber_id, body) put("/subscribers/#{subscriber_id}", body: body) end |
#update_subscriber_credentials(subscriber_id, body) ⇒ Hash, number
Update subscriber credentials from the Teleflow platform. Subscriber credentials associated to the delivery methods such as slack and push tokens.
@pathparams: @bodyparams:
102 103 104 |
# File 'lib/teleflow/api/subscribers.rb', line 102 def update_subscriber_credentials(subscriber_id, body) put("/subscribers/#{subscriber_id}/credentials", body: body) end |
#update_subscriber_online_status(subscriber_id, body) ⇒ Hash, number
Used to update the subscriber isOnline flag.
@pathparams: @bodyparams:
130 131 132 |
# File 'lib/teleflow/api/subscribers.rb', line 130 def update_subscriber_online_status(subscriber_id, body) patch("/subscribers/#{subscriber_id}/online-status", body: body) end |
#update_subscriber_preference(subscriber_id, template_id, body) ⇒ Hash, number
Used to update the subscriber preference
@pathparams: @bodyparams:
159 160 161 |
# File 'lib/teleflow/api/subscribers.rb', line 159 def update_subscriber_preference(subscriber_id, template_id, body) patch("/subscribers/#{subscriber_id}/preferences/#{template_id}", body: body) end |