{"id":22683257,"url":"https://github.com/mtchavez/iterable-api-client","last_synced_at":"2025-04-12T18:26:12.917Z","repository":{"id":45398994,"uuid":"105790593","full_name":"mtchavez/iterable-api-client","owner":"mtchavez","description":"Iterable REST API Ruby gem **GITLAB MIRROR**","archived":false,"fork":false,"pushed_at":"2024-01-05T13:44:04.000Z","size":1696,"stargazers_count":11,"open_issues_count":0,"forks_count":14,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T12:46:45.593Z","etag":null,"topics":["iterable","iterable-api","iterable-api-client","iterable-gem","iterable-rest-api"],"latest_commit_sha":null,"homepage":"https://gitlab.com/mtchavez/iterable","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtchavez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-04T16:21:46.000Z","updated_at":"2024-11-21T20:31:45.000Z","dependencies_parsed_at":"2023-01-22T00:16:13.419Z","dependency_job_id":"953093eb-1cd8-4f62-b271-36a547fa3eaa","html_url":"https://github.com/mtchavez/iterable-api-client","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fiterable-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fiterable-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fiterable-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fiterable-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtchavez","download_url":"https://codeload.github.com/mtchavez/iterable-api-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248611857,"owners_count":21133189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iterable","iterable-api","iterable-api-client","iterable-gem","iterable-rest-api"],"created_at":"2024-12-09T21:11:23.949Z","updated_at":"2025-04-12T18:26:12.873Z","avatar_url":"https://github.com/mtchavez.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Iterable API Gem\n\n[![Gem](https://img.shields.io/gem/v/iterable-api-client.svg)](https://rubygems.org/gems/iterable-api-client)\n[![pipeline status](https://gitlab.com/mtchavez/iterable/badges/master/pipeline.svg)](https://gitlab.com/mtchavez/iterable/-/commits/master)\n[![coverage report](https://gitlab.com/mtchavez/iterable/badges/master/coverage.svg)](https://gitlab.com/mtchavez/iterable/commits/master)\n\nRubygem to interact with the [Iterable][iterable] API.\n\n[Source code][source] on [Gitlab].\n\n## Installation\n\n```ruby\ngem install iterable-api-client\n```\n\nor with Bundler in your `Gemfile`\n\n```ruby\ngem 'iterable-api-client'\n```\n\n## Usage\n\n### Documentation\n\nDocumentation can be found on [rubydoc][docs] or in this README\n\n### API Documentation\n\nThe Iterable [API documentation][api-docs] can be a helpful reference for looking\nup all the possible endpoint data interactions. The docs outline all the possible\nparameters to each endpoints as well as custom data fields.\n\n### Configuration\n\n#### Global Config\n\nConfigure the gem with a default global configuration to use.\n\n```ruby\nIterable.configure do |config|\n  config.token = 'api-token'\nend\n```\n\n### Config Object\n\nIf you have multiple tokens to use you can create a `Iterable::Config` object\nwith a different token from the global default and pass in on requests.\n\n```ruby\n# Creating a new config with a different token\nconf = Iterable::Config.new(token: 'new-token')\n\n# Example of using it with the campaigns endpoints\n# which will then make API requests using the passed in config\ncampaigns = Iterable::Campaigns.new(config)\n```\n\n### Responses\n\nResponse objects will attempt to parse the API response as JSON using the `multi_json`\ngem so you can have your own JSON parser handle the loading of responses.\n\nYou can access some of the response data for example:\n\n```ruby\ntemplates = Iterable::Templates.new\nresponse = templates.all\n\n# Check if the response code is a succesfull HTTP Code from 200-299\nresponse.success?\n\n# Get response code\nresponse.code\n\n# Body of response - will attempt to parse as JSON\nresponse.body\n\n# HTTP message\nresponse.message\n\n# Headers of response\nresponse['Content-Type']\n# =\u003e 'application/json; charset=utf-8'\n\n# The URI used to make the request for the response\nreponse.uri\n```\n\n## API Endpoints\n\n- [Bulk Catalog Items](#bulk-catalog-items)\n  - [Create](#bulk-catalog-items-create)\n  - [Delete](#bulk-catalog-items-delete)\n- [Campaigns](#campaigns)\n  - [All](#campaigns-all)\n  - [Create](#campaigns-create)\n  - [Metrics](#campaigns-metrics)\n  - [Child Campaigns](#campaigns-child)\n- [Catalog Field Mappings](#catalog-field-mappings)\n  - [Get](#catalog-field-mappings-get)\n  - [Update](#catalog-field-mappings-update)\n- [Catalog Items](#catalog-items)\n  - [All](#catalog-items-all)\n  - [Create](#catalog-items-create)\n  - [Update](#catalog-items-update)\n  - [Get](#catalog-items-get)\n  - [Delete](#catalog-items-delete)\n- [Catalogs](#catalogs)\n  - [Create](#catalogs-create)\n  - [Delete](#catalogs-delete)\n  - [Names](#catalogs-names)\n- [Channels](#channels)\n  - [All](#channels-all)\n- [Commerce](#commerce)\n  - [Track Purchase](#commerce-track-purchase)\n  - [Update Cart](#commerce-update-cart)\n- [Device](#device)\n  - [Register Device Token](#device-register-token)\n- [Email](#email)\n  - [View](#email-view)\n  - [Target](#email-target)\n- [Email Templates](#email-templates)\n  - [Get](#email-templates-get)\n  - [Update](#email-templates-update)\n  - [Upsert](#email-templates-upsert)\n- [Events](#events)\n  - [For Email](#events-for-email)\n  - [Bulk Track](#events-track-bulk)\n  - [Track](#events-track)\n  - [Track Push Open](#events-track-push-open)\n- [Experiments](#experiments)\n  - [Metrics](#experiments-metrics)\n- [Export](#export)\n  - [JSON](#export-json)\n  - [CSV](#export-csv)\n- [In App](#in-app)\n  - [Messages](#in-app-messages)\n  - [Target](#in-app-target)\n  - [Cancel](#in-app-cancel)\n- [Lists](#lists)\n  - [All](#lists-all)\n  - [Create](#lists-create)\n  - [Delete](#lists-delete)\n  - [Get Users](#lists-users)\n  - [Subscribe](#lists-subscribe)\n  - [Unsubscribe](#lists-unsubscribe)\n- [Message Types](#message-types)\n  - [All](#message-types-all)\n- [Metadata](#metadata)\n  - [Get](#metadata-get)\n  - [List Keys](#metadata-list-keys)\n  - [Delete](#metadata-delete)\n  - [Get Key](#metadata-get-key)\n  - [Remove Key](#metadata-remove-key)\n  - [Add Key](#metadata-add-key)\n- [Push](#push)\n  - [Target](#push-target)\n  - [Cancel](#push-cancel)\n- [Push Templates](#push-templates)\n  - [Get](#push-templates-get)\n  - [Update](#push-templates-update)\n  - [Upsert](#push-templates-upsert)\n- [Templates](#templates)\n  - [All](#templates-all)\n  - [Get](#templates-get)\n- [Users](#users)\n  - [Update](#users-update)\n  - [Bulk Update](#users-bulk-update)\n  - [Update Subscriptions](#users-update-subscriptions)\n  - [Bulk Update Subscriptions](#users-bulk-update-subscriptions)\n  - [For Email](#users-for-email)\n  - [By User ID](#users-by-id)\n  - [Get Fields](#users-get-fields)\n  - [Update Email](#users-update-email)\n  - [Delete](#users-delete)\n  - [Delete By ID](#users-delete-by-id)\n  - [Register Browser Token](#users-register-browser-token)\n  - [Disable Device](#users-disable-device)\n  - [Get Sent Messages](#users-get-messages)\n  - [Forget](#users-forget)\n- [Workflows](#workflows)\n  - [Trigger](#workflows-trigger)\n\n### Bulk Catalog Items\n\n**Beta access only** endpoint\n\n#### Bulk Catalog Items Create\n\nEndpoint: `POST /catalogs/{catalogName}/items`\n\n```ruby\ncatalog = 'my-catalog'\ncatalog_items = Iterable::BulkCatalogItems.new(catalog)\n# Hash of item id to item values\ncreate_items = {\n  '122343453' =\u003e {\n    name: 'item name',\n    status: 'open'\n  }\n}\nresponse = catalog_items.create(create_items, replace_uploaded_fields_only: true)\n # Use replace_uploaded_fields_only as true to update fields\n # of existing items. Otherwise the default is to replace\n # existing items\n```\n\n#### Bulk Catalog Items Delete\n\nEndpoint: `DELETE /catalogs/{catalogName}/items`\n\n```ruby\ncatalog = 'my-catalog'\ncatalog_items = Iterable::BulkCatalogItems.new(catalog)\nitem_ids = ['12345', '12346', '12347']\nresponse = catalog_items.delete(item_ids)\n```\n\n### Campaigns\n\n#### Campaigns All\n\nEndpoint: `GET /campaigns`\n\n```ruby\ncampaigns = Iterable::Campaigns.new\nresponse = campaigns.all\n```\n\n#### Campaigns Create\n\nEndpoint: `POST /campaigns/create`\n\n```ruby\ncampaigns = Iterable::Campaigns.new\n# List IDs to associate with the campaign\nlist_ids = [1234, 1235, 1236]\n# Additional campaign attributes\nattrs = { dataFields: { foo: 'bar' } }\nresponse = campaigns.create 'name', 'template-id', list_ids, attrs\n```\n\n#### Campaigns Metrics\n\nEndpoint: `GET /campaigns/metrics`\n\n```ruby\ncampaigns = Iterable::Campaigns.new\ncampaign_ids = [754321, 4321, 3456]\nend_time = Time.now\nstart_time = end_time - (60 * 60* 24 * 7) # 7 days ago\nresponse = campaigns.metrics campaign_ids, start_time, end_time\n```\n\n#### Campaigns Recurring\n\nEndpoint: `GET /campaigns/recurring/{id}/childCampaigns`\n\n```ruby\ncampaigns = Iterable::Campaigns.new\nresponse = campaigns.recurring 'campaign-id'\n```\n\n### Catalogs\n\n**Beta access only** endpoint\n\n#### Catalogs Create\n\nEndpoint: `POST /catalogs/{catalogName}`\n\n```ruby\ncatalog = 'my-catalog'\ncatalogs = Iterable::Catalogs.new(catalog)\nresponse = catalogs.create\n```\n\n#### Catalogs Delete\n\nEndpoint: `DELETE /catalogs/{catalogName}`\n\n```ruby\ncatalog = 'my-catalog'\ncatalogs = Iterable::Catalogs.new(catalog)\nresponse = catalogs.delete\n```\n\n#### Catalogs Names\n\nEndpoint: `GET /catalogs/{catalogName}`\n\n```ruby\ncatalog = 'my-catalog'\ncatalogs = Iterable::Catalogs.new(catalog)\nparams = { page: 1, pageSize: 20 }\nresponse = catalogs.names(params)\n```\n\n### Catalog Field Mappings\n\n**Beta access only** endpoint\n\n#### Catalog Field Mappings Get\n\nEndpoint: `GET /catalogs/{catalogName}/fieldMappings`\n\n```ruby\ncatalog = 'my-catalog'\ncatalog_field_mappings = Iterable::CatalogFieldMappings.new(catalog)\nresponse = catalog_field_mappings.get\nresponse.body['params']['definedMappings']\n```\n\n#### Catalog Field Mappings Update\n\nEndpoint: `PUT /catalogs/{catalogName}/fieldMappings`\n\n```ruby\ncatalog = 'my-catalog'\nfield_mappings = [{fieldName: 'test-field', fieldType: 'string'}]\ncatalog_field_mappings = Iterable::CatalogFieldMappings.new(catalog)\ncatalog_field_mappings.update(field_mappings)\n```\n\n### Catalog Items\n\n**Beta access only** endpoint\n\n#### Catalog Items All\n\nEndpoint: `GET /catalogs/{catalogName}/items`\n\n```ruby\ncatalog = 'my-catalog'\ncatalog_items = Iterable::CatalogItems.new(catalog)\nresponse = catalog_items.all\n```\n\n#### Catalog Items Create\n\nEndpoint: `PUT /catalogs/{catalogName}/items/{itemId}`\n\n```ruby\ncatalog = 'my-catalog'\nitem_id = '1234-abcd-1234-abcd'\ncatalog_items = Iterable::CatalogItems.new(catalog, item_id)\nitem_attrs = { name: 'item name', status: 'open' }\nresponse = catalog_items.create(item_attrs)\n```\n\n#### Catalog Items Update\n\nEndpoint: `PATCH /catalogs/{catalogName}/items/{itemId}`\n\n```ruby\ncatalog = 'my-catalog'\nitem_id = '1234-abcd-1234-abcd'\ncatalog_items = Iterable::CatalogItems.new(catalog, item_id)\nitem_attrs = { name: 'item name', status: 'open' }\nresponse = catalog_items.update(item_attrs)\n```\n\n#### Catalog Items Get\n\nEndpoint: `GET /catalogs/{catalogName}/items/{itemId}`\n\n```ruby\ncatalog = 'my-catalog'\nitem_id = '1234-abcd-1234-abcd'\ncatalog_items = Iterable::CatalogItems.new(catalog, item_id)\nresponse = catalog_items.get\n```\n\n#### Catalog Items Delete\n\nEndpoint: `DELETE /catalogs/{catalogName}/items/{itemId}`\n\n```ruby\ncatalog = 'my-catalog'\nitem_id = '1234-abcd-1234-abcd'\ncatalog_items = Iterable::CatalogItems.new(catalog, item_id)\nresponse = catalog_items.delete\n```\n\n### Catalogs\n\n**Beta access only** endpoint\n\n#### Catalogs Create\n\nEndpoint: `POST /catalogs/{catalogName}`\n\n```ruby\ncatalog = 'my-catalog'\ncatalog_items = Iterable::Catalogs.new(catalog)\nresponse = catalog_items.create\n```\n\n#### Catalogs Delete\n\nEndpoint: `DELETE /catalogs/{catalogName}`\n\n```ruby\ncatalog = 'my-catalog'\ncatalog_items = Iterable::Catalogs.new(catalog)\nresponse = catalog_items.delete\n```\n\n#### Catalogs Names\n\nEndpoint: `GET /catalogs/{catalogName}/names`\n\n```ruby\ncatalog = 'my-catalog'\ncatalog_items = Iterable::Catalogs.new(catalog)\nparams = { page: 1, pageSize: 20 }\nresponse = catalog_items.names(params)\n```\n\n### Channels\n\n#### Channels All\n\nEndpoint: `GET /channels`\n\n```ruby\nchannels = Iterable::Channels.new\nresponse = channels.all\n```\n\n### Commerce\n\n#### Commerce Track Purchase\n\nEndpoint: `POST /commerce/trackPurchase`\n\n```ruby\n# Set up items to track\nitems = [{\n  id: 'abcd-1234-hjkl-4321',\n  name: 'Mustard',\n  price: 34.0,\n  quantity: 13\n}]\n# Calculate total of items i.e. 34.0\ntotal = items.reduce(0) { |total, item| total += item.fetch(:price, 0.0) }\n# Gather user information for purchase\nuser = { userId: '42', email: 'user@example.com' }\n\ncommerce = Iterable::Commerce.new\nresponse = commerce.track_purchase total, items, user\n```\n\n#### Commerce Update Cart\n\nEndpoint: `POST /commerce/updateCart`\n\n```ruby\n# Items to update the user's cart with\nitems = [{\n  id: 'abcd-1234-hjkl-4321',\n  name: 'Mustard',\n  price: 34.0,\n  quantity: 13\n}]\n# User of the cart you want to update\nuser = { userId: '42', email: 'user@example.com' }\n\ncommerce = Iterable::Commerce.new\nresponse = commerce.update_cart items, user\n```\n\n### Device\n\n#### Device Register Token\n\nEndpoint: `POST /users/registerDeviceToken`\n\n```ruby\ndata_fields = { some: 'data', fields: 'here' }\ndevice = Device.new 'token', 'mobile-push-app', Iterable::Device::APNS, data_fields\ndevice.register 'foo@example.com'\n\n# Can pass in a user ID as well\ndevice.register 'user@example.com', '42'\n```\n\n### Email\n\n#### Email View\n\nEndpoint: `GET /email/viewInBrowser`\n\n```ruby\nemail = Iterable::Email.new\nresponse = email.view 'user@example.com', 'message-id'\n```\n\n#### Email Target\n\nEndpoint: `GET /email/target`\n\n```ruby\nemail = Iterable::Email.new\n# User email and campaign to target\nresponse = email.target 'user@example.com', 42\n\n# Can pass in more attributes like dataFields\nresponse = email.target 'user@example.com', 42, { dataFields: { first_name: 'Sally' } }\n```\n\n### Email Templates\n\n#### Email Templates Get\n\nEndpoint: `GET /templates/email/get`\n\n```ruby\ntemplates = Iterable::EmailTemplates.new\nresponse = templates.get 'template-id'\n```\n\n#### Email Templates Update\n\nEndpoint: `POST /templates/email/update`\n\n```ruby\ntemplates = Iterable::EmailTemplates.new\n# Additional template attributes\nattrs = { metadata: {}, name: 'name', fromEmail: 'co@co.co' }\nresponse = templates.update 'template-id', attrs\n```\n\n#### Email Templates Upsert\n\nEndpoint: `POST /templates/email/update`\n\n```ruby\ntemplates = Iterable::EmailTemplates.new\n# Additional template attributes\nattrs = { metadata: {}, name: 'name', fromEmail: 'co@co.co' }\nresponse = templates.upsert 'client-template-id', attrs\n```\n\n### Events\n\n#### Events for Email\n\nEndpoint: `GET /events/{email}`\n\n```ruby\nevents = Iterable::Events.new\n# Default limit of 30\nresponse = events.for_email 'user@example.com'\n```\n\n#### Events Track\n\nEndpoint: `POST /events/track`\n\n```ruby\nevents = Iterable::Events.new\n# Any aditional attributes for the event\nattrs = { campaignId: 42, dataFields: {} }\nresponse = events.track 'event-name', 'user@example.com', attrs\n```\n\n#### Events Track Bulk\n\nEndpoint: `POST /events/trackBulk`\n\n```ruby\nevents = Iterable::Events.new\n# Array of events to track\nevents_attrs = [\n  { email: 'user@example.com', eventName: 'event-name', campaignId: 42, dataFields: {} }\n]\nresponse = iterable_events.track_bulk events_attrs\n```\n\n#### Events Track Push Open\n\nEndpoint: `GET /events/{email}`\n\n```ruby\nevents = Iterable::Events.new\nresponse = events.for_email 'user@example.com'\ncampaign_id = 42\nmessage_id = 123\n# Any aditional attributes for the event\nattrs = { dataFields: {} }\nresponse = events.track_push_open campaign_id, message_id, 'user@example.com', attrs\n```\n\n### Experiments\n\n#### Experiments Metrics\n\nEndpoint: `GET /experiments/metrics`\n\n```ruby\nexperiment_ids = [1, 2, 3, 4]\nexperiments = Iterable::Experiments.new experiment_ids\nend_time = Time.now\nstart_time = end_time - (60 * 60* 24 * 7) # 7 days ago\nresponse = experiments.metrics campaign_ids, start_time, end_time\n```\n\n### Export\n\n#### Export JSON\n\nEndpoint: `GET /export/data.json`\n\n```ruby\nexporter = Iterable::JsonExporter.new Iterable::Export::EMAIL_SEND_TYPE\n\n# Export with an iterable range\nresponse = exporter.export_range Iterable::Export::BEFORE_TODAY\n\n# Export with a custom time range\nend_time = Time.now\nstart_time = end_time - (60 * 60* 24 * 7) # 7 days ago\nresponse = exporter.export start_time, end_time\n```\n\n#### Export CSV\n\nEndpoint: `GET /export/data.csv`\n\n```ruby\nexporter = Iterable::CsvExporter.new Iterable::Export::EMAIL_SEND_TYPE\n\n# Export with an iterable range\nresponse = exporter.export_range Iterable::Export::BEFORE_TODAY\n\n# Export with a custom time range\nend_time = Time.now\nstart_time = end_time - (60 * 60* 24 * 7) # 7 days ago\nresponse = exporter.export start_time, end_time\n```\n\n### In App\n\n#### In App Messages\n\nEndpoint: `GET /inApp/getMessages`\n\n```ruby\nin_app = Iterable::InApp.new\n\n# Get messages for a user by email\nemail = 'user@example.com'\nresponse = in_app.messages_for_email email, count: 10\n\n# Get messages for a user by user_id\nemail = 'user@example.com'\nresponse = in_app.messages_for_user_id 42, count: 2\n\n# Pass in query parameters\nemail = 'user@example.com'\nattrs = { 'platform' =\u003e 'iOS' }\nresponse = in_app.messages_for_email email, attrs\n```\n\n#### In App Target\n\nEndpoint: `POST /inApp/target`\n\n```ruby\nin_app = Iterable::InApp.new\n\n# Needs campaign ID and an optional email\nemail = 'user@example.com'\nattrs = { 'campaignId' =\u003e '123456asdf' }\nresponse = in_app.target attrs: attrs, email: email\n```\n\n#### In App Cancel\n\nEndpoint: `POST /push/cancel`\n\n```ruby\nin_app = Iterable::InApp.new\n\n# Needs campaign ID and an optional email and optional attrs for request\nemail = 'user@example.com'\ncampaign_id = '12345asdf'\nattrs = {}\nresponse = in_app.target campaign_id: campaign_id, attrs: attrs, email: email\n```\n\n### Lists\n\n#### Lists All\n\nEndpoint: `GET /lists`\n\n```ruby\nlists = Iterable::Lists.new\nresponse = lists.all\n```\n\n#### Lists Create\n\nEndpoint: `POST /lists`\n\n```ruby\nlists = Iterable::Lists.new\nresponse = lists.create 'list-name'\n```\n\n#### Lists Delete\n\nEndpoint: `DELETE /lists/{listId}`\n\n```ruby\nlists = Iterable::Lists.new\nresponse = lists.delete 'list-id'\n```\n\n#### Lists Get Users\n\nEndpoint: `GET /lists/getUsers`\n\n```ruby\nlists = Iterable::Lists.new\nresponse = lists.users 'list-id'\n```\n\n#### Lists Subscribe\n\nEndpoint: `POST /lists/subscribe`\n\n```ruby\nlists = Iterable::Lists.new\nsubscribers = [\n\t{ email: 'user@example.com', dataFields: {}, userId: '42' }\n]\nresponse = lists.subscribe 'list-id', subscribers\n```\n\n#### Lists Unsubscribe\n\nEndpoint: `POST /lists/unsubscribe`\n\n```ruby\nlists = Iterable::Lists.new\nsubscribers = [\n\t{ email: 'user@example.com', dataFields: {}, userId: '42' }\n]\nresponse = lists.unsubscribe 'list-id', subscribers\n```\n\n### Message Types\n\n#### Message Types All\n\nEndpoint: `GET /messageTypes`\n\n```ruby\nmetadata = Iterable::MessageTypes.new\nresponse = metadata.all\n```\n\n### Metadata\n\n#### Metadata Get\n\nEndpoint: `GET /metadata`\n\n```ruby\nmetadata = Iterable::Metadata.new\nresponse = metadata.get\n```\n\n#### Metadata List Keys\n\nEndpoint: `GET /metadata/{table}`\n\n```ruby\nmetadata_table = Iterable::MetadataTable.new 'table-name'\nresponse = metadata_table.list_keys\n\n# Next marker is thenext result set id which is returned by previous\n# search if more hits exist\nresponse = metadata_table.list_keys 'next-marker-id'\n```\n\n#### Metadata Delete Key\n\nEndpoint: `DELETE /metadata/{table}`\n\n```ruby\nmetadata_table = Iterable::MetadataTable.new 'table-name'\nresponse = metadata_table.delete\n```\n\n#### Metadata Get Key\n\nEndpoint: `GET /metadata/{table}/{key}`\n\n```ruby\nmetadata_table = Iterable::MetadataTable.new 'table-name'\nresponse = metadata_table.get 'metadata-key'\n```\n\n#### Metadata Remove Key\n\nEndpoint: `DELETE /metadata/{table}/{key}`\n\n```ruby\nmetadata_table = Iterable::MetadataTable.new 'table-name'\nresponse = metadata_table.remove 'metadata-key'\n```\n\n#### Metadata Add Key\n\nEndpoint: `PUT /metadata/{table}/{key}`\n\n```ruby\nmetadata_table = Iterable::MetadataTable.new 'table-name'\nvalue = { foo: 'bar', data: 'stuffs' }\nresponse = metadata_table.add 'metadata-key', value\n```\n\n### Push\n\n#### Push Target\n\nEndpoint: `POST /push/target`\n\n```ruby\npush = Iterable::Push.new\ncampaign_id = '1234asdf'\nemail = 'user@example.com' # optional\nattrs = {} # optional extra params for the request\nresponse = push.target campaign_id: campaign_id, email: email, attrs: attrs\n```\n\n#### Push Cancel\n\nEndpoint: `POST /push/cancel`\n\n```ruby\npush = Iterable::Push.new\ncampaign_id = '1234asdf'\nemail = 'user@example.com' # optional\nattrs = {} # optional extra params for the request\nresponse = push.cancel email: email, campaign_id: campaign_id, attrs: attrs\n```\n\n### Push Templates\n\n#### Push Templates Get\n\nEndpoint: `GET /templates/push/get`\n\n```ruby\ntemplates = Iterable::PushTemplates.new\n# Additional template params to query by\nparams = { locale: 'en-US' }\nresponse = templates.get 'template-id', params\n```\n\n#### Push Templates Update\n\nEndpoint: `POST /templates/push/update`\n\n```ruby\ntemplates = Iterable::PushTemplates.new\n# Additional template attrs to update\nattrs = { name: 'Template', message: 'Template message'}\nresponse = templates.update 'client-template-id', attrs\n```\n\n#### Push Templates Upsert\n\nEndpoint: `POST /templates/push/upsert`\n\n```ruby\ntemplates = Iterable::PushTemplates.new\n# Additional template attrs to upsert\nattrs = { name: 'Template', message: 'Template message'}\nresponse = templates.upsert 'client-template-id', attrs\n```\n\n### Templates\n\n#### Templates All\n\nEndpoint: `GET /templates`\n\n```ruby\ntemplates = Iterable::Templates.new\n# Additional params to filter and search by\nparams = { templateType: Iterable::Templates::BLAST_TYPE, messageMedium: Iterable::MessageTypes::EMAIL_MEDIUM }\nresponse = templates.all params\n```\n\n#### Templates Get\n\nEndpoint: `GET /templates/getByClientTemplateId`\n\n```ruby\ntemplates = Iterable::Templates.new\nresponse = templates.for_client_template_id 'client-template-id'\n```\n\n### Users\n\n#### Users Update\n\nEndpoint: `POST /users/update`\n\n```ruby\nusers = Iterable::Users.new\n# Additional attributes to send\nattrs = { userID: 'custom-id' }\nresponse = users.update 'user@example.com', attrs\n```\n\n#### Users Bulk Update\n\nEndpoint: `POST /users/bulkUpdate`\n\n```ruby\nusers = Iterable::Users.new\n# Array of users to update by email with additional\n# fields if needed\nusers_attrs = [\n\t{ email: 'user@example.com', userID: 'custom-id' }\n]\nresponse = users.bulk_update users_attrs\n```\n\n#### Users Update Subscriptions\n\nEndpoint: `POST /users/updateSubscriptions`\n\n```ruby\nusers = Iterable::Users.new\n# Additional attributes to send\nattrs = { userID: 'custom-id' }\nresponse = users.update_subscriptions 'user@example.com', attrs\n```\n\n#### Users Bulk Update Subscriptions\n\nEndpoint: `POST /users/bulkUpdateSubscriptions`\n\n```ruby\nusers = Iterable::Users.new\n# Array of users to update by email with additional\n# fields if needed\nusers = [\n\t{ email: 'user@example.com', userID: 'custom-id' }\n]\nresponse = users.bulk_update_subscriptions users\n```\n\n#### Users For Email\n\nEndpoint: `GET /users/{email}`\n\n```ruby\nusers = Iterable::Users.new\nresponse = users.for_email 'user@example.com'\n```\n\n#### Users For ID\n\nEndpoint: `GET /users/byUserID/{userID}`\n\n```ruby\nusers = Iterable::Users.new\nresponse = users.for_id '42'\n```\n\n#### Users Get Fields\n\nEndpoint: `GET /users/getFields`\n\n```ruby\nusers = Iterable::Users.new\nresponse = users.fields\n```\n\n#### Users Update Email\n\nEndpoint: `POST /users/updateEmail`\n\n```ruby\nusers = Iterable::Users.new\nresponse = users.update_email 'old-email@me.com', 'new-email@email.me'\n```\n\n#### Users Delete\n\nEndpoint: `DELETE /users/{email}`\n\n```ruby\nusers = Iterable::Users.new\nresponse = users.delete 'user@example.com'\n```\n\n#### Users Delete By ID\n\nEndpoint: `DELETE /users/byUserId/{userID}`\n\n```ruby\nusers = Iterable::Users.new\nresponse = users.delete_by_id '42'\n```\n\n#### Users Register Browser Token\n\nEndpoint: `POST /users/registerBrowserToken`\n\n```ruby\nusers = Iterable::Users.new\n# Additional attrs to associate with token\nattrs = { userID: '42' }\nresponse = users.register_browser_token 'user@example.com', 'the-token', attrs\n```\n\n#### Users Disable Device\n\nEndpoint: `POST /users/registerBrowserToken`\n\n```ruby\nusers = Iterable::Users.new\nresponse = users.disable_device 'the-token', 'user@example.com'\n\n# Optionally can use a user ID over email\nresponse = users.disable_device 'the-token', nil, '42'\n```\n\n#### Users Get Sent Messages\n\nEndpoint: `POST /users/update`\n\n```ruby\nusers = Iterable::Users.new\n# Additional params to filter and query by\nparams = { campaignId: 'custom-id', limit: 30 }\nend_time = Time.now\nstart_time = end_time - (60 * 60* 24 * 7) # 7 days ago\nresponse = users.sent_messages 'user@example.com', start_time, end_time, params\n```\n\n#### Users Forget\n\nEndpoint: `POST /users/forget`\n\n```ruby\nusers = Iterable::Users.new\n# Additional params to filter and query by\nemail = 'user@example.com'\nresponse = users.forget email\n```\n\n### Workflows\n\n#### Workflows Trigger\n\nEndpoint: `POST /workflows/triggerWorkflow`\n\n```ruby\nworkflows = Iterable::Workflows.new\n# Additional attributes to send\nattrs = { listId: 'listId' }\nresponse = workflows.trigger 'workflow-id', attrs\n```\n\n[api-docs]: https://api.iterable.com/api/docs\n[docs]: http://www.rubydoc.info/gems/iterable-api-client\n[gitlab]: https://gitlab.com\n[iterable]: https://iterable.com\n[source]: https://gitlab.com/mtchavez/iterable\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fiterable-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtchavez%2Fiterable-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fiterable-api-client/lists"}