sendx-ruby-sdk 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +220 -81
  3. data/lib/sendx-ruby-sdk/api/campaign_api.rb +95 -143
  4. data/lib/sendx-ruby-sdk/api/contact_api.rb +129 -96
  5. data/lib/sendx-ruby-sdk/api/custom_field_api.rb +391 -0
  6. data/lib/sendx-ruby-sdk/api/email_sending_api.rb +158 -0
  7. data/lib/sendx-ruby-sdk/api/event_api.rb +91 -57
  8. data/lib/sendx-ruby-sdk/api/events_api.rb +158 -0
  9. data/lib/sendx-ruby-sdk/api/getting_started_api.rb +2 -2
  10. data/lib/sendx-ruby-sdk/api/list_api.rb +126 -91
  11. data/lib/sendx-ruby-sdk/api/post_api.rb +380 -0
  12. data/lib/sendx-ruby-sdk/api/post_category_api.rb +362 -0
  13. data/lib/sendx-ruby-sdk/api/post_tag_api.rb +362 -0
  14. data/lib/sendx-ruby-sdk/api/report_api.rb +90 -0
  15. data/lib/sendx-ruby-sdk/api/reports_api.rb +4 -4
  16. data/lib/sendx-ruby-sdk/api/sender_api.rb +28 -37
  17. data/lib/sendx-ruby-sdk/api/tag_api.rb +380 -0
  18. data/lib/sendx-ruby-sdk/api/tags_api.rb +8 -8
  19. data/lib/sendx-ruby-sdk/api/team_member_api.rb +147 -0
  20. data/lib/sendx-ruby-sdk/api/template_api.rb +391 -0
  21. data/lib/sendx-ruby-sdk/api/tracking_api.rb +158 -0
  22. data/lib/sendx-ruby-sdk/api/webhook_api.rb +362 -0
  23. data/lib/sendx-ruby-sdk/api_client.rb +10 -11
  24. data/lib/sendx-ruby-sdk/api_error.rb +3 -3
  25. data/lib/sendx-ruby-sdk/configuration.rb +6 -10
  26. data/lib/sendx-ruby-sdk/models/campaign.rb +23 -7
  27. data/lib/sendx-ruby-sdk/models/campaign_dashboard_data.rb +11 -5
  28. data/lib/sendx-ruby-sdk/models/campaign_request.rb +13 -41
  29. data/lib/sendx-ruby-sdk/models/contact.rb +11 -5
  30. data/lib/sendx-ruby-sdk/models/contact_request.rb +11 -5
  31. data/lib/sendx-ruby-sdk/models/create_response.rb +11 -5
  32. data/lib/sendx-ruby-sdk/models/custom_event_request.rb +37 -42
  33. data/lib/sendx-ruby-sdk/models/custom_field.rb +285 -0
  34. data/lib/sendx-ruby-sdk/models/customfield_customfield_id_delete200_response.rb +220 -0
  35. data/lib/sendx-ruby-sdk/models/dashboard_stats.rb +11 -5
  36. data/lib/sendx-ruby-sdk/models/delete_campaign200_response.rb +11 -5
  37. data/lib/sendx-ruby-sdk/models/delete_request.rb +11 -5
  38. data/lib/sendx-ruby-sdk/models/delete_response.rb +77 -13
  39. data/lib/sendx-ruby-sdk/models/e_custom_field.rb +295 -0
  40. data/lib/sendx-ruby-sdk/models/error_response.rb +288 -0
  41. data/lib/sendx-ruby-sdk/models/event_response.rb +13 -19
  42. data/lib/sendx-ruby-sdk/models/events_revenue_postback_get200_response.rb +229 -0
  43. data/lib/sendx-ruby-sdk/models/events_revenue_postback_get400_response.rb +220 -0
  44. data/lib/sendx-ruby-sdk/models/events_revenue_postback_get500_response.rb +220 -0
  45. data/lib/sendx-ruby-sdk/models/identify_error_response.rb +220 -0
  46. data/lib/sendx-ruby-sdk/models/identify_request.rb +52 -40
  47. data/lib/sendx-ruby-sdk/models/identify_response.rb +16 -19
  48. data/lib/sendx-ruby-sdk/models/last_sent_campaign_stat.rb +11 -5
  49. data/lib/sendx-ruby-sdk/models/link_stat.rb +232 -0
  50. data/lib/sendx-ruby-sdk/models/list_model.rb +11 -6
  51. data/lib/sendx-ruby-sdk/models/list_request.rb +11 -5
  52. data/lib/sendx-ruby-sdk/models/message_response.rb +229 -0
  53. data/lib/sendx-ruby-sdk/models/operation_response.rb +241 -0
  54. data/lib/sendx-ruby-sdk/models/postback_response.rb +229 -0
  55. data/lib/sendx-ruby-sdk/models/report_data.rb +11 -5
  56. data/lib/sendx-ruby-sdk/models/response.rb +11 -5
  57. data/lib/sendx-ruby-sdk/models/rest_e_campaign.rb +539 -0
  58. data/lib/sendx-ruby-sdk/models/rest_e_contact.rb +380 -0
  59. data/lib/sendx-ruby-sdk/models/rest_e_custom_field.rb +299 -0
  60. data/lib/sendx-ruby-sdk/models/rest_e_list.rb +238 -0
  61. data/lib/sendx-ruby-sdk/models/rest_e_post.rb +443 -0
  62. data/lib/sendx-ruby-sdk/models/rest_e_post_category.rb +238 -0
  63. data/lib/sendx-ruby-sdk/models/rest_e_post_tag.rb +238 -0
  64. data/lib/sendx-ruby-sdk/models/rest_e_sender.rb +265 -0
  65. data/lib/sendx-ruby-sdk/models/rest_e_tag.rb +238 -0
  66. data/lib/sendx-ruby-sdk/models/rest_e_template.rb +307 -0
  67. data/lib/sendx-ruby-sdk/models/rest_e_webhook.rb +349 -0
  68. data/lib/sendx-ruby-sdk/models/rest_r_campaign.rb +580 -0
  69. data/lib/sendx-ruby-sdk/models/rest_r_contact.rb +438 -0
  70. data/lib/sendx-ruby-sdk/models/rest_r_custom_field.rb +306 -0
  71. data/lib/sendx-ruby-sdk/models/rest_r_list.rb +291 -0
  72. data/lib/sendx-ruby-sdk/models/rest_r_member.rb +274 -0
  73. data/lib/sendx-ruby-sdk/models/rest_r_post.rb +384 -0
  74. data/lib/sendx-ruby-sdk/models/rest_r_post_category.rb +251 -0
  75. data/lib/sendx-ruby-sdk/models/rest_r_post_tag.rb +250 -0
  76. data/lib/sendx-ruby-sdk/models/rest_r_sender.rb +272 -0
  77. data/lib/sendx-ruby-sdk/models/rest_r_tag.rb +272 -0
  78. data/lib/sendx-ruby-sdk/models/rest_r_template.rb +366 -0
  79. data/lib/sendx-ruby-sdk/models/rest_r_webhook.rb +326 -0
  80. data/lib/sendx-ruby-sdk/models/rest_report_data.rb +312 -0
  81. data/lib/sendx-ruby-sdk/models/revenue_event_request.rb +37 -42
  82. data/lib/sendx-ruby-sdk/models/sender.rb +41 -5
  83. data/lib/sendx-ruby-sdk/models/sender_request.rb +31 -5
  84. data/lib/sendx-ruby-sdk/models/sender_response.rb +51 -5
  85. data/lib/sendx-ruby-sdk/models/tag.rb +11 -5
  86. data/lib/sendx-ruby-sdk/models/tag_request.rb +11 -5
  87. data/lib/sendx-ruby-sdk/models/template_email_message.rb +337 -0
  88. data/lib/sendx-ruby-sdk/models/track_request.rb +28 -20
  89. data/lib/sendx-ruby-sdk/models/track_response.rb +12 -6
  90. data/lib/sendx-ruby-sdk/models/webhook.rb +311 -0
  91. data/lib/sendx-ruby-sdk/models/webhook_object.rb +451 -0
  92. data/lib/sendx-ruby-sdk/models/webhook_request.rb +291 -0
  93. data/lib/sendx-ruby-sdk/models/x_attachment.rb +263 -0
  94. data/lib/sendx-ruby-sdk/models/x_email_message.rb +356 -0
  95. data/lib/sendx-ruby-sdk/models/x_email_response.rb +261 -0
  96. data/lib/sendx-ruby-sdk/models/x_from.rb +246 -0
  97. data/lib/sendx-ruby-sdk/models/x_reply_to.rb +246 -0
  98. data/lib/sendx-ruby-sdk/models/xto.rb +279 -0
  99. data/lib/sendx-ruby-sdk/version.rb +4 -4
  100. data/lib/sendx-ruby-sdk.rb +53 -25
  101. data/spec/api/custom_field_api_spec.rb +98 -0
  102. data/spec/api/email_sending_api_spec.rb +59 -0
  103. data/spec/api/events_api_spec.rb +59 -0
  104. data/spec/api/post_api_spec.rb +97 -0
  105. data/spec/api/post_category_api_spec.rb +95 -0
  106. data/spec/api/post_tag_api_spec.rb +95 -0
  107. data/spec/api/report_api_spec.rb +47 -0
  108. data/spec/api/tag_api_spec.rb +97 -0
  109. data/spec/api/team_member_api_spec.rb +58 -0
  110. data/spec/api/template_api_spec.rb +98 -0
  111. data/spec/api/tracking_api_spec.rb +59 -0
  112. data/spec/api/webhook_api_spec.rb +95 -0
  113. data/spec/models/custom_field_spec.rb +58 -0
  114. data/spec/models/customfield_customfield_id_delete200_response_spec.rb +36 -0
  115. data/spec/models/e_custom_field_spec.rb +64 -0
  116. data/spec/models/error_response_spec.rb +46 -0
  117. data/spec/models/events_revenue_postback_get200_response_spec.rb +42 -0
  118. data/spec/models/events_revenue_postback_get400_response_spec.rb +36 -0
  119. data/spec/models/events_revenue_postback_get500_response_spec.rb +36 -0
  120. data/spec/models/identify_error_response_spec.rb +36 -0
  121. data/spec/models/link_stat_spec.rb +42 -0
  122. data/spec/models/message_response_spec.rb +42 -0
  123. data/spec/models/operation_response_spec.rb +48 -0
  124. data/spec/models/postback_response_spec.rb +42 -0
  125. data/spec/models/rest_e_campaign_spec.rb +154 -0
  126. data/spec/models/rest_e_contact_spec.rb +78 -0
  127. data/spec/models/rest_e_custom_field_spec.rb +52 -0
  128. data/spec/models/rest_e_list_spec.rb +36 -0
  129. data/spec/models/rest_e_post_category_spec.rb +36 -0
  130. data/spec/models/rest_e_post_spec.rb +144 -0
  131. data/spec/models/rest_e_post_tag_spec.rb +36 -0
  132. data/spec/models/rest_e_sender_spec.rb +42 -0
  133. data/spec/models/rest_e_tag_spec.rb +36 -0
  134. data/spec/models/rest_e_template_spec.rb +66 -0
  135. data/spec/models/rest_e_webhook_spec.rb +84 -0
  136. data/spec/models/rest_r_campaign_spec.rb +178 -0
  137. data/spec/models/rest_r_contact_spec.rb +150 -0
  138. data/spec/models/rest_r_custom_field_spec.rb +58 -0
  139. data/spec/models/rest_r_list_spec.rb +64 -0
  140. data/spec/models/rest_r_member_spec.rb +72 -0
  141. data/spec/models/rest_r_post_category_spec.rb +54 -0
  142. data/spec/models/rest_r_post_spec.rb +144 -0
  143. data/spec/models/rest_r_post_tag_spec.rb +54 -0
  144. data/spec/models/rest_r_sender_spec.rb +54 -0
  145. data/spec/models/rest_r_tag_spec.rb +54 -0
  146. data/spec/models/rest_r_template_spec.rb +94 -0
  147. data/spec/models/rest_r_webhook_spec.rb +90 -0
  148. data/spec/models/rest_report_data_spec.rb +90 -0
  149. data/spec/models/template_email_message_spec.rb +72 -0
  150. data/spec/models/webhook_object_spec.rb +180 -0
  151. data/spec/models/webhook_request_spec.rb +78 -0
  152. data/spec/models/webhook_spec.rb +90 -0
  153. data/spec/models/x_attachment_spec.rb +42 -0
  154. data/spec/models/x_email_message_spec.rb +90 -0
  155. data/spec/models/x_email_response_spec.rb +60 -0
  156. data/spec/models/x_from_spec.rb +42 -0
  157. data/spec/models/x_reply_to_spec.rb +42 -0
  158. data/spec/models/xto_spec.rb +60 -0
  159. data/spec/spec_helper.rb +3 -3
  160. metadata +202 -28
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #SendX REST API
3
3
 
4
- ## Introduction SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations. The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br>
4
+ ## Introduction The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br> Our API endpoint looks like this:<br> ``` https://api.sendx.io/api/v1/rest ``` [<img src=\"https://run.pstmn.io/button.svg\" alt=\"Run In Postman\" style=\"width: 128px; height: 32px;\">](https://god.gw.postman.com/run-collection/33476323-44b198b0-5219-4619-a01f-cfc24d573885?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D33476323-44b198b0-5219-4619-a01f-cfc24d573885%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e) ## Authentication The SendX API uses API key to authenticate requests.<br> You can checkout your API key from your settings page https://app.sendx.io/setting under the section `Team Api Key`. SendX expects the API key to be included in all API requests to the server in a header that looks like the following: ``` X-Team-ApiKey: AHEZEP8192SEGH ``` Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail. ## Errors SendX uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a failed resource search, etc.). Codes in the 5xx range indicate an error with SendX’s servers (drop us a mail at support@sendx.io in case that ever happens). Here's some error codes and what they mean: <table> <tr> <th>Status Code</th> <th>Reason</th> <th>Description</th> </tr> <tr> <td>400</td> <td>Bad Request</td> <td>The request could not be understood by the server due to malformed syntax.</td> </tr> <tr> <td>401</td> <td>Unauthorized</td> <td>The request requires user authentication, e.g., due to missing or invalid authentication token.</td> </tr> <tr> <td>403</td> <td>Forbidden</td> <td>The request is understood, but it has been refused or access is not allowed.</td> </tr> <tr> <td>404</td> <td>Not Found</td> <td>The requested resource could not be found.</td> </tr> <tr> <td>406</td> <td>Not Acceptable</td> <td>The requested format is not supported by the requested method.</td> </tr> <tr> <td>422</td> <td>Unprocessable Entity</td> <td>The server understood the request, but the request is semantically erroneous (e.g., a request may contain a malformed email address).</td> </tr> <tr> <td>500</td> <td>Internal Server Error</td> <td>The server encountered an unexpected condition which prevented it from fulfilling the request.</td> </tr> </table> <br> ## API SDKs We have native SendX SDKs in the following programming languages. You can integrate with them or create your own SDK with our API specification. In case you need any assistance with respect to API then do reachout to our team from website chat or email us at hello@sendx.io <br> For checking language specific Clients: - [Golang](https://github.com/sendx/sendx-go-sdk) - [Python](https://github.com/sendx/sendx-python-sdk) - [Ruby](https://github.com/sendx/sendx-ruby-sdk) - [Java](https://github.com/sendx/sendx-java-sdk) - [PHP](https://github.com/sendx/sendx-php-sdk) - [JavaScript](https://github.com/sendx/sendx-javascript-sdk) We also have a [Javascript API](http://help.sendx.io/knowledge_base/topics/javascript-api-1) for client side integrations. --- ## Schemas The SendX API has resources related to all the major functionalities of SendX. ### Contact The Contact is a fundamental resource within SendX. It represents your customers, leads, or any person you wish to communicate with through your marketing campaigns. Once a contact is added to SendX, you can send personalized marketing campaigns, manage their details, and track their interaction with your marketing activities. SendX provides several key attributes associated with each contact. Additionally, custom fields allow you to add any extra information that may not be covered by the default fields. You can also categorize contacts using tags, and group them into lists for easier targeting in specific campaigns. Below is a detailed overview of the Contact schema. <table> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> <tr> <td>Id</td> <td>string</td> <td>Identifier for the contact. This field is how you can reference the contact in your application.</td> <td>ACNEFOF123R</td> </tr> <tr> <td>FirstName</td> <td>string</td> <td>The first name of the contact.</td> <td>Linus</td> </tr> <tr> <td>LastName</td> <td>string</td> <td>The last name of the contact.</td> <td>Torvalds</td> </tr> <tr> <td>Email</td> <td>string (email)</td> <td>The email address of the contact. This is a mandatory field for the contact, no SendX contact can be created without an email address.</td> <td>linus@example.com</td> </tr> <tr> <td>Company</td> <td>string</td> <td>The company of the contact.</td> <td>Linux Foundation.</td> </tr> <tr> <td>CustomFields</td> <td>object</td> <td>Custom fields and their values. This can be used to store any additional information about the contact. In SendX, this is shown as a map of custom field Id to string. Users can create their own custom fields and associate values for them with the contact.</td> <td>``` { \"124\": \"Developer/Creator\", \"223\": \"28 December 1969\" }```</td> </tr> <tr> <td>Unsubscribed</td> <td>boolean</td> <td>Indicates if the contact has unsubscribed from emails.</td> <td>false</td> </tr> <tr> <td>Bounced</td> <td>boolean</td> <td>Indicates if the contact's email has bounced.</td> <td>false</td> </tr> <tr> <td>Spam</td> <td>boolean</td> <td>Indicates if the contact marked the email as spam.</td> <td>false</td> </tr> <tr> <td>Created</td> <td>string (date-time)</td> <td>The date and time when the contact was created. This is sent in Unix time format.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (date-time)</td> <td>The date and time when the contact was last updated. This is sent in Unix time format.</td> <td>2024-10-08T12:45:00Z</td> </tr> <tr> <td>Blocked</td> <td>boolean</td> <td>Indicates if the contact is blocked from receiving emails.</td> <td>false</td> </tr> <tr> <td>Dropped</td> <td>boolean</td> <td>Indicates if emails to this contact were dropped.</td> <td>false</td> </tr> <tr> <td>LTV</td> <td>integer</td> <td>Lifetime value (LTV) of the contact in currency units.</td> <td>5000</td> </tr> <tr> <td>ContactSource</td> <td>integer</td> <td>The source from which the contact was added. Possible values include: <br> <ol> <li> ContactSourceUnknown</li> <li> ContactSourceFileImport</li> <li> ContactSourceJSAPI</li> <li> ContactSourceRESTAPI</li> <li> ContactSourceManualAddition</li> <li> ContactSourcePopup</li> <li> ContactSourceForm</li> <li> ContactSourceLandingPage</li> <li> ContactSourceInstaPage</li> <li> ContactSourceSamCart</li> <li> ContactSourceWooCommerce</li> <li> ContactSourceStripe</li> <li> ContactSourcePaypal</li> <li> ContactSourceIntercom</li> <li> ContactSourceShopify</li> <li> ContactSourceWebPush</li> <li> ContactSourceConvertBox</li> <li> ContactSourceClickFunnel</li> <li> ContactSourceTeachable</li> <li> ContactSourceWoorise</li> </ol> </td> <td>4</td> </tr> <tr> <td>LastTrackedIp</td> <td>string</td> <td>The last known IP address tracked for the contact.</td> <td>192.168.0.1</td> </tr> <tr> <td>Lists</td> <td>[string]</td> <td>Array of List ids associated with the contact.</td> <td>[\"sendxlist1\",\"sendxlist2\"]</td> </tr> <tr> <td>Tags</td> <td>[string]</td> <td>Array of Tag ids associated with the contact.</td> <td>[\"sendxtag1\",\"sendxtag2\"]</td> </tr> </table> SendX REST API allows users to perform operations on any contact based on it's identifier. Identifier can be either: - Contact ID of the contact - Email of the contact ### List A List in SendX is a collection of contacts, similar to organizing a guest list for an event. Depending on how the list is configured, there are two types of opt-in mechanisms: - Single Opt-in: In this type, contacts are directly added to the list once they provide their email address, just like guests who confirm their attendance without any extra steps. - Double Opt-in: In this type, contacts are sent a confirmation email and must verify their subscription before being fully added to the list. This is like sending a \"Save the Date\" invitation, where the guest needs to RSVP before they’re officially included. These opt-in mechanisms help ensure that your contacts are either instantly subscribed (single opt-in) or confirmed (double opt-in) based on their preference. Lists allow you to group your contacts for targeted and personalized marketing campaigns. <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td>Encrypted identifier for the list.</td> <td>a1b2c3d4e5</td> </tr> <tr> <td>Name</td> <td>string</td> <td>Name of the list.</td> <td>Customer List</td> </tr> <tr> <td>Type</td> <td>integer</td> <td>Type of the list, which can have two values:<br/>0: SingleOptIn <br/>1: DoubleOptIn</td> <td>0</td> </tr> <tr> <td>SendThankYouMail</td> <td>bool</td> <td>Indicates if a thank-you email should be sent after subscription.</td> <td>true</td> </tr> <tr> <td>ThankYouFromName</td> <td>string</td> <td>The name shown as the sender for the thank-you email.</td> <td>Support Team</td> </tr> <tr> <td>ThankYouFromEmail</td> <td>string</td> <td>The email address from which the thank-you email is sent.</td> <td>support@sendx.com</td> </tr> <tr> <td>ThankYouMailSubject</td> <td>string</td> <td>Subject line of the thank-you email.</td> <td>Welcome to our newsletter</td> </tr> <tr> <td>ThankYouMailMessage</td> <td>string</td> <td>Content of the thank-you email.</td> <td>Thank you for subscribing!</td> </tr> <tr> <td>ThankYouSender</td> <td>string</td> <td>Sender id for the thank-you email, if applicable.</td> <td>sender_123</td> </tr> <tr> <td>ConfirmFromName</td> <td>string</td> <td>The name shown as the sender for the confirmation email.</td> <td>Support Team</td> </tr> <tr> <td>ConfirmFromEmail</td> <td>string</td> <td>The email address from which the confirmation email is sent.</td> <td>confirm@company.com</td> </tr> <tr> <td>ConfirmMailSubject</td> <td>string</td> <td>Subject line of the confirmation email.</td> <td>Please confirm your subscription</td> </tr> <tr> <td>ConfirmMailMessage</td> <td>string</td> <td>Content of the confirmation email.</td> <td>Click here to confirm!</td> </tr> <tr> <td>ConfirmSuccessPage</td> <td>string</td> <td>URL of the success page shown after email confirmation.</td> <td>https://company.com/success</td> </tr> <tr> <td>Created</td> <td>string (Date-Time)</td> <td>Timestamp when the list was created.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (Date-Time)</td> <td>Timestamp when the list was last updated.</td> <td>2024-10-08T12:45:00Z</td> </tr> <tr> <td>ConfirmSender</td> <td>string</td> <td>Sender id for the confirmation email, if applicable.</td> <td>sender_313</td> </tr> <tr> <td>IsQuarantined</td> <td>bool</td> <td>Indicates if the list is quarantined. Contact support@sendx.io if you encounter this.</td> <td>false</td> </tr> </tbody> </table> ### Tag A Tag in SendX is a versatile tool that allows you to categorize and organize your contacts based on their behaviors, interests, or other attributes. By adding tags to contacts, you can create powerful filters and segments to target specific audiences in your campaigns. Tags are essential for tracking and understanding your contacts’ journey through your application or business funnel. For instance, if a contact views a product, you can assign a tag like Product X Viewed. Later, you can filter all contacts with this tag to send them personalized follow-up emails or promotional offers. This ability to categorize contacts ensures that your marketing efforts are precise and relevant. In the world of email marketing, tags are not just a tool—they are a key utility for creating personalized experiences, improving open rates, and driving higher engagement. By leveraging tags effectively, you can ensure that your contacts receive the right message at the right time. <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td>Identifier for the tag.</td> <td>a1b2c3d4e5</td> </tr> <tr> <td>Name</td> <td>string</td> <td>Name of the tag.</td> <td>VIP Customers</td> </tr> <tr> <td>Created</td> <td>string (Date-Time)</td> <td>Timestamp when the tag was created.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (Date-Time)</td> <td>Timestamp when the tag was last updated.</td> <td>2024-10-08T12:45:00Z</td> </tr> </tbody> </table> ### Campaigns Campaign is one of the key resources in SendX as an email marketing platform. A campaign allows you to send targeted email messages to specific segments of your audience, helping to engage subscribers, promote products, or share important updates. Why is a Campaign Resource Important? Email campaigns are the cornerstone of email marketing strategies. They help you: - **Engage Customers:** Send relevant content that resonates with the audience. - **Automate Communication:** Schedule and automate emails to reach the right people at the right time. - **Track Performance:** Measure engagement, opens, clicks, and conversions to optimize future campaigns. <br> For example you might create a campaign called \"Holiday Discounts\" where you target customers who have shown interest in your products over the last three months. The campaign could send personalized emails with special discounts for the holiday season, encouraging recipients to take action. The Campaign resource in SendX provides you with a powerful toolset to not only communicate with your audience but also to enhance their experience through targeted, automated, and personalized email strategies. <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td> ID of the campaign</td> <td>campaign123xyz</td> </tr> <tr> <td>name</td> <td>string</td> <td>Name of the campaign</td> <td>New Year Promotion</td> </tr> <tr> <td>trackReply</td> <td>boolean</td> <td>Indicates if replies to the campaign should be tracked</td> <td>false</td> </tr> <tr> <td>status</td> <td>integer</td> <td>Current status of the campaign which can have these possible values: <br>0: Draft <br>1: Scheduled <br>2: Sending <br>3: Sent <br>4: Quarantined</td> <td>Scheduled</td> </tr> <tr> <td>scheduleType</td> <td>integer</td> <td>Type of schedule for the campaign <br>0: Schedule later <br>1: Send Now <br>2. Trigger via automation <br>3. Recurring </td> <td>0</td> </tr> <tr> <td>scheduleCondition</td> <td>string</td> <td>Condition for scheduling the campaign, in case of Send Now this field remains empty.In case of Schedule later, this field denotes the date at which the campaign will be sent in YYYY-MM-DD format</td> <td>2024-12-30</td> </tr> <tr> <td>timeCondition</td> <td>string</td> <td>Condition for scheduling the campaign, in case of Send Now this field remains empty.In case of Schedule later, this field denotes the time at which the campaign will be sent in HH:MM AM/PM format</td> <td>9:00 AM</td> </tr> <tr> <td>timezone</td> <td>string</td> <td>Timezone for the scheduled send. See `allowed timezones` for the list of allowed timezones</td> <td>America/New_York</td> </tr> <tr> <td>preferredTimeCondition</td> <td>string</td> <td>Preferred time condition for the campaign</td> <td>Send during work hours</td> </tr> <tr> <td>preferredTimezone</td> <td>string</td> <td>Preferred timezone for sending the campaign</td> <td>America/Los_Angeles</td> </tr> <tr> <td>strategy</td> <td>string</td> <td>Strategy for the campaign</td> <td>Batch sending</td> </tr> <tr> <td>sendInContactsTimezone</td> <td>boolean</td> <td>Indicates if the campaign should be sent in the recipient's timezone</td> <td>true</td> </tr> <tr> <td>smartSend</td> <td>boolean</td> <td>Indicates if smart sending should be used</td> <td>false</td> </tr> <tr> <td>isArchived</td> <td>boolean</td> <td>Indicates if the campaign is archived</td> <td>false</td> </tr> <tr> <td>sender</td> <td>string</td> <td>Unique identifier of the sender of the campaign</td> <td>sender_123</td> </tr> <tr> <td>campaignScreenshotUrl</td> <td>string</td> <td>URL of the campaign's screenshot</td> <td>https://example.com/screenshot.png</td> </tr> <tr> <td>includedSegments </td> <td>array</td> <td>List of segment IDs that are included in the campaign as receivers</td> <td>[\"segment_123\", \"segment_456\"]</td> </tr> <tr> <td>includedTags </td> <td>array</td> <td>List of tag IDs that are included in the campaign as receivers</td> <td>[\"tag_123\", \"tag_456\"]</td> </tr> <tr> <td>includedLists </td> <td>array</td> <td>List of list IDs that are included in the campaign as receivers</td> <td>[\"list_123\", \"list_456\"]</td> </tr> <tr> <td>excludedSegments </td> <td>array</td> <td>List of segment IDs that are excluded from the campaign as receivers</td> <td>[\"segment_123\", \"segment_456\"]</td> </tr> <tr> <td>excludedTags </td> <td>array</td> <td>List of tag IDs that are excluded from the campaign as receivers</td> <td>[\"tag_123\", \"tag_456\"]</td> </tr> <tr> <td>excludedLists </td> <td>array</td> <td>List of list IDs that are excluded from the campaign as receivers</td> <td>[\"list_123\", \"list_456\"]</td> </tr> </tbody> </table> Note: Here's a list of all the allowed timezones for the `timezone` field: # JavaScript API SendX Javascript API enables you to add contacts, associate tags with them and update custom fields. This guide details various functions associated with our Javascript API. - Installing Javascript Snippet - Sending API Requests - API Methods ## Installing Javascript Snippet To use SendX Javascript API you need to have SendX snippet installed on your website. Each SendX team account has a unique snippet that can be found under [Settings > Site Code](https://app.sendx.io/setting) Snippet SendX Javascript snippet gets loaded asynchronously and hence it won't affect page load time of your website. ## Sending API Requests All requests follow the same pattern. <br> ```javascript _scq.push([\"methodName\", { key: \"value\", ... }]); ``` API requests are executed asynchronously so you can safely place them anywhere on the page. The conventions are similar to what **google analytics** API follows. ## API Methods SendX Javascript API has two methods: - Identify - Track ## Identify API Method Identify API Method is used to attach data to a visitor. If a contact is not yet created then we will create the contact. In case contact already exists then we update it. ### Example Request: ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", firstName: \"John\", lastName: \"Doe\", birthday: \"1989-03-03\", customFields: { \"Designation\": \"Software Engineer\", \"Age\": \"27\", \"Experience\": \"5\"}, tags: [\"Developer\", \"API Team\"], }]); ``` Note that tags are an array of strings. In case they don't exist previously then API will create them and associate them with the contact. Similarly if a custom field doesn't exist then it is first created and then associated with the contact along-with the corresponding value. In case custom field exists already then we simply update the value of it for the aforementioned contact. Custom Fields are associated with data types and which be created and edited inside the app. If a custom field is not present inside the app and an API call is made containing it, a custom field with type 'string' is created and the value set. For custom fields with data type 'number', values can be added to or subtracted from existing values. This can be done by using \"++\" or \"--\" operator before the number(e.g. \"customField_name\": \"++34\" would increase the value of existing \"customField_name\" in SendX for the contact. If it doesn't already exist, the value '- 34' would be inserted for it). We don't delete any of the properties based on identify call. What this means is that if for the same contact you did two API calls like: ### API Call A ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", firstName: \"John\", birthday: \"1989-03-03\", customFields: { \"Designation\": \"Software Engineer\"}, tags: [\"Developer\"], success: function(){console.log(\"identify call successful\");}, failure: function(){console.log(\"identify failed\");}, }]); ``` ### API Call B ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", customFields: { \"Age\": \"29\"}, tags: [\"API Team\"], success: function(){console.log(\"identify call successful\");}, failure: function(){console.log(\"identify failed\");}, }]); ``` The the final contact will have firstName as John, birthday as 1989-03-03 present. Also both tags Developer and API Team shall be present along with custom fields Designation and Age. Properties: - firstName: type string - lastName: type string - email: type string - newEmail: type string - company: type string - birthday: type string with format YYYY-MM-DD eg: 2016-11-21 - customFields: type map[string]string - tags: type array of string - success: Optional. Callback function which is executed on successful completion of request. - failure: Optional. Callback function which is executed when request fails or timeouts. In case email of an already existing contact needs to be updated then specify current email under email property and updated email under newEmail property. ### Response ```json { \"status\": \"200\", \"message\": \"OK\", \"data\": { \"encryptedTeamId\": \"CLdh9Ig5GLIN1u8gTRvoja\", \"encryptedId\": \"c9QF63nrBenCaAXe660byz\", \"tags\": [ \"API Team\", \"Tech\" ], \"firstName\": \"John\", \"lastName\": \"Doe\", \"email\": \"john.doe@gmail.com\", \"company\": \"\", \"birthday\": \"1989-03-03\", \"customFields\": { \"Age\": \"29\", \"Designation\": \"Software Engineer\" } } } ``` ## Track API Method Track API Method is used to track a contact. You can add or remove tags from a contact using this API. Properties: - addTags: Array of tags to be added to a contacts - removeTags: Array of tags to be removed from a contact - success: Optional. Callback function which is executed on successful completion of request. - failure: Optional. Callback function which is executed when request fails or timeouts. You can have automation rules based on tag addition as well as tag removal and they will get executed. For eg: - On user registration tag start on-boarding drip for him / her. - Account Upgrade tag start add user to paid user list and start account expansion drip. - On removal of trial user tag start up-sell trial completed users drip. ### Example Request: ```javascript _scq.push([\"track\", { \"addTags\": [\"blogger\", \"female\"], success: function(){console.log(\"track call successful\");}, failure: function(){console.log(\"track call failed\");}, }]); _scq.push([\"track\", { \"addTags\": [\"paid user\"], \"removeTags\": [\"trial user\"], success: function(){console.log(\"track call successful\");}, failure: function(){console.log(\"track call failed\");}, }]); ``` ### Response ```json { \"status\": \"200\", \"message\": \"OK\", \"data\": \"success\" } ```
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: support@sendx.io
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.13.0
10
10
 
11
11
  =end
12
12
 
@@ -29,9 +29,14 @@ module SendX
29
29
  }
30
30
  end
31
31
 
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
32
37
  # Returns all the JSON keys this model knows about
33
38
  def self.acceptable_attributes
34
- attribute_map.values
39
+ acceptable_attribute_map.values
35
40
  end
36
41
 
37
42
  # Attribute type mapping.
@@ -56,9 +61,10 @@ module SendX
56
61
  end
57
62
 
58
63
  # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
65
  attributes = attributes.each_with_object({}) { |(k, v), h|
60
- if (!self.class.attribute_map.key?(k.to_sym))
61
- fail ArgumentError, "`#{k}` is not a valid attribute in `SendX::SenderRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SendX::SenderRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
68
  end
63
69
  h[k.to_sym] = v
64
70
  }
@@ -101,6 +107,26 @@ module SendX
101
107
  true
102
108
  end
103
109
 
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] name Value to be assigned
112
+ def name=(name)
113
+ if name.nil?
114
+ fail ArgumentError, 'name cannot be nil'
115
+ end
116
+
117
+ @name = name
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] email Value to be assigned
122
+ def email=(email)
123
+ if email.nil?
124
+ fail ArgumentError, 'email cannot be nil'
125
+ end
126
+
127
+ @email = email
128
+ end
129
+
104
130
  # Checks equality by comparing each attribute.
105
131
  # @param [Object] Object to be compared
106
132
  def ==(o)
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #SendX REST API
3
3
 
4
- ## Introduction SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations. The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br>
4
+ ## Introduction The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br> Our API endpoint looks like this:<br> ``` https://api.sendx.io/api/v1/rest ``` [<img src=\"https://run.pstmn.io/button.svg\" alt=\"Run In Postman\" style=\"width: 128px; height: 32px;\">](https://god.gw.postman.com/run-collection/33476323-44b198b0-5219-4619-a01f-cfc24d573885?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D33476323-44b198b0-5219-4619-a01f-cfc24d573885%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e) ## Authentication The SendX API uses API key to authenticate requests.<br> You can checkout your API key from your settings page https://app.sendx.io/setting under the section `Team Api Key`. SendX expects the API key to be included in all API requests to the server in a header that looks like the following: ``` X-Team-ApiKey: AHEZEP8192SEGH ``` Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail. ## Errors SendX uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a failed resource search, etc.). Codes in the 5xx range indicate an error with SendX’s servers (drop us a mail at support@sendx.io in case that ever happens). Here's some error codes and what they mean: <table> <tr> <th>Status Code</th> <th>Reason</th> <th>Description</th> </tr> <tr> <td>400</td> <td>Bad Request</td> <td>The request could not be understood by the server due to malformed syntax.</td> </tr> <tr> <td>401</td> <td>Unauthorized</td> <td>The request requires user authentication, e.g., due to missing or invalid authentication token.</td> </tr> <tr> <td>403</td> <td>Forbidden</td> <td>The request is understood, but it has been refused or access is not allowed.</td> </tr> <tr> <td>404</td> <td>Not Found</td> <td>The requested resource could not be found.</td> </tr> <tr> <td>406</td> <td>Not Acceptable</td> <td>The requested format is not supported by the requested method.</td> </tr> <tr> <td>422</td> <td>Unprocessable Entity</td> <td>The server understood the request, but the request is semantically erroneous (e.g., a request may contain a malformed email address).</td> </tr> <tr> <td>500</td> <td>Internal Server Error</td> <td>The server encountered an unexpected condition which prevented it from fulfilling the request.</td> </tr> </table> <br> ## API SDKs We have native SendX SDKs in the following programming languages. You can integrate with them or create your own SDK with our API specification. In case you need any assistance with respect to API then do reachout to our team from website chat or email us at hello@sendx.io <br> For checking language specific Clients: - [Golang](https://github.com/sendx/sendx-go-sdk) - [Python](https://github.com/sendx/sendx-python-sdk) - [Ruby](https://github.com/sendx/sendx-ruby-sdk) - [Java](https://github.com/sendx/sendx-java-sdk) - [PHP](https://github.com/sendx/sendx-php-sdk) - [JavaScript](https://github.com/sendx/sendx-javascript-sdk) We also have a [Javascript API](http://help.sendx.io/knowledge_base/topics/javascript-api-1) for client side integrations. --- ## Schemas The SendX API has resources related to all the major functionalities of SendX. ### Contact The Contact is a fundamental resource within SendX. It represents your customers, leads, or any person you wish to communicate with through your marketing campaigns. Once a contact is added to SendX, you can send personalized marketing campaigns, manage their details, and track their interaction with your marketing activities. SendX provides several key attributes associated with each contact. Additionally, custom fields allow you to add any extra information that may not be covered by the default fields. You can also categorize contacts using tags, and group them into lists for easier targeting in specific campaigns. Below is a detailed overview of the Contact schema. <table> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> <tr> <td>Id</td> <td>string</td> <td>Identifier for the contact. This field is how you can reference the contact in your application.</td> <td>ACNEFOF123R</td> </tr> <tr> <td>FirstName</td> <td>string</td> <td>The first name of the contact.</td> <td>Linus</td> </tr> <tr> <td>LastName</td> <td>string</td> <td>The last name of the contact.</td> <td>Torvalds</td> </tr> <tr> <td>Email</td> <td>string (email)</td> <td>The email address of the contact. This is a mandatory field for the contact, no SendX contact can be created without an email address.</td> <td>linus@example.com</td> </tr> <tr> <td>Company</td> <td>string</td> <td>The company of the contact.</td> <td>Linux Foundation.</td> </tr> <tr> <td>CustomFields</td> <td>object</td> <td>Custom fields and their values. This can be used to store any additional information about the contact. In SendX, this is shown as a map of custom field Id to string. Users can create their own custom fields and associate values for them with the contact.</td> <td>``` { \"124\": \"Developer/Creator\", \"223\": \"28 December 1969\" }```</td> </tr> <tr> <td>Unsubscribed</td> <td>boolean</td> <td>Indicates if the contact has unsubscribed from emails.</td> <td>false</td> </tr> <tr> <td>Bounced</td> <td>boolean</td> <td>Indicates if the contact's email has bounced.</td> <td>false</td> </tr> <tr> <td>Spam</td> <td>boolean</td> <td>Indicates if the contact marked the email as spam.</td> <td>false</td> </tr> <tr> <td>Created</td> <td>string (date-time)</td> <td>The date and time when the contact was created. This is sent in Unix time format.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (date-time)</td> <td>The date and time when the contact was last updated. This is sent in Unix time format.</td> <td>2024-10-08T12:45:00Z</td> </tr> <tr> <td>Blocked</td> <td>boolean</td> <td>Indicates if the contact is blocked from receiving emails.</td> <td>false</td> </tr> <tr> <td>Dropped</td> <td>boolean</td> <td>Indicates if emails to this contact were dropped.</td> <td>false</td> </tr> <tr> <td>LTV</td> <td>integer</td> <td>Lifetime value (LTV) of the contact in currency units.</td> <td>5000</td> </tr> <tr> <td>ContactSource</td> <td>integer</td> <td>The source from which the contact was added. Possible values include: <br> <ol> <li> ContactSourceUnknown</li> <li> ContactSourceFileImport</li> <li> ContactSourceJSAPI</li> <li> ContactSourceRESTAPI</li> <li> ContactSourceManualAddition</li> <li> ContactSourcePopup</li> <li> ContactSourceForm</li> <li> ContactSourceLandingPage</li> <li> ContactSourceInstaPage</li> <li> ContactSourceSamCart</li> <li> ContactSourceWooCommerce</li> <li> ContactSourceStripe</li> <li> ContactSourcePaypal</li> <li> ContactSourceIntercom</li> <li> ContactSourceShopify</li> <li> ContactSourceWebPush</li> <li> ContactSourceConvertBox</li> <li> ContactSourceClickFunnel</li> <li> ContactSourceTeachable</li> <li> ContactSourceWoorise</li> </ol> </td> <td>4</td> </tr> <tr> <td>LastTrackedIp</td> <td>string</td> <td>The last known IP address tracked for the contact.</td> <td>192.168.0.1</td> </tr> <tr> <td>Lists</td> <td>[string]</td> <td>Array of List ids associated with the contact.</td> <td>[\"sendxlist1\",\"sendxlist2\"]</td> </tr> <tr> <td>Tags</td> <td>[string]</td> <td>Array of Tag ids associated with the contact.</td> <td>[\"sendxtag1\",\"sendxtag2\"]</td> </tr> </table> SendX REST API allows users to perform operations on any contact based on it's identifier. Identifier can be either: - Contact ID of the contact - Email of the contact ### List A List in SendX is a collection of contacts, similar to organizing a guest list for an event. Depending on how the list is configured, there are two types of opt-in mechanisms: - Single Opt-in: In this type, contacts are directly added to the list once they provide their email address, just like guests who confirm their attendance without any extra steps. - Double Opt-in: In this type, contacts are sent a confirmation email and must verify their subscription before being fully added to the list. This is like sending a \"Save the Date\" invitation, where the guest needs to RSVP before they’re officially included. These opt-in mechanisms help ensure that your contacts are either instantly subscribed (single opt-in) or confirmed (double opt-in) based on their preference. Lists allow you to group your contacts for targeted and personalized marketing campaigns. <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td>Encrypted identifier for the list.</td> <td>a1b2c3d4e5</td> </tr> <tr> <td>Name</td> <td>string</td> <td>Name of the list.</td> <td>Customer List</td> </tr> <tr> <td>Type</td> <td>integer</td> <td>Type of the list, which can have two values:<br/>0: SingleOptIn <br/>1: DoubleOptIn</td> <td>0</td> </tr> <tr> <td>SendThankYouMail</td> <td>bool</td> <td>Indicates if a thank-you email should be sent after subscription.</td> <td>true</td> </tr> <tr> <td>ThankYouFromName</td> <td>string</td> <td>The name shown as the sender for the thank-you email.</td> <td>Support Team</td> </tr> <tr> <td>ThankYouFromEmail</td> <td>string</td> <td>The email address from which the thank-you email is sent.</td> <td>support@sendx.com</td> </tr> <tr> <td>ThankYouMailSubject</td> <td>string</td> <td>Subject line of the thank-you email.</td> <td>Welcome to our newsletter</td> </tr> <tr> <td>ThankYouMailMessage</td> <td>string</td> <td>Content of the thank-you email.</td> <td>Thank you for subscribing!</td> </tr> <tr> <td>ThankYouSender</td> <td>string</td> <td>Sender id for the thank-you email, if applicable.</td> <td>sender_123</td> </tr> <tr> <td>ConfirmFromName</td> <td>string</td> <td>The name shown as the sender for the confirmation email.</td> <td>Support Team</td> </tr> <tr> <td>ConfirmFromEmail</td> <td>string</td> <td>The email address from which the confirmation email is sent.</td> <td>confirm@company.com</td> </tr> <tr> <td>ConfirmMailSubject</td> <td>string</td> <td>Subject line of the confirmation email.</td> <td>Please confirm your subscription</td> </tr> <tr> <td>ConfirmMailMessage</td> <td>string</td> <td>Content of the confirmation email.</td> <td>Click here to confirm!</td> </tr> <tr> <td>ConfirmSuccessPage</td> <td>string</td> <td>URL of the success page shown after email confirmation.</td> <td>https://company.com/success</td> </tr> <tr> <td>Created</td> <td>string (Date-Time)</td> <td>Timestamp when the list was created.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (Date-Time)</td> <td>Timestamp when the list was last updated.</td> <td>2024-10-08T12:45:00Z</td> </tr> <tr> <td>ConfirmSender</td> <td>string</td> <td>Sender id for the confirmation email, if applicable.</td> <td>sender_313</td> </tr> <tr> <td>IsQuarantined</td> <td>bool</td> <td>Indicates if the list is quarantined. Contact support@sendx.io if you encounter this.</td> <td>false</td> </tr> </tbody> </table> ### Tag A Tag in SendX is a versatile tool that allows you to categorize and organize your contacts based on their behaviors, interests, or other attributes. By adding tags to contacts, you can create powerful filters and segments to target specific audiences in your campaigns. Tags are essential for tracking and understanding your contacts’ journey through your application or business funnel. For instance, if a contact views a product, you can assign a tag like Product X Viewed. Later, you can filter all contacts with this tag to send them personalized follow-up emails or promotional offers. This ability to categorize contacts ensures that your marketing efforts are precise and relevant. In the world of email marketing, tags are not just a tool—they are a key utility for creating personalized experiences, improving open rates, and driving higher engagement. By leveraging tags effectively, you can ensure that your contacts receive the right message at the right time. <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td>Identifier for the tag.</td> <td>a1b2c3d4e5</td> </tr> <tr> <td>Name</td> <td>string</td> <td>Name of the tag.</td> <td>VIP Customers</td> </tr> <tr> <td>Created</td> <td>string (Date-Time)</td> <td>Timestamp when the tag was created.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (Date-Time)</td> <td>Timestamp when the tag was last updated.</td> <td>2024-10-08T12:45:00Z</td> </tr> </tbody> </table> ### Campaigns Campaign is one of the key resources in SendX as an email marketing platform. A campaign allows you to send targeted email messages to specific segments of your audience, helping to engage subscribers, promote products, or share important updates. Why is a Campaign Resource Important? Email campaigns are the cornerstone of email marketing strategies. They help you: - **Engage Customers:** Send relevant content that resonates with the audience. - **Automate Communication:** Schedule and automate emails to reach the right people at the right time. - **Track Performance:** Measure engagement, opens, clicks, and conversions to optimize future campaigns. <br> For example you might create a campaign called \"Holiday Discounts\" where you target customers who have shown interest in your products over the last three months. The campaign could send personalized emails with special discounts for the holiday season, encouraging recipients to take action. The Campaign resource in SendX provides you with a powerful toolset to not only communicate with your audience but also to enhance their experience through targeted, automated, and personalized email strategies. <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td> ID of the campaign</td> <td>campaign123xyz</td> </tr> <tr> <td>name</td> <td>string</td> <td>Name of the campaign</td> <td>New Year Promotion</td> </tr> <tr> <td>trackReply</td> <td>boolean</td> <td>Indicates if replies to the campaign should be tracked</td> <td>false</td> </tr> <tr> <td>status</td> <td>integer</td> <td>Current status of the campaign which can have these possible values: <br>0: Draft <br>1: Scheduled <br>2: Sending <br>3: Sent <br>4: Quarantined</td> <td>Scheduled</td> </tr> <tr> <td>scheduleType</td> <td>integer</td> <td>Type of schedule for the campaign <br>0: Schedule later <br>1: Send Now <br>2. Trigger via automation <br>3. Recurring </td> <td>0</td> </tr> <tr> <td>scheduleCondition</td> <td>string</td> <td>Condition for scheduling the campaign, in case of Send Now this field remains empty.In case of Schedule later, this field denotes the date at which the campaign will be sent in YYYY-MM-DD format</td> <td>2024-12-30</td> </tr> <tr> <td>timeCondition</td> <td>string</td> <td>Condition for scheduling the campaign, in case of Send Now this field remains empty.In case of Schedule later, this field denotes the time at which the campaign will be sent in HH:MM AM/PM format</td> <td>9:00 AM</td> </tr> <tr> <td>timezone</td> <td>string</td> <td>Timezone for the scheduled send. See `allowed timezones` for the list of allowed timezones</td> <td>America/New_York</td> </tr> <tr> <td>preferredTimeCondition</td> <td>string</td> <td>Preferred time condition for the campaign</td> <td>Send during work hours</td> </tr> <tr> <td>preferredTimezone</td> <td>string</td> <td>Preferred timezone for sending the campaign</td> <td>America/Los_Angeles</td> </tr> <tr> <td>strategy</td> <td>string</td> <td>Strategy for the campaign</td> <td>Batch sending</td> </tr> <tr> <td>sendInContactsTimezone</td> <td>boolean</td> <td>Indicates if the campaign should be sent in the recipient's timezone</td> <td>true</td> </tr> <tr> <td>smartSend</td> <td>boolean</td> <td>Indicates if smart sending should be used</td> <td>false</td> </tr> <tr> <td>isArchived</td> <td>boolean</td> <td>Indicates if the campaign is archived</td> <td>false</td> </tr> <tr> <td>sender</td> <td>string</td> <td>Unique identifier of the sender of the campaign</td> <td>sender_123</td> </tr> <tr> <td>campaignScreenshotUrl</td> <td>string</td> <td>URL of the campaign's screenshot</td> <td>https://example.com/screenshot.png</td> </tr> <tr> <td>includedSegments </td> <td>array</td> <td>List of segment IDs that are included in the campaign as receivers</td> <td>[\"segment_123\", \"segment_456\"]</td> </tr> <tr> <td>includedTags </td> <td>array</td> <td>List of tag IDs that are included in the campaign as receivers</td> <td>[\"tag_123\", \"tag_456\"]</td> </tr> <tr> <td>includedLists </td> <td>array</td> <td>List of list IDs that are included in the campaign as receivers</td> <td>[\"list_123\", \"list_456\"]</td> </tr> <tr> <td>excludedSegments </td> <td>array</td> <td>List of segment IDs that are excluded from the campaign as receivers</td> <td>[\"segment_123\", \"segment_456\"]</td> </tr> <tr> <td>excludedTags </td> <td>array</td> <td>List of tag IDs that are excluded from the campaign as receivers</td> <td>[\"tag_123\", \"tag_456\"]</td> </tr> <tr> <td>excludedLists </td> <td>array</td> <td>List of list IDs that are excluded from the campaign as receivers</td> <td>[\"list_123\", \"list_456\"]</td> </tr> </tbody> </table> Note: Here's a list of all the allowed timezones for the `timezone` field: # JavaScript API SendX Javascript API enables you to add contacts, associate tags with them and update custom fields. This guide details various functions associated with our Javascript API. - Installing Javascript Snippet - Sending API Requests - API Methods ## Installing Javascript Snippet To use SendX Javascript API you need to have SendX snippet installed on your website. Each SendX team account has a unique snippet that can be found under [Settings > Site Code](https://app.sendx.io/setting) Snippet SendX Javascript snippet gets loaded asynchronously and hence it won't affect page load time of your website. ## Sending API Requests All requests follow the same pattern. <br> ```javascript _scq.push([\"methodName\", { key: \"value\", ... }]); ``` API requests are executed asynchronously so you can safely place them anywhere on the page. The conventions are similar to what **google analytics** API follows. ## API Methods SendX Javascript API has two methods: - Identify - Track ## Identify API Method Identify API Method is used to attach data to a visitor. If a contact is not yet created then we will create the contact. In case contact already exists then we update it. ### Example Request: ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", firstName: \"John\", lastName: \"Doe\", birthday: \"1989-03-03\", customFields: { \"Designation\": \"Software Engineer\", \"Age\": \"27\", \"Experience\": \"5\"}, tags: [\"Developer\", \"API Team\"], }]); ``` Note that tags are an array of strings. In case they don't exist previously then API will create them and associate them with the contact. Similarly if a custom field doesn't exist then it is first created and then associated with the contact along-with the corresponding value. In case custom field exists already then we simply update the value of it for the aforementioned contact. Custom Fields are associated with data types and which be created and edited inside the app. If a custom field is not present inside the app and an API call is made containing it, a custom field with type 'string' is created and the value set. For custom fields with data type 'number', values can be added to or subtracted from existing values. This can be done by using \"++\" or \"--\" operator before the number(e.g. \"customField_name\": \"++34\" would increase the value of existing \"customField_name\" in SendX for the contact. If it doesn't already exist, the value '- 34' would be inserted for it). We don't delete any of the properties based on identify call. What this means is that if for the same contact you did two API calls like: ### API Call A ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", firstName: \"John\", birthday: \"1989-03-03\", customFields: { \"Designation\": \"Software Engineer\"}, tags: [\"Developer\"], success: function(){console.log(\"identify call successful\");}, failure: function(){console.log(\"identify failed\");}, }]); ``` ### API Call B ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", customFields: { \"Age\": \"29\"}, tags: [\"API Team\"], success: function(){console.log(\"identify call successful\");}, failure: function(){console.log(\"identify failed\");}, }]); ``` The the final contact will have firstName as John, birthday as 1989-03-03 present. Also both tags Developer and API Team shall be present along with custom fields Designation and Age. Properties: - firstName: type string - lastName: type string - email: type string - newEmail: type string - company: type string - birthday: type string with format YYYY-MM-DD eg: 2016-11-21 - customFields: type map[string]string - tags: type array of string - success: Optional. Callback function which is executed on successful completion of request. - failure: Optional. Callback function which is executed when request fails or timeouts. In case email of an already existing contact needs to be updated then specify current email under email property and updated email under newEmail property. ### Response ```json { \"status\": \"200\", \"message\": \"OK\", \"data\": { \"encryptedTeamId\": \"CLdh9Ig5GLIN1u8gTRvoja\", \"encryptedId\": \"c9QF63nrBenCaAXe660byz\", \"tags\": [ \"API Team\", \"Tech\" ], \"firstName\": \"John\", \"lastName\": \"Doe\", \"email\": \"john.doe@gmail.com\", \"company\": \"\", \"birthday\": \"1989-03-03\", \"customFields\": { \"Age\": \"29\", \"Designation\": \"Software Engineer\" } } } ``` ## Track API Method Track API Method is used to track a contact. You can add or remove tags from a contact using this API. Properties: - addTags: Array of tags to be added to a contacts - removeTags: Array of tags to be removed from a contact - success: Optional. Callback function which is executed on successful completion of request. - failure: Optional. Callback function which is executed when request fails or timeouts. You can have automation rules based on tag addition as well as tag removal and they will get executed. For eg: - On user registration tag start on-boarding drip for him / her. - Account Upgrade tag start add user to paid user list and start account expansion drip. - On removal of trial user tag start up-sell trial completed users drip. ### Example Request: ```javascript _scq.push([\"track\", { \"addTags\": [\"blogger\", \"female\"], success: function(){console.log(\"track call successful\");}, failure: function(){console.log(\"track call failed\");}, }]); _scq.push([\"track\", { \"addTags\": [\"paid user\"], \"removeTags\": [\"trial user\"], success: function(){console.log(\"track call successful\");}, failure: function(){console.log(\"track call failed\");}, }]); ``` ### Response ```json { \"status\": \"200\", \"message\": \"OK\", \"data\": \"success\" } ```
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: support@sendx.io
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.13.0
10
10
 
11
11
  =end
12
12
 
@@ -37,9 +37,14 @@ module SendX
37
37
  }
38
38
  end
39
39
 
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
40
45
  # Returns all the JSON keys this model knows about
41
46
  def self.acceptable_attributes
42
- attribute_map.values
47
+ acceptable_attribute_map.values
43
48
  end
44
49
 
45
50
  # Attribute type mapping.
@@ -66,9 +71,10 @@ module SendX
66
71
  end
67
72
 
68
73
  # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
69
75
  attributes = attributes.each_with_object({}) { |(k, v), h|
70
- if (!self.class.attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `SendX::SenderResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SendX::SenderResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
72
78
  end
73
79
  h[k.to_sym] = v
74
80
  }
@@ -133,6 +139,46 @@ module SendX
133
139
  true
134
140
  end
135
141
 
142
+ # Custom attribute writer method with validation
143
+ # @param [Object] id Value to be assigned
144
+ def id=(id)
145
+ if id.nil?
146
+ fail ArgumentError, 'id cannot be nil'
147
+ end
148
+
149
+ @id = id
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] name Value to be assigned
154
+ def name=(name)
155
+ if name.nil?
156
+ fail ArgumentError, 'name cannot be nil'
157
+ end
158
+
159
+ @name = name
160
+ end
161
+
162
+ # Custom attribute writer method with validation
163
+ # @param [Object] email Value to be assigned
164
+ def email=(email)
165
+ if email.nil?
166
+ fail ArgumentError, 'email cannot be nil'
167
+ end
168
+
169
+ @email = email
170
+ end
171
+
172
+ # Custom attribute writer method with validation
173
+ # @param [Object] is_whitelisted Value to be assigned
174
+ def is_whitelisted=(is_whitelisted)
175
+ if is_whitelisted.nil?
176
+ fail ArgumentError, 'is_whitelisted cannot be nil'
177
+ end
178
+
179
+ @is_whitelisted = is_whitelisted
180
+ end
181
+
136
182
  # Checks equality by comparing each attribute.
137
183
  # @param [Object] Object to be compared
138
184
  def ==(o)
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #SendX REST API
3
3
 
4
- ## Introduction SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations. The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br>
4
+ ## Introduction The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br> Our API endpoint looks like this:<br> ``` https://api.sendx.io/api/v1/rest ``` [<img src=\"https://run.pstmn.io/button.svg\" alt=\"Run In Postman\" style=\"width: 128px; height: 32px;\">](https://god.gw.postman.com/run-collection/33476323-44b198b0-5219-4619-a01f-cfc24d573885?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D33476323-44b198b0-5219-4619-a01f-cfc24d573885%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e) ## Authentication The SendX API uses API key to authenticate requests.<br> You can checkout your API key from your settings page https://app.sendx.io/setting under the section `Team Api Key`. SendX expects the API key to be included in all API requests to the server in a header that looks like the following: ``` X-Team-ApiKey: AHEZEP8192SEGH ``` Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail. ## Errors SendX uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a failed resource search, etc.). Codes in the 5xx range indicate an error with SendX’s servers (drop us a mail at support@sendx.io in case that ever happens). Here's some error codes and what they mean: <table> <tr> <th>Status Code</th> <th>Reason</th> <th>Description</th> </tr> <tr> <td>400</td> <td>Bad Request</td> <td>The request could not be understood by the server due to malformed syntax.</td> </tr> <tr> <td>401</td> <td>Unauthorized</td> <td>The request requires user authentication, e.g., due to missing or invalid authentication token.</td> </tr> <tr> <td>403</td> <td>Forbidden</td> <td>The request is understood, but it has been refused or access is not allowed.</td> </tr> <tr> <td>404</td> <td>Not Found</td> <td>The requested resource could not be found.</td> </tr> <tr> <td>406</td> <td>Not Acceptable</td> <td>The requested format is not supported by the requested method.</td> </tr> <tr> <td>422</td> <td>Unprocessable Entity</td> <td>The server understood the request, but the request is semantically erroneous (e.g., a request may contain a malformed email address).</td> </tr> <tr> <td>500</td> <td>Internal Server Error</td> <td>The server encountered an unexpected condition which prevented it from fulfilling the request.</td> </tr> </table> <br> ## API SDKs We have native SendX SDKs in the following programming languages. You can integrate with them or create your own SDK with our API specification. In case you need any assistance with respect to API then do reachout to our team from website chat or email us at hello@sendx.io <br> For checking language specific Clients: - [Golang](https://github.com/sendx/sendx-go-sdk) - [Python](https://github.com/sendx/sendx-python-sdk) - [Ruby](https://github.com/sendx/sendx-ruby-sdk) - [Java](https://github.com/sendx/sendx-java-sdk) - [PHP](https://github.com/sendx/sendx-php-sdk) - [JavaScript](https://github.com/sendx/sendx-javascript-sdk) We also have a [Javascript API](http://help.sendx.io/knowledge_base/topics/javascript-api-1) for client side integrations. --- ## Schemas The SendX API has resources related to all the major functionalities of SendX. ### Contact The Contact is a fundamental resource within SendX. It represents your customers, leads, or any person you wish to communicate with through your marketing campaigns. Once a contact is added to SendX, you can send personalized marketing campaigns, manage their details, and track their interaction with your marketing activities. SendX provides several key attributes associated with each contact. Additionally, custom fields allow you to add any extra information that may not be covered by the default fields. You can also categorize contacts using tags, and group them into lists for easier targeting in specific campaigns. Below is a detailed overview of the Contact schema. <table> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> <tr> <td>Id</td> <td>string</td> <td>Identifier for the contact. This field is how you can reference the contact in your application.</td> <td>ACNEFOF123R</td> </tr> <tr> <td>FirstName</td> <td>string</td> <td>The first name of the contact.</td> <td>Linus</td> </tr> <tr> <td>LastName</td> <td>string</td> <td>The last name of the contact.</td> <td>Torvalds</td> </tr> <tr> <td>Email</td> <td>string (email)</td> <td>The email address of the contact. This is a mandatory field for the contact, no SendX contact can be created without an email address.</td> <td>linus@example.com</td> </tr> <tr> <td>Company</td> <td>string</td> <td>The company of the contact.</td> <td>Linux Foundation.</td> </tr> <tr> <td>CustomFields</td> <td>object</td> <td>Custom fields and their values. This can be used to store any additional information about the contact. In SendX, this is shown as a map of custom field Id to string. Users can create their own custom fields and associate values for them with the contact.</td> <td>``` { \"124\": \"Developer/Creator\", \"223\": \"28 December 1969\" }```</td> </tr> <tr> <td>Unsubscribed</td> <td>boolean</td> <td>Indicates if the contact has unsubscribed from emails.</td> <td>false</td> </tr> <tr> <td>Bounced</td> <td>boolean</td> <td>Indicates if the contact's email has bounced.</td> <td>false</td> </tr> <tr> <td>Spam</td> <td>boolean</td> <td>Indicates if the contact marked the email as spam.</td> <td>false</td> </tr> <tr> <td>Created</td> <td>string (date-time)</td> <td>The date and time when the contact was created. This is sent in Unix time format.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (date-time)</td> <td>The date and time when the contact was last updated. This is sent in Unix time format.</td> <td>2024-10-08T12:45:00Z</td> </tr> <tr> <td>Blocked</td> <td>boolean</td> <td>Indicates if the contact is blocked from receiving emails.</td> <td>false</td> </tr> <tr> <td>Dropped</td> <td>boolean</td> <td>Indicates if emails to this contact were dropped.</td> <td>false</td> </tr> <tr> <td>LTV</td> <td>integer</td> <td>Lifetime value (LTV) of the contact in currency units.</td> <td>5000</td> </tr> <tr> <td>ContactSource</td> <td>integer</td> <td>The source from which the contact was added. Possible values include: <br> <ol> <li> ContactSourceUnknown</li> <li> ContactSourceFileImport</li> <li> ContactSourceJSAPI</li> <li> ContactSourceRESTAPI</li> <li> ContactSourceManualAddition</li> <li> ContactSourcePopup</li> <li> ContactSourceForm</li> <li> ContactSourceLandingPage</li> <li> ContactSourceInstaPage</li> <li> ContactSourceSamCart</li> <li> ContactSourceWooCommerce</li> <li> ContactSourceStripe</li> <li> ContactSourcePaypal</li> <li> ContactSourceIntercom</li> <li> ContactSourceShopify</li> <li> ContactSourceWebPush</li> <li> ContactSourceConvertBox</li> <li> ContactSourceClickFunnel</li> <li> ContactSourceTeachable</li> <li> ContactSourceWoorise</li> </ol> </td> <td>4</td> </tr> <tr> <td>LastTrackedIp</td> <td>string</td> <td>The last known IP address tracked for the contact.</td> <td>192.168.0.1</td> </tr> <tr> <td>Lists</td> <td>[string]</td> <td>Array of List ids associated with the contact.</td> <td>[\"sendxlist1\",\"sendxlist2\"]</td> </tr> <tr> <td>Tags</td> <td>[string]</td> <td>Array of Tag ids associated with the contact.</td> <td>[\"sendxtag1\",\"sendxtag2\"]</td> </tr> </table> SendX REST API allows users to perform operations on any contact based on it's identifier. Identifier can be either: - Contact ID of the contact - Email of the contact ### List A List in SendX is a collection of contacts, similar to organizing a guest list for an event. Depending on how the list is configured, there are two types of opt-in mechanisms: - Single Opt-in: In this type, contacts are directly added to the list once they provide their email address, just like guests who confirm their attendance without any extra steps. - Double Opt-in: In this type, contacts are sent a confirmation email and must verify their subscription before being fully added to the list. This is like sending a \"Save the Date\" invitation, where the guest needs to RSVP before they’re officially included. These opt-in mechanisms help ensure that your contacts are either instantly subscribed (single opt-in) or confirmed (double opt-in) based on their preference. Lists allow you to group your contacts for targeted and personalized marketing campaigns. <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td>Encrypted identifier for the list.</td> <td>a1b2c3d4e5</td> </tr> <tr> <td>Name</td> <td>string</td> <td>Name of the list.</td> <td>Customer List</td> </tr> <tr> <td>Type</td> <td>integer</td> <td>Type of the list, which can have two values:<br/>0: SingleOptIn <br/>1: DoubleOptIn</td> <td>0</td> </tr> <tr> <td>SendThankYouMail</td> <td>bool</td> <td>Indicates if a thank-you email should be sent after subscription.</td> <td>true</td> </tr> <tr> <td>ThankYouFromName</td> <td>string</td> <td>The name shown as the sender for the thank-you email.</td> <td>Support Team</td> </tr> <tr> <td>ThankYouFromEmail</td> <td>string</td> <td>The email address from which the thank-you email is sent.</td> <td>support@sendx.com</td> </tr> <tr> <td>ThankYouMailSubject</td> <td>string</td> <td>Subject line of the thank-you email.</td> <td>Welcome to our newsletter</td> </tr> <tr> <td>ThankYouMailMessage</td> <td>string</td> <td>Content of the thank-you email.</td> <td>Thank you for subscribing!</td> </tr> <tr> <td>ThankYouSender</td> <td>string</td> <td>Sender id for the thank-you email, if applicable.</td> <td>sender_123</td> </tr> <tr> <td>ConfirmFromName</td> <td>string</td> <td>The name shown as the sender for the confirmation email.</td> <td>Support Team</td> </tr> <tr> <td>ConfirmFromEmail</td> <td>string</td> <td>The email address from which the confirmation email is sent.</td> <td>confirm@company.com</td> </tr> <tr> <td>ConfirmMailSubject</td> <td>string</td> <td>Subject line of the confirmation email.</td> <td>Please confirm your subscription</td> </tr> <tr> <td>ConfirmMailMessage</td> <td>string</td> <td>Content of the confirmation email.</td> <td>Click here to confirm!</td> </tr> <tr> <td>ConfirmSuccessPage</td> <td>string</td> <td>URL of the success page shown after email confirmation.</td> <td>https://company.com/success</td> </tr> <tr> <td>Created</td> <td>string (Date-Time)</td> <td>Timestamp when the list was created.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (Date-Time)</td> <td>Timestamp when the list was last updated.</td> <td>2024-10-08T12:45:00Z</td> </tr> <tr> <td>ConfirmSender</td> <td>string</td> <td>Sender id for the confirmation email, if applicable.</td> <td>sender_313</td> </tr> <tr> <td>IsQuarantined</td> <td>bool</td> <td>Indicates if the list is quarantined. Contact support@sendx.io if you encounter this.</td> <td>false</td> </tr> </tbody> </table> ### Tag A Tag in SendX is a versatile tool that allows you to categorize and organize your contacts based on their behaviors, interests, or other attributes. By adding tags to contacts, you can create powerful filters and segments to target specific audiences in your campaigns. Tags are essential for tracking and understanding your contacts’ journey through your application or business funnel. For instance, if a contact views a product, you can assign a tag like Product X Viewed. Later, you can filter all contacts with this tag to send them personalized follow-up emails or promotional offers. This ability to categorize contacts ensures that your marketing efforts are precise and relevant. In the world of email marketing, tags are not just a tool—they are a key utility for creating personalized experiences, improving open rates, and driving higher engagement. By leveraging tags effectively, you can ensure that your contacts receive the right message at the right time. <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td>Identifier for the tag.</td> <td>a1b2c3d4e5</td> </tr> <tr> <td>Name</td> <td>string</td> <td>Name of the tag.</td> <td>VIP Customers</td> </tr> <tr> <td>Created</td> <td>string (Date-Time)</td> <td>Timestamp when the tag was created.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (Date-Time)</td> <td>Timestamp when the tag was last updated.</td> <td>2024-10-08T12:45:00Z</td> </tr> </tbody> </table> ### Campaigns Campaign is one of the key resources in SendX as an email marketing platform. A campaign allows you to send targeted email messages to specific segments of your audience, helping to engage subscribers, promote products, or share important updates. Why is a Campaign Resource Important? Email campaigns are the cornerstone of email marketing strategies. They help you: - **Engage Customers:** Send relevant content that resonates with the audience. - **Automate Communication:** Schedule and automate emails to reach the right people at the right time. - **Track Performance:** Measure engagement, opens, clicks, and conversions to optimize future campaigns. <br> For example you might create a campaign called \"Holiday Discounts\" where you target customers who have shown interest in your products over the last three months. The campaign could send personalized emails with special discounts for the holiday season, encouraging recipients to take action. The Campaign resource in SendX provides you with a powerful toolset to not only communicate with your audience but also to enhance their experience through targeted, automated, and personalized email strategies. <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td> ID of the campaign</td> <td>campaign123xyz</td> </tr> <tr> <td>name</td> <td>string</td> <td>Name of the campaign</td> <td>New Year Promotion</td> </tr> <tr> <td>trackReply</td> <td>boolean</td> <td>Indicates if replies to the campaign should be tracked</td> <td>false</td> </tr> <tr> <td>status</td> <td>integer</td> <td>Current status of the campaign which can have these possible values: <br>0: Draft <br>1: Scheduled <br>2: Sending <br>3: Sent <br>4: Quarantined</td> <td>Scheduled</td> </tr> <tr> <td>scheduleType</td> <td>integer</td> <td>Type of schedule for the campaign <br>0: Schedule later <br>1: Send Now <br>2. Trigger via automation <br>3. Recurring </td> <td>0</td> </tr> <tr> <td>scheduleCondition</td> <td>string</td> <td>Condition for scheduling the campaign, in case of Send Now this field remains empty.In case of Schedule later, this field denotes the date at which the campaign will be sent in YYYY-MM-DD format</td> <td>2024-12-30</td> </tr> <tr> <td>timeCondition</td> <td>string</td> <td>Condition for scheduling the campaign, in case of Send Now this field remains empty.In case of Schedule later, this field denotes the time at which the campaign will be sent in HH:MM AM/PM format</td> <td>9:00 AM</td> </tr> <tr> <td>timezone</td> <td>string</td> <td>Timezone for the scheduled send. See `allowed timezones` for the list of allowed timezones</td> <td>America/New_York</td> </tr> <tr> <td>preferredTimeCondition</td> <td>string</td> <td>Preferred time condition for the campaign</td> <td>Send during work hours</td> </tr> <tr> <td>preferredTimezone</td> <td>string</td> <td>Preferred timezone for sending the campaign</td> <td>America/Los_Angeles</td> </tr> <tr> <td>strategy</td> <td>string</td> <td>Strategy for the campaign</td> <td>Batch sending</td> </tr> <tr> <td>sendInContactsTimezone</td> <td>boolean</td> <td>Indicates if the campaign should be sent in the recipient's timezone</td> <td>true</td> </tr> <tr> <td>smartSend</td> <td>boolean</td> <td>Indicates if smart sending should be used</td> <td>false</td> </tr> <tr> <td>isArchived</td> <td>boolean</td> <td>Indicates if the campaign is archived</td> <td>false</td> </tr> <tr> <td>sender</td> <td>string</td> <td>Unique identifier of the sender of the campaign</td> <td>sender_123</td> </tr> <tr> <td>campaignScreenshotUrl</td> <td>string</td> <td>URL of the campaign's screenshot</td> <td>https://example.com/screenshot.png</td> </tr> <tr> <td>includedSegments </td> <td>array</td> <td>List of segment IDs that are included in the campaign as receivers</td> <td>[\"segment_123\", \"segment_456\"]</td> </tr> <tr> <td>includedTags </td> <td>array</td> <td>List of tag IDs that are included in the campaign as receivers</td> <td>[\"tag_123\", \"tag_456\"]</td> </tr> <tr> <td>includedLists </td> <td>array</td> <td>List of list IDs that are included in the campaign as receivers</td> <td>[\"list_123\", \"list_456\"]</td> </tr> <tr> <td>excludedSegments </td> <td>array</td> <td>List of segment IDs that are excluded from the campaign as receivers</td> <td>[\"segment_123\", \"segment_456\"]</td> </tr> <tr> <td>excludedTags </td> <td>array</td> <td>List of tag IDs that are excluded from the campaign as receivers</td> <td>[\"tag_123\", \"tag_456\"]</td> </tr> <tr> <td>excludedLists </td> <td>array</td> <td>List of list IDs that are excluded from the campaign as receivers</td> <td>[\"list_123\", \"list_456\"]</td> </tr> </tbody> </table> Note: Here's a list of all the allowed timezones for the `timezone` field: # JavaScript API SendX Javascript API enables you to add contacts, associate tags with them and update custom fields. This guide details various functions associated with our Javascript API. - Installing Javascript Snippet - Sending API Requests - API Methods ## Installing Javascript Snippet To use SendX Javascript API you need to have SendX snippet installed on your website. Each SendX team account has a unique snippet that can be found under [Settings > Site Code](https://app.sendx.io/setting) Snippet SendX Javascript snippet gets loaded asynchronously and hence it won't affect page load time of your website. ## Sending API Requests All requests follow the same pattern. <br> ```javascript _scq.push([\"methodName\", { key: \"value\", ... }]); ``` API requests are executed asynchronously so you can safely place them anywhere on the page. The conventions are similar to what **google analytics** API follows. ## API Methods SendX Javascript API has two methods: - Identify - Track ## Identify API Method Identify API Method is used to attach data to a visitor. If a contact is not yet created then we will create the contact. In case contact already exists then we update it. ### Example Request: ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", firstName: \"John\", lastName: \"Doe\", birthday: \"1989-03-03\", customFields: { \"Designation\": \"Software Engineer\", \"Age\": \"27\", \"Experience\": \"5\"}, tags: [\"Developer\", \"API Team\"], }]); ``` Note that tags are an array of strings. In case they don't exist previously then API will create them and associate them with the contact. Similarly if a custom field doesn't exist then it is first created and then associated with the contact along-with the corresponding value. In case custom field exists already then we simply update the value of it for the aforementioned contact. Custom Fields are associated with data types and which be created and edited inside the app. If a custom field is not present inside the app and an API call is made containing it, a custom field with type 'string' is created and the value set. For custom fields with data type 'number', values can be added to or subtracted from existing values. This can be done by using \"++\" or \"--\" operator before the number(e.g. \"customField_name\": \"++34\" would increase the value of existing \"customField_name\" in SendX for the contact. If it doesn't already exist, the value '- 34' would be inserted for it). We don't delete any of the properties based on identify call. What this means is that if for the same contact you did two API calls like: ### API Call A ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", firstName: \"John\", birthday: \"1989-03-03\", customFields: { \"Designation\": \"Software Engineer\"}, tags: [\"Developer\"], success: function(){console.log(\"identify call successful\");}, failure: function(){console.log(\"identify failed\");}, }]); ``` ### API Call B ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", customFields: { \"Age\": \"29\"}, tags: [\"API Team\"], success: function(){console.log(\"identify call successful\");}, failure: function(){console.log(\"identify failed\");}, }]); ``` The the final contact will have firstName as John, birthday as 1989-03-03 present. Also both tags Developer and API Team shall be present along with custom fields Designation and Age. Properties: - firstName: type string - lastName: type string - email: type string - newEmail: type string - company: type string - birthday: type string with format YYYY-MM-DD eg: 2016-11-21 - customFields: type map[string]string - tags: type array of string - success: Optional. Callback function which is executed on successful completion of request. - failure: Optional. Callback function which is executed when request fails or timeouts. In case email of an already existing contact needs to be updated then specify current email under email property and updated email under newEmail property. ### Response ```json { \"status\": \"200\", \"message\": \"OK\", \"data\": { \"encryptedTeamId\": \"CLdh9Ig5GLIN1u8gTRvoja\", \"encryptedId\": \"c9QF63nrBenCaAXe660byz\", \"tags\": [ \"API Team\", \"Tech\" ], \"firstName\": \"John\", \"lastName\": \"Doe\", \"email\": \"john.doe@gmail.com\", \"company\": \"\", \"birthday\": \"1989-03-03\", \"customFields\": { \"Age\": \"29\", \"Designation\": \"Software Engineer\" } } } ``` ## Track API Method Track API Method is used to track a contact. You can add or remove tags from a contact using this API. Properties: - addTags: Array of tags to be added to a contacts - removeTags: Array of tags to be removed from a contact - success: Optional. Callback function which is executed on successful completion of request. - failure: Optional. Callback function which is executed when request fails or timeouts. You can have automation rules based on tag addition as well as tag removal and they will get executed. For eg: - On user registration tag start on-boarding drip for him / her. - Account Upgrade tag start add user to paid user list and start account expansion drip. - On removal of trial user tag start up-sell trial completed users drip. ### Example Request: ```javascript _scq.push([\"track\", { \"addTags\": [\"blogger\", \"female\"], success: function(){console.log(\"track call successful\");}, failure: function(){console.log(\"track call failed\");}, }]); _scq.push([\"track\", { \"addTags\": [\"paid user\"], \"removeTags\": [\"trial user\"], success: function(){console.log(\"track call successful\");}, failure: function(){console.log(\"track call failed\");}, }]); ``` ### Response ```json { \"status\": \"200\", \"message\": \"OK\", \"data\": \"success\" } ```
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: support@sendx.io
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.13.0
10
10
 
11
11
  =end
12
12
 
@@ -33,9 +33,14 @@ module SendX
33
33
  }
34
34
  end
35
35
 
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
36
41
  # Returns all the JSON keys this model knows about
37
42
  def self.acceptable_attributes
38
- attribute_map.values
43
+ acceptable_attribute_map.values
39
44
  end
40
45
 
41
46
  # Attribute type mapping.
@@ -62,9 +67,10 @@ module SendX
62
67
  end
63
68
 
64
69
  # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
71
  attributes = attributes.each_with_object({}) { |(k, v), h|
66
- if (!self.class.attribute_map.key?(k.to_sym))
67
- fail ArgumentError, "`#{k}` is not a valid attribute in `SendX::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SendX::Tag`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
74
  end
69
75
  h[k.to_sym] = v
70
76
  }
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #SendX REST API
3
3
 
4
- ## Introduction SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations. The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br>
4
+ ## Introduction The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br> Our API endpoint looks like this:<br> ``` https://api.sendx.io/api/v1/rest ``` [<img src=\"https://run.pstmn.io/button.svg\" alt=\"Run In Postman\" style=\"width: 128px; height: 32px;\">](https://god.gw.postman.com/run-collection/33476323-44b198b0-5219-4619-a01f-cfc24d573885?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D33476323-44b198b0-5219-4619-a01f-cfc24d573885%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e) ## Authentication The SendX API uses API key to authenticate requests.<br> You can checkout your API key from your settings page https://app.sendx.io/setting under the section `Team Api Key`. SendX expects the API key to be included in all API requests to the server in a header that looks like the following: ``` X-Team-ApiKey: AHEZEP8192SEGH ``` Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail. ## Errors SendX uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a failed resource search, etc.). Codes in the 5xx range indicate an error with SendX’s servers (drop us a mail at support@sendx.io in case that ever happens). Here's some error codes and what they mean: <table> <tr> <th>Status Code</th> <th>Reason</th> <th>Description</th> </tr> <tr> <td>400</td> <td>Bad Request</td> <td>The request could not be understood by the server due to malformed syntax.</td> </tr> <tr> <td>401</td> <td>Unauthorized</td> <td>The request requires user authentication, e.g., due to missing or invalid authentication token.</td> </tr> <tr> <td>403</td> <td>Forbidden</td> <td>The request is understood, but it has been refused or access is not allowed.</td> </tr> <tr> <td>404</td> <td>Not Found</td> <td>The requested resource could not be found.</td> </tr> <tr> <td>406</td> <td>Not Acceptable</td> <td>The requested format is not supported by the requested method.</td> </tr> <tr> <td>422</td> <td>Unprocessable Entity</td> <td>The server understood the request, but the request is semantically erroneous (e.g., a request may contain a malformed email address).</td> </tr> <tr> <td>500</td> <td>Internal Server Error</td> <td>The server encountered an unexpected condition which prevented it from fulfilling the request.</td> </tr> </table> <br> ## API SDKs We have native SendX SDKs in the following programming languages. You can integrate with them or create your own SDK with our API specification. In case you need any assistance with respect to API then do reachout to our team from website chat or email us at hello@sendx.io <br> For checking language specific Clients: - [Golang](https://github.com/sendx/sendx-go-sdk) - [Python](https://github.com/sendx/sendx-python-sdk) - [Ruby](https://github.com/sendx/sendx-ruby-sdk) - [Java](https://github.com/sendx/sendx-java-sdk) - [PHP](https://github.com/sendx/sendx-php-sdk) - [JavaScript](https://github.com/sendx/sendx-javascript-sdk) We also have a [Javascript API](http://help.sendx.io/knowledge_base/topics/javascript-api-1) for client side integrations. --- ## Schemas The SendX API has resources related to all the major functionalities of SendX. ### Contact The Contact is a fundamental resource within SendX. It represents your customers, leads, or any person you wish to communicate with through your marketing campaigns. Once a contact is added to SendX, you can send personalized marketing campaigns, manage their details, and track their interaction with your marketing activities. SendX provides several key attributes associated with each contact. Additionally, custom fields allow you to add any extra information that may not be covered by the default fields. You can also categorize contacts using tags, and group them into lists for easier targeting in specific campaigns. Below is a detailed overview of the Contact schema. <table> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> <tr> <td>Id</td> <td>string</td> <td>Identifier for the contact. This field is how you can reference the contact in your application.</td> <td>ACNEFOF123R</td> </tr> <tr> <td>FirstName</td> <td>string</td> <td>The first name of the contact.</td> <td>Linus</td> </tr> <tr> <td>LastName</td> <td>string</td> <td>The last name of the contact.</td> <td>Torvalds</td> </tr> <tr> <td>Email</td> <td>string (email)</td> <td>The email address of the contact. This is a mandatory field for the contact, no SendX contact can be created without an email address.</td> <td>linus@example.com</td> </tr> <tr> <td>Company</td> <td>string</td> <td>The company of the contact.</td> <td>Linux Foundation.</td> </tr> <tr> <td>CustomFields</td> <td>object</td> <td>Custom fields and their values. This can be used to store any additional information about the contact. In SendX, this is shown as a map of custom field Id to string. Users can create their own custom fields and associate values for them with the contact.</td> <td>``` { \"124\": \"Developer/Creator\", \"223\": \"28 December 1969\" }```</td> </tr> <tr> <td>Unsubscribed</td> <td>boolean</td> <td>Indicates if the contact has unsubscribed from emails.</td> <td>false</td> </tr> <tr> <td>Bounced</td> <td>boolean</td> <td>Indicates if the contact's email has bounced.</td> <td>false</td> </tr> <tr> <td>Spam</td> <td>boolean</td> <td>Indicates if the contact marked the email as spam.</td> <td>false</td> </tr> <tr> <td>Created</td> <td>string (date-time)</td> <td>The date and time when the contact was created. This is sent in Unix time format.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (date-time)</td> <td>The date and time when the contact was last updated. This is sent in Unix time format.</td> <td>2024-10-08T12:45:00Z</td> </tr> <tr> <td>Blocked</td> <td>boolean</td> <td>Indicates if the contact is blocked from receiving emails.</td> <td>false</td> </tr> <tr> <td>Dropped</td> <td>boolean</td> <td>Indicates if emails to this contact were dropped.</td> <td>false</td> </tr> <tr> <td>LTV</td> <td>integer</td> <td>Lifetime value (LTV) of the contact in currency units.</td> <td>5000</td> </tr> <tr> <td>ContactSource</td> <td>integer</td> <td>The source from which the contact was added. Possible values include: <br> <ol> <li> ContactSourceUnknown</li> <li> ContactSourceFileImport</li> <li> ContactSourceJSAPI</li> <li> ContactSourceRESTAPI</li> <li> ContactSourceManualAddition</li> <li> ContactSourcePopup</li> <li> ContactSourceForm</li> <li> ContactSourceLandingPage</li> <li> ContactSourceInstaPage</li> <li> ContactSourceSamCart</li> <li> ContactSourceWooCommerce</li> <li> ContactSourceStripe</li> <li> ContactSourcePaypal</li> <li> ContactSourceIntercom</li> <li> ContactSourceShopify</li> <li> ContactSourceWebPush</li> <li> ContactSourceConvertBox</li> <li> ContactSourceClickFunnel</li> <li> ContactSourceTeachable</li> <li> ContactSourceWoorise</li> </ol> </td> <td>4</td> </tr> <tr> <td>LastTrackedIp</td> <td>string</td> <td>The last known IP address tracked for the contact.</td> <td>192.168.0.1</td> </tr> <tr> <td>Lists</td> <td>[string]</td> <td>Array of List ids associated with the contact.</td> <td>[\"sendxlist1\",\"sendxlist2\"]</td> </tr> <tr> <td>Tags</td> <td>[string]</td> <td>Array of Tag ids associated with the contact.</td> <td>[\"sendxtag1\",\"sendxtag2\"]</td> </tr> </table> SendX REST API allows users to perform operations on any contact based on it's identifier. Identifier can be either: - Contact ID of the contact - Email of the contact ### List A List in SendX is a collection of contacts, similar to organizing a guest list for an event. Depending on how the list is configured, there are two types of opt-in mechanisms: - Single Opt-in: In this type, contacts are directly added to the list once they provide their email address, just like guests who confirm their attendance without any extra steps. - Double Opt-in: In this type, contacts are sent a confirmation email and must verify their subscription before being fully added to the list. This is like sending a \"Save the Date\" invitation, where the guest needs to RSVP before they’re officially included. These opt-in mechanisms help ensure that your contacts are either instantly subscribed (single opt-in) or confirmed (double opt-in) based on their preference. Lists allow you to group your contacts for targeted and personalized marketing campaigns. <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td>Encrypted identifier for the list.</td> <td>a1b2c3d4e5</td> </tr> <tr> <td>Name</td> <td>string</td> <td>Name of the list.</td> <td>Customer List</td> </tr> <tr> <td>Type</td> <td>integer</td> <td>Type of the list, which can have two values:<br/>0: SingleOptIn <br/>1: DoubleOptIn</td> <td>0</td> </tr> <tr> <td>SendThankYouMail</td> <td>bool</td> <td>Indicates if a thank-you email should be sent after subscription.</td> <td>true</td> </tr> <tr> <td>ThankYouFromName</td> <td>string</td> <td>The name shown as the sender for the thank-you email.</td> <td>Support Team</td> </tr> <tr> <td>ThankYouFromEmail</td> <td>string</td> <td>The email address from which the thank-you email is sent.</td> <td>support@sendx.com</td> </tr> <tr> <td>ThankYouMailSubject</td> <td>string</td> <td>Subject line of the thank-you email.</td> <td>Welcome to our newsletter</td> </tr> <tr> <td>ThankYouMailMessage</td> <td>string</td> <td>Content of the thank-you email.</td> <td>Thank you for subscribing!</td> </tr> <tr> <td>ThankYouSender</td> <td>string</td> <td>Sender id for the thank-you email, if applicable.</td> <td>sender_123</td> </tr> <tr> <td>ConfirmFromName</td> <td>string</td> <td>The name shown as the sender for the confirmation email.</td> <td>Support Team</td> </tr> <tr> <td>ConfirmFromEmail</td> <td>string</td> <td>The email address from which the confirmation email is sent.</td> <td>confirm@company.com</td> </tr> <tr> <td>ConfirmMailSubject</td> <td>string</td> <td>Subject line of the confirmation email.</td> <td>Please confirm your subscription</td> </tr> <tr> <td>ConfirmMailMessage</td> <td>string</td> <td>Content of the confirmation email.</td> <td>Click here to confirm!</td> </tr> <tr> <td>ConfirmSuccessPage</td> <td>string</td> <td>URL of the success page shown after email confirmation.</td> <td>https://company.com/success</td> </tr> <tr> <td>Created</td> <td>string (Date-Time)</td> <td>Timestamp when the list was created.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (Date-Time)</td> <td>Timestamp when the list was last updated.</td> <td>2024-10-08T12:45:00Z</td> </tr> <tr> <td>ConfirmSender</td> <td>string</td> <td>Sender id for the confirmation email, if applicable.</td> <td>sender_313</td> </tr> <tr> <td>IsQuarantined</td> <td>bool</td> <td>Indicates if the list is quarantined. Contact support@sendx.io if you encounter this.</td> <td>false</td> </tr> </tbody> </table> ### Tag A Tag in SendX is a versatile tool that allows you to categorize and organize your contacts based on their behaviors, interests, or other attributes. By adding tags to contacts, you can create powerful filters and segments to target specific audiences in your campaigns. Tags are essential for tracking and understanding your contacts’ journey through your application or business funnel. For instance, if a contact views a product, you can assign a tag like Product X Viewed. Later, you can filter all contacts with this tag to send them personalized follow-up emails or promotional offers. This ability to categorize contacts ensures that your marketing efforts are precise and relevant. In the world of email marketing, tags are not just a tool—they are a key utility for creating personalized experiences, improving open rates, and driving higher engagement. By leveraging tags effectively, you can ensure that your contacts receive the right message at the right time. <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td>Identifier for the tag.</td> <td>a1b2c3d4e5</td> </tr> <tr> <td>Name</td> <td>string</td> <td>Name of the tag.</td> <td>VIP Customers</td> </tr> <tr> <td>Created</td> <td>string (Date-Time)</td> <td>Timestamp when the tag was created.</td> <td>2024-10-08T09:30:00Z</td> </tr> <tr> <td>Updated</td> <td>string (Date-Time)</td> <td>Timestamp when the tag was last updated.</td> <td>2024-10-08T12:45:00Z</td> </tr> </tbody> </table> ### Campaigns Campaign is one of the key resources in SendX as an email marketing platform. A campaign allows you to send targeted email messages to specific segments of your audience, helping to engage subscribers, promote products, or share important updates. Why is a Campaign Resource Important? Email campaigns are the cornerstone of email marketing strategies. They help you: - **Engage Customers:** Send relevant content that resonates with the audience. - **Automate Communication:** Schedule and automate emails to reach the right people at the right time. - **Track Performance:** Measure engagement, opens, clicks, and conversions to optimize future campaigns. <br> For example you might create a campaign called \"Holiday Discounts\" where you target customers who have shown interest in your products over the last three months. The campaign could send personalized emails with special discounts for the holiday season, encouraging recipients to take action. The Campaign resource in SendX provides you with a powerful toolset to not only communicate with your audience but also to enhance their experience through targeted, automated, and personalized email strategies. <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> <th>Example</th> </tr> </thead> <tbody> <tr> <td>Id</td> <td>string</td> <td> ID of the campaign</td> <td>campaign123xyz</td> </tr> <tr> <td>name</td> <td>string</td> <td>Name of the campaign</td> <td>New Year Promotion</td> </tr> <tr> <td>trackReply</td> <td>boolean</td> <td>Indicates if replies to the campaign should be tracked</td> <td>false</td> </tr> <tr> <td>status</td> <td>integer</td> <td>Current status of the campaign which can have these possible values: <br>0: Draft <br>1: Scheduled <br>2: Sending <br>3: Sent <br>4: Quarantined</td> <td>Scheduled</td> </tr> <tr> <td>scheduleType</td> <td>integer</td> <td>Type of schedule for the campaign <br>0: Schedule later <br>1: Send Now <br>2. Trigger via automation <br>3. Recurring </td> <td>0</td> </tr> <tr> <td>scheduleCondition</td> <td>string</td> <td>Condition for scheduling the campaign, in case of Send Now this field remains empty.In case of Schedule later, this field denotes the date at which the campaign will be sent in YYYY-MM-DD format</td> <td>2024-12-30</td> </tr> <tr> <td>timeCondition</td> <td>string</td> <td>Condition for scheduling the campaign, in case of Send Now this field remains empty.In case of Schedule later, this field denotes the time at which the campaign will be sent in HH:MM AM/PM format</td> <td>9:00 AM</td> </tr> <tr> <td>timezone</td> <td>string</td> <td>Timezone for the scheduled send. See `allowed timezones` for the list of allowed timezones</td> <td>America/New_York</td> </tr> <tr> <td>preferredTimeCondition</td> <td>string</td> <td>Preferred time condition for the campaign</td> <td>Send during work hours</td> </tr> <tr> <td>preferredTimezone</td> <td>string</td> <td>Preferred timezone for sending the campaign</td> <td>America/Los_Angeles</td> </tr> <tr> <td>strategy</td> <td>string</td> <td>Strategy for the campaign</td> <td>Batch sending</td> </tr> <tr> <td>sendInContactsTimezone</td> <td>boolean</td> <td>Indicates if the campaign should be sent in the recipient's timezone</td> <td>true</td> </tr> <tr> <td>smartSend</td> <td>boolean</td> <td>Indicates if smart sending should be used</td> <td>false</td> </tr> <tr> <td>isArchived</td> <td>boolean</td> <td>Indicates if the campaign is archived</td> <td>false</td> </tr> <tr> <td>sender</td> <td>string</td> <td>Unique identifier of the sender of the campaign</td> <td>sender_123</td> </tr> <tr> <td>campaignScreenshotUrl</td> <td>string</td> <td>URL of the campaign's screenshot</td> <td>https://example.com/screenshot.png</td> </tr> <tr> <td>includedSegments </td> <td>array</td> <td>List of segment IDs that are included in the campaign as receivers</td> <td>[\"segment_123\", \"segment_456\"]</td> </tr> <tr> <td>includedTags </td> <td>array</td> <td>List of tag IDs that are included in the campaign as receivers</td> <td>[\"tag_123\", \"tag_456\"]</td> </tr> <tr> <td>includedLists </td> <td>array</td> <td>List of list IDs that are included in the campaign as receivers</td> <td>[\"list_123\", \"list_456\"]</td> </tr> <tr> <td>excludedSegments </td> <td>array</td> <td>List of segment IDs that are excluded from the campaign as receivers</td> <td>[\"segment_123\", \"segment_456\"]</td> </tr> <tr> <td>excludedTags </td> <td>array</td> <td>List of tag IDs that are excluded from the campaign as receivers</td> <td>[\"tag_123\", \"tag_456\"]</td> </tr> <tr> <td>excludedLists </td> <td>array</td> <td>List of list IDs that are excluded from the campaign as receivers</td> <td>[\"list_123\", \"list_456\"]</td> </tr> </tbody> </table> Note: Here's a list of all the allowed timezones for the `timezone` field: # JavaScript API SendX Javascript API enables you to add contacts, associate tags with them and update custom fields. This guide details various functions associated with our Javascript API. - Installing Javascript Snippet - Sending API Requests - API Methods ## Installing Javascript Snippet To use SendX Javascript API you need to have SendX snippet installed on your website. Each SendX team account has a unique snippet that can be found under [Settings > Site Code](https://app.sendx.io/setting) Snippet SendX Javascript snippet gets loaded asynchronously and hence it won't affect page load time of your website. ## Sending API Requests All requests follow the same pattern. <br> ```javascript _scq.push([\"methodName\", { key: \"value\", ... }]); ``` API requests are executed asynchronously so you can safely place them anywhere on the page. The conventions are similar to what **google analytics** API follows. ## API Methods SendX Javascript API has two methods: - Identify - Track ## Identify API Method Identify API Method is used to attach data to a visitor. If a contact is not yet created then we will create the contact. In case contact already exists then we update it. ### Example Request: ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", firstName: \"John\", lastName: \"Doe\", birthday: \"1989-03-03\", customFields: { \"Designation\": \"Software Engineer\", \"Age\": \"27\", \"Experience\": \"5\"}, tags: [\"Developer\", \"API Team\"], }]); ``` Note that tags are an array of strings. In case they don't exist previously then API will create them and associate them with the contact. Similarly if a custom field doesn't exist then it is first created and then associated with the contact along-with the corresponding value. In case custom field exists already then we simply update the value of it for the aforementioned contact. Custom Fields are associated with data types and which be created and edited inside the app. If a custom field is not present inside the app and an API call is made containing it, a custom field with type 'string' is created and the value set. For custom fields with data type 'number', values can be added to or subtracted from existing values. This can be done by using \"++\" or \"--\" operator before the number(e.g. \"customField_name\": \"++34\" would increase the value of existing \"customField_name\" in SendX for the contact. If it doesn't already exist, the value '- 34' would be inserted for it). We don't delete any of the properties based on identify call. What this means is that if for the same contact you did two API calls like: ### API Call A ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", firstName: \"John\", birthday: \"1989-03-03\", customFields: { \"Designation\": \"Software Engineer\"}, tags: [\"Developer\"], success: function(){console.log(\"identify call successful\");}, failure: function(){console.log(\"identify failed\");}, }]); ``` ### API Call B ```javascript _scq.push([\"identify\", { email: \"john.doe@gmail.com\", customFields: { \"Age\": \"29\"}, tags: [\"API Team\"], success: function(){console.log(\"identify call successful\");}, failure: function(){console.log(\"identify failed\");}, }]); ``` The the final contact will have firstName as John, birthday as 1989-03-03 present. Also both tags Developer and API Team shall be present along with custom fields Designation and Age. Properties: - firstName: type string - lastName: type string - email: type string - newEmail: type string - company: type string - birthday: type string with format YYYY-MM-DD eg: 2016-11-21 - customFields: type map[string]string - tags: type array of string - success: Optional. Callback function which is executed on successful completion of request. - failure: Optional. Callback function which is executed when request fails or timeouts. In case email of an already existing contact needs to be updated then specify current email under email property and updated email under newEmail property. ### Response ```json { \"status\": \"200\", \"message\": \"OK\", \"data\": { \"encryptedTeamId\": \"CLdh9Ig5GLIN1u8gTRvoja\", \"encryptedId\": \"c9QF63nrBenCaAXe660byz\", \"tags\": [ \"API Team\", \"Tech\" ], \"firstName\": \"John\", \"lastName\": \"Doe\", \"email\": \"john.doe@gmail.com\", \"company\": \"\", \"birthday\": \"1989-03-03\", \"customFields\": { \"Age\": \"29\", \"Designation\": \"Software Engineer\" } } } ``` ## Track API Method Track API Method is used to track a contact. You can add or remove tags from a contact using this API. Properties: - addTags: Array of tags to be added to a contacts - removeTags: Array of tags to be removed from a contact - success: Optional. Callback function which is executed on successful completion of request. - failure: Optional. Callback function which is executed when request fails or timeouts. You can have automation rules based on tag addition as well as tag removal and they will get executed. For eg: - On user registration tag start on-boarding drip for him / her. - Account Upgrade tag start add user to paid user list and start account expansion drip. - On removal of trial user tag start up-sell trial completed users drip. ### Example Request: ```javascript _scq.push([\"track\", { \"addTags\": [\"blogger\", \"female\"], success: function(){console.log(\"track call successful\");}, failure: function(){console.log(\"track call failed\");}, }]); _scq.push([\"track\", { \"addTags\": [\"paid user\"], \"removeTags\": [\"trial user\"], success: function(){console.log(\"track call successful\");}, failure: function(){console.log(\"track call failed\");}, }]); ``` ### Response ```json { \"status\": \"200\", \"message\": \"OK\", \"data\": \"success\" } ```
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: support@sendx.io
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.13.0
10
10
 
11
11
  =end
12
12
 
@@ -24,9 +24,14 @@ module SendX
24
24
  }
25
25
  end
26
26
 
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
27
32
  # Returns all the JSON keys this model knows about
28
33
  def self.acceptable_attributes
29
- attribute_map.values
34
+ acceptable_attribute_map.values
30
35
  end
31
36
 
32
37
  # Attribute type mapping.
@@ -50,9 +55,10 @@ module SendX
50
55
  end
51
56
 
52
57
  # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
53
59
  attributes = attributes.each_with_object({}) { |(k, v), h|
54
- if (!self.class.attribute_map.key?(k.to_sym))
55
- fail ArgumentError, "`#{k}` is not a valid attribute in `SendX::TagRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SendX::TagRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
56
62
  end
57
63
  h[k.to_sym] = v
58
64
  }