late-sdk 0.0.43 → 0.0.44

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 (273) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +124 -0
  3. data/docs/AddWhatsAppBroadcastRecipients200Response.md +24 -0
  4. data/docs/AddWhatsAppBroadcastRecipientsRequest.md +18 -0
  5. data/docs/AddWhatsAppBroadcastRecipientsRequestRecipientsInner.md +22 -0
  6. data/docs/BulkDeleteWhatsAppContacts200Response.md +20 -0
  7. data/docs/BulkDeleteWhatsAppContactsRequest.md +18 -0
  8. data/docs/BulkUpdateWhatsAppContacts200Response.md +24 -0
  9. data/docs/BulkUpdateWhatsAppContactsRequest.md +24 -0
  10. data/docs/CancelWhatsAppBroadcastSchedule200Response.md +22 -0
  11. data/docs/CancelWhatsAppBroadcastSchedule200ResponseBroadcast.md +20 -0
  12. data/docs/CreateWhatsAppBroadcast200Response.md +20 -0
  13. data/docs/CreateWhatsAppBroadcast200ResponseBroadcast.md +30 -0
  14. data/docs/CreateWhatsAppBroadcastRequest.md +26 -0
  15. data/docs/CreateWhatsAppBroadcastRequestRecipientsInner.md +22 -0
  16. data/docs/CreateWhatsAppContact200Response.md +20 -0
  17. data/docs/CreateWhatsAppContact200ResponseContact.md +34 -0
  18. data/docs/CreateWhatsAppContactRequest.md +36 -0
  19. data/docs/CreateWhatsAppTemplate200Response.md +20 -0
  20. data/docs/CreateWhatsAppTemplate200ResponseTemplate.md +26 -0
  21. data/docs/CreateWhatsAppTemplateRequest.md +26 -0
  22. data/docs/DeleteWhatsAppGroupRequest.md +20 -0
  23. data/docs/GetPreverifiedWhatsAppNumbers200Response.md +20 -0
  24. data/docs/GetPreverifiedWhatsAppNumbers200ResponseNumbersInner.md +26 -0
  25. data/docs/GetWhatsAppBroadcast200Response.md +20 -0
  26. data/docs/GetWhatsAppBroadcast200ResponseBroadcast.md +46 -0
  27. data/docs/GetWhatsAppBroadcastRecipients200Response.md +24 -0
  28. data/docs/GetWhatsAppBroadcastRecipients200ResponseRecipientsInner.md +34 -0
  29. data/docs/GetWhatsAppBroadcastRecipients200ResponseSummary.md +28 -0
  30. data/docs/GetWhatsAppBroadcasts200Response.md +22 -0
  31. data/docs/GetWhatsAppBroadcasts200ResponseBroadcastsInner.md +44 -0
  32. data/docs/GetWhatsAppBroadcasts200ResponseBroadcastsInnerTemplate.md +20 -0
  33. data/docs/GetWhatsAppBusinessProfile200Response.md +20 -0
  34. data/docs/GetWhatsAppBusinessProfile200ResponseBusinessProfile.md +30 -0
  35. data/docs/GetWhatsAppContact200Response.md +20 -0
  36. data/docs/GetWhatsAppContact200ResponseContact.md +56 -0
  37. data/docs/GetWhatsAppContacts200Response.md +24 -0
  38. data/docs/GetWhatsAppContacts200ResponseContactsInner.md +48 -0
  39. data/docs/GetWhatsAppContacts200ResponseFilters.md +20 -0
  40. data/docs/GetWhatsAppContacts200ResponsePagination.md +24 -0
  41. data/docs/GetWhatsAppGroups200Response.md +22 -0
  42. data/docs/GetWhatsAppGroups200ResponseGroupsInner.md +22 -0
  43. data/docs/GetWhatsAppGroups200ResponseSummary.md +22 -0
  44. data/docs/GetWhatsAppPhoneNumber200Response.md +18 -0
  45. data/docs/GetWhatsAppPhoneNumber200ResponsePhoneNumber.md +30 -0
  46. data/docs/GetWhatsAppPhoneNumbers200Response.md +18 -0
  47. data/docs/GetWhatsAppPhoneNumbers200ResponseNumbersInner.md +34 -0
  48. data/docs/GetWhatsAppTemplate200Response.md +20 -0
  49. data/docs/GetWhatsAppTemplate200ResponseTemplate.md +28 -0
  50. data/docs/GetWhatsAppTemplates200Response.md +20 -0
  51. data/docs/GetWhatsAppTemplates200ResponseTemplatesInner.md +28 -0
  52. data/docs/ImportWhatsAppContacts200Response.md +22 -0
  53. data/docs/ImportWhatsAppContacts200ResponseResultsInner.md +26 -0
  54. data/docs/ImportWhatsAppContacts200ResponseSummary.md +24 -0
  55. data/docs/ImportWhatsAppContactsRequest.md +26 -0
  56. data/docs/ImportWhatsAppContactsRequestContactsInner.md +32 -0
  57. data/docs/PurchaseWhatsAppPhoneNumber200Response.md +49 -0
  58. data/docs/PurchaseWhatsAppPhoneNumber200ResponseOneOf.md +20 -0
  59. data/docs/PurchaseWhatsAppPhoneNumber200ResponseOneOf1.md +20 -0
  60. data/docs/PurchaseWhatsAppPhoneNumber200ResponseOneOf1PhoneNumber.md +30 -0
  61. data/docs/PurchaseWhatsAppPhoneNumberRequest.md +18 -0
  62. data/docs/ReleaseWhatsAppPhoneNumber200Response.md +20 -0
  63. data/docs/ReleaseWhatsAppPhoneNumber200ResponsePhoneNumber.md +24 -0
  64. data/docs/RemoveWhatsAppBroadcastRecipients200Response.md +22 -0
  65. data/docs/RemoveWhatsAppBroadcastRecipientsRequest.md +18 -0
  66. data/docs/RenameWhatsAppGroup200Response.md +22 -0
  67. data/docs/RenameWhatsAppGroupRequest.md +22 -0
  68. data/docs/RequestWhatsAppVerificationCode200Response.md +20 -0
  69. data/docs/RequestWhatsAppVerificationCodeRequest.md +18 -0
  70. data/docs/ScheduleWhatsAppBroadcast200Response.md +20 -0
  71. data/docs/ScheduleWhatsAppBroadcast200ResponseBroadcast.md +22 -0
  72. data/docs/ScheduleWhatsAppBroadcastRequest.md +18 -0
  73. data/docs/SearchAvailableWhatsAppNumbers200Response.md +18 -0
  74. data/docs/SendWhatsAppBroadcast200Response.md +26 -0
  75. data/docs/SendWhatsAppBulk200Response.md +22 -0
  76. data/docs/SendWhatsAppBulk200ResponseResultsInner.md +24 -0
  77. data/docs/SendWhatsAppBulk200ResponseSummary.md +22 -0
  78. data/docs/SendWhatsAppBulkRequest.md +22 -0
  79. data/docs/SendWhatsAppBulkRequestRecipientsInner.md +20 -0
  80. data/docs/SendWhatsAppBulkRequestTemplate.md +22 -0
  81. data/docs/UpdateWhatsAppBusinessProfileRequest.md +32 -0
  82. data/docs/UpdateWhatsAppContact200Response.md +20 -0
  83. data/docs/UpdateWhatsAppContact200ResponseContact.md +40 -0
  84. data/docs/UpdateWhatsAppContactRequest.md +34 -0
  85. data/docs/UpdateWhatsAppTemplate200Response.md +20 -0
  86. data/docs/UpdateWhatsAppTemplate200ResponseTemplate.md +22 -0
  87. data/docs/UpdateWhatsAppTemplateRequest.md +20 -0
  88. data/docs/VerifyWhatsAppPhoneNumber200Response.md +22 -0
  89. data/docs/VerifyWhatsAppPhoneNumberRequest.md +18 -0
  90. data/docs/WhatsAppApi.md +2081 -0
  91. data/docs/WhatsAppPhoneNumbersApi.md +585 -0
  92. data/lib/late-sdk/api/whats_app_api.rb +2021 -0
  93. data/lib/late-sdk/api/whats_app_phone_numbers_api.rb +564 -0
  94. data/lib/late-sdk/models/add_whats_app_broadcast_recipients200_response.rb +177 -0
  95. data/lib/late-sdk/models/add_whats_app_broadcast_recipients_request.rb +176 -0
  96. data/lib/late-sdk/models/add_whats_app_broadcast_recipients_request_recipients_inner.rb +185 -0
  97. data/lib/late-sdk/models/bulk_delete_whats_app_contacts200_response.rb +157 -0
  98. data/lib/late-sdk/models/bulk_delete_whats_app_contacts_request.rb +176 -0
  99. data/lib/late-sdk/models/bulk_update_whats_app_contacts200_response.rb +176 -0
  100. data/lib/late-sdk/models/bulk_update_whats_app_contacts_request.rb +251 -0
  101. data/lib/late-sdk/models/cancel_whats_app_broadcast_schedule200_response.rb +165 -0
  102. data/lib/late-sdk/models/cancel_whats_app_broadcast_schedule200_response_broadcast.rb +157 -0
  103. data/lib/late-sdk/models/create_whats_app_broadcast200_response.rb +156 -0
  104. data/lib/late-sdk/models/create_whats_app_broadcast200_response_broadcast.rb +202 -0
  105. data/lib/late-sdk/models/create_whats_app_broadcast_request.rb +240 -0
  106. data/lib/late-sdk/models/create_whats_app_broadcast_request_recipients_inner.rb +186 -0
  107. data/lib/late-sdk/models/create_whats_app_contact200_response.rb +156 -0
  108. data/lib/late-sdk/models/create_whats_app_contact200_response_contact.rb +223 -0
  109. data/lib/late-sdk/models/create_whats_app_contact_request.rb +297 -0
  110. data/lib/late-sdk/models/create_whats_app_template200_response.rb +156 -0
  111. data/lib/late-sdk/models/create_whats_app_template200_response_template.rb +183 -0
  112. data/lib/late-sdk/models/create_whats_app_template_request.rb +310 -0
  113. data/lib/late-sdk/models/delete_whats_app_group_request.rb +192 -0
  114. data/lib/late-sdk/models/get_preverified_whats_app_numbers200_response.rb +161 -0
  115. data/lib/late-sdk/models/get_preverified_whats_app_numbers200_response_numbers_inner.rb +183 -0
  116. data/lib/late-sdk/models/get_whats_app_broadcast200_response.rb +156 -0
  117. data/lib/late-sdk/models/get_whats_app_broadcast200_response_broadcast.rb +307 -0
  118. data/lib/late-sdk/models/get_whats_app_broadcast_recipients200_response.rb +176 -0
  119. data/lib/late-sdk/models/get_whats_app_broadcast_recipients200_response_recipients_inner.rb +253 -0
  120. data/lib/late-sdk/models/get_whats_app_broadcast_recipients200_response_summary.rb +192 -0
  121. data/lib/late-sdk/models/get_whats_app_broadcasts200_response.rb +167 -0
  122. data/lib/late-sdk/models/get_whats_app_broadcasts200_response_broadcasts_inner.rb +298 -0
  123. data/lib/late-sdk/models/get_whats_app_broadcasts200_response_broadcasts_inner_template.rb +156 -0
  124. data/lib/late-sdk/models/get_whats_app_business_profile200_response.rb +156 -0
  125. data/lib/late-sdk/models/get_whats_app_business_profile200_response_business_profile.rb +225 -0
  126. data/lib/late-sdk/models/get_whats_app_contact200_response.rb +156 -0
  127. data/lib/late-sdk/models/get_whats_app_contact200_response_contact.rb +322 -0
  128. data/lib/late-sdk/models/get_whats_app_contacts200_response.rb +176 -0
  129. data/lib/late-sdk/models/get_whats_app_contacts200_response_contacts_inner.rb +286 -0
  130. data/lib/late-sdk/models/get_whats_app_contacts200_response_filters.rb +160 -0
  131. data/lib/late-sdk/models/get_whats_app_contacts200_response_pagination.rb +174 -0
  132. data/lib/late-sdk/models/get_whats_app_groups200_response.rb +167 -0
  133. data/lib/late-sdk/models/get_whats_app_groups200_response_groups_inner.rb +167 -0
  134. data/lib/late-sdk/models/get_whats_app_groups200_response_summary.rb +165 -0
  135. data/lib/late-sdk/models/get_whats_app_phone_number200_response.rb +147 -0
  136. data/lib/late-sdk/models/get_whats_app_phone_number200_response_phone_number.rb +235 -0
  137. data/lib/late-sdk/models/get_whats_app_phone_numbers200_response.rb +149 -0
  138. data/lib/late-sdk/models/get_whats_app_phone_numbers200_response_numbers_inner.rb +253 -0
  139. data/lib/late-sdk/models/get_whats_app_template200_response.rb +156 -0
  140. data/lib/late-sdk/models/get_whats_app_template200_response_template.rb +194 -0
  141. data/lib/late-sdk/models/get_whats_app_templates200_response.rb +158 -0
  142. data/lib/late-sdk/models/get_whats_app_templates200_response_templates_inner.rb +241 -0
  143. data/lib/late-sdk/models/import_whats_app_contacts200_response.rb +167 -0
  144. data/lib/late-sdk/models/import_whats_app_contacts200_response_results_inner.rb +183 -0
  145. data/lib/late-sdk/models/import_whats_app_contacts200_response_summary.rb +174 -0
  146. data/lib/late-sdk/models/import_whats_app_contacts_request.rb +239 -0
  147. data/lib/late-sdk/models/import_whats_app_contacts_request_contacts_inner.rb +252 -0
  148. data/lib/late-sdk/models/purchase_whats_app_phone_number200_response.rb +104 -0
  149. data/lib/late-sdk/models/purchase_whats_app_phone_number200_response_one_of.rb +157 -0
  150. data/lib/late-sdk/models/purchase_whats_app_phone_number200_response_one_of1.rb +157 -0
  151. data/lib/late-sdk/models/purchase_whats_app_phone_number200_response_one_of1_phone_number.rb +201 -0
  152. data/lib/late-sdk/models/purchase_whats_app_phone_number_request.rb +165 -0
  153. data/lib/late-sdk/models/release_whats_app_phone_number200_response.rb +156 -0
  154. data/lib/late-sdk/models/release_whats_app_phone_number200_response_phone_number.rb +175 -0
  155. data/lib/late-sdk/models/remove_whats_app_broadcast_recipients200_response.rb +167 -0
  156. data/lib/late-sdk/models/remove_whats_app_broadcast_recipients_request.rb +167 -0
  157. data/lib/late-sdk/models/rename_whats_app_group200_response.rb +166 -0
  158. data/lib/late-sdk/models/rename_whats_app_group_request.rb +219 -0
  159. data/lib/late-sdk/models/request_whats_app_verification_code200_response.rb +190 -0
  160. data/lib/late-sdk/models/request_whats_app_verification_code_request.rb +184 -0
  161. data/lib/late-sdk/models/schedule_whats_app_broadcast200_response.rb +156 -0
  162. data/lib/late-sdk/models/schedule_whats_app_broadcast200_response_broadcast.rb +166 -0
  163. data/lib/late-sdk/models/schedule_whats_app_broadcast_request.rb +165 -0
  164. data/lib/late-sdk/models/search_available_whats_app_numbers200_response.rb +149 -0
  165. data/lib/late-sdk/models/send_whats_app_broadcast200_response.rb +221 -0
  166. data/lib/late-sdk/models/send_whats_app_bulk200_response.rb +167 -0
  167. data/lib/late-sdk/models/send_whats_app_bulk200_response_results_inner.rb +174 -0
  168. data/lib/late-sdk/models/send_whats_app_bulk200_response_summary.rb +165 -0
  169. data/lib/late-sdk/models/send_whats_app_bulk_request.rb +229 -0
  170. data/lib/late-sdk/models/send_whats_app_bulk_request_recipients_inner.rb +177 -0
  171. data/lib/late-sdk/models/send_whats_app_bulk_request_template.rb +204 -0
  172. data/lib/late-sdk/models/update_whats_app_business_profile_request.rb +294 -0
  173. data/lib/late-sdk/models/update_whats_app_contact200_response.rb +156 -0
  174. data/lib/late-sdk/models/update_whats_app_contact200_response_contact.rb +250 -0
  175. data/lib/late-sdk/models/update_whats_app_contact_request.rb +234 -0
  176. data/lib/late-sdk/models/update_whats_app_template200_response.rb +156 -0
  177. data/lib/late-sdk/models/update_whats_app_template200_response_template.rb +165 -0
  178. data/lib/late-sdk/models/update_whats_app_template_request.rb +194 -0
  179. data/lib/late-sdk/models/verify_whats_app_phone_number200_response.rb +165 -0
  180. data/lib/late-sdk/models/verify_whats_app_phone_number_request.rb +165 -0
  181. data/lib/late-sdk/version.rb +1 -1
  182. data/lib/late-sdk.rb +89 -0
  183. data/openapi.yaml +2144 -0
  184. data/spec/api/whats_app_api_spec.rb +402 -0
  185. data/spec/api/whats_app_phone_numbers_api_spec.rb +137 -0
  186. data/spec/models/add_whats_app_broadcast_recipients200_response_spec.rb +54 -0
  187. data/spec/models/add_whats_app_broadcast_recipients_request_recipients_inner_spec.rb +48 -0
  188. data/spec/models/add_whats_app_broadcast_recipients_request_spec.rb +36 -0
  189. data/spec/models/bulk_delete_whats_app_contacts200_response_spec.rb +42 -0
  190. data/spec/models/bulk_delete_whats_app_contacts_request_spec.rb +36 -0
  191. data/spec/models/bulk_update_whats_app_contacts200_response_spec.rb +54 -0
  192. data/spec/models/bulk_update_whats_app_contacts_request_spec.rb +58 -0
  193. data/spec/models/cancel_whats_app_broadcast_schedule200_response_broadcast_spec.rb +42 -0
  194. data/spec/models/cancel_whats_app_broadcast_schedule200_response_spec.rb +48 -0
  195. data/spec/models/create_whats_app_broadcast200_response_broadcast_spec.rb +72 -0
  196. data/spec/models/create_whats_app_broadcast200_response_spec.rb +42 -0
  197. data/spec/models/create_whats_app_broadcast_request_recipients_inner_spec.rb +48 -0
  198. data/spec/models/create_whats_app_broadcast_request_spec.rb +60 -0
  199. data/spec/models/create_whats_app_contact200_response_contact_spec.rb +84 -0
  200. data/spec/models/create_whats_app_contact200_response_spec.rb +42 -0
  201. data/spec/models/create_whats_app_contact_request_spec.rb +90 -0
  202. data/spec/models/create_whats_app_template200_response_spec.rb +42 -0
  203. data/spec/models/create_whats_app_template200_response_template_spec.rb +60 -0
  204. data/spec/models/create_whats_app_template_request_spec.rb +64 -0
  205. data/spec/models/delete_whats_app_group_request_spec.rb +42 -0
  206. data/spec/models/get_preverified_whats_app_numbers200_response_numbers_inner_spec.rb +60 -0
  207. data/spec/models/get_preverified_whats_app_numbers200_response_spec.rb +42 -0
  208. data/spec/models/get_whats_app_broadcast200_response_broadcast_spec.rb +124 -0
  209. data/spec/models/get_whats_app_broadcast200_response_spec.rb +42 -0
  210. data/spec/models/get_whats_app_broadcast_recipients200_response_recipients_inner_spec.rb +88 -0
  211. data/spec/models/get_whats_app_broadcast_recipients200_response_spec.rb +54 -0
  212. data/spec/models/get_whats_app_broadcast_recipients200_response_summary_spec.rb +66 -0
  213. data/spec/models/get_whats_app_broadcasts200_response_broadcasts_inner_spec.rb +118 -0
  214. data/spec/models/get_whats_app_broadcasts200_response_broadcasts_inner_template_spec.rb +42 -0
  215. data/spec/models/get_whats_app_broadcasts200_response_spec.rb +48 -0
  216. data/spec/models/get_whats_app_business_profile200_response_business_profile_spec.rb +72 -0
  217. data/spec/models/get_whats_app_business_profile200_response_spec.rb +42 -0
  218. data/spec/models/get_whats_app_contact200_response_contact_spec.rb +150 -0
  219. data/spec/models/get_whats_app_contact200_response_spec.rb +42 -0
  220. data/spec/models/get_whats_app_contacts200_response_contacts_inner_spec.rb +126 -0
  221. data/spec/models/get_whats_app_contacts200_response_filters_spec.rb +42 -0
  222. data/spec/models/get_whats_app_contacts200_response_pagination_spec.rb +54 -0
  223. data/spec/models/get_whats_app_contacts200_response_spec.rb +54 -0
  224. data/spec/models/get_whats_app_groups200_response_groups_inner_spec.rb +48 -0
  225. data/spec/models/get_whats_app_groups200_response_spec.rb +48 -0
  226. data/spec/models/get_whats_app_groups200_response_summary_spec.rb +48 -0
  227. data/spec/models/get_whats_app_phone_number200_response_phone_number_spec.rb +76 -0
  228. data/spec/models/get_whats_app_phone_number200_response_spec.rb +36 -0
  229. data/spec/models/get_whats_app_phone_numbers200_response_numbers_inner_spec.rb +88 -0
  230. data/spec/models/get_whats_app_phone_numbers200_response_spec.rb +36 -0
  231. data/spec/models/get_whats_app_template200_response_spec.rb +42 -0
  232. data/spec/models/get_whats_app_template200_response_template_spec.rb +66 -0
  233. data/spec/models/get_whats_app_templates200_response_spec.rb +42 -0
  234. data/spec/models/get_whats_app_templates200_response_templates_inner_spec.rb +74 -0
  235. data/spec/models/import_whats_app_contacts200_response_results_inner_spec.rb +60 -0
  236. data/spec/models/import_whats_app_contacts200_response_spec.rb +48 -0
  237. data/spec/models/import_whats_app_contacts200_response_summary_spec.rb +54 -0
  238. data/spec/models/import_whats_app_contacts_request_contacts_inner_spec.rb +78 -0
  239. data/spec/models/import_whats_app_contacts_request_spec.rb +60 -0
  240. data/spec/models/purchase_whats_app_phone_number200_response_one_of1_phone_number_spec.rb +72 -0
  241. data/spec/models/purchase_whats_app_phone_number200_response_one_of1_spec.rb +42 -0
  242. data/spec/models/purchase_whats_app_phone_number200_response_one_of_spec.rb +42 -0
  243. data/spec/models/purchase_whats_app_phone_number200_response_spec.rb +32 -0
  244. data/spec/models/purchase_whats_app_phone_number_request_spec.rb +36 -0
  245. data/spec/models/release_whats_app_phone_number200_response_phone_number_spec.rb +54 -0
  246. data/spec/models/release_whats_app_phone_number200_response_spec.rb +42 -0
  247. data/spec/models/remove_whats_app_broadcast_recipients200_response_spec.rb +48 -0
  248. data/spec/models/remove_whats_app_broadcast_recipients_request_spec.rb +36 -0
  249. data/spec/models/rename_whats_app_group200_response_spec.rb +48 -0
  250. data/spec/models/rename_whats_app_group_request_spec.rb +48 -0
  251. data/spec/models/request_whats_app_verification_code200_response_spec.rb +46 -0
  252. data/spec/models/request_whats_app_verification_code_request_spec.rb +40 -0
  253. data/spec/models/schedule_whats_app_broadcast200_response_broadcast_spec.rb +48 -0
  254. data/spec/models/schedule_whats_app_broadcast200_response_spec.rb +42 -0
  255. data/spec/models/schedule_whats_app_broadcast_request_spec.rb +36 -0
  256. data/spec/models/search_available_whats_app_numbers200_response_spec.rb +36 -0
  257. data/spec/models/send_whats_app_broadcast200_response_spec.rb +64 -0
  258. data/spec/models/send_whats_app_bulk200_response_results_inner_spec.rb +54 -0
  259. data/spec/models/send_whats_app_bulk200_response_spec.rb +48 -0
  260. data/spec/models/send_whats_app_bulk200_response_summary_spec.rb +48 -0
  261. data/spec/models/send_whats_app_bulk_request_recipients_inner_spec.rb +42 -0
  262. data/spec/models/send_whats_app_bulk_request_spec.rb +48 -0
  263. data/spec/models/send_whats_app_bulk_request_template_spec.rb +48 -0
  264. data/spec/models/update_whats_app_business_profile_request_spec.rb +78 -0
  265. data/spec/models/update_whats_app_contact200_response_contact_spec.rb +102 -0
  266. data/spec/models/update_whats_app_contact200_response_spec.rb +42 -0
  267. data/spec/models/update_whats_app_contact_request_spec.rb +84 -0
  268. data/spec/models/update_whats_app_template200_response_spec.rb +42 -0
  269. data/spec/models/update_whats_app_template200_response_template_spec.rb +48 -0
  270. data/spec/models/update_whats_app_template_request_spec.rb +42 -0
  271. data/spec/models/verify_whats_app_phone_number200_response_spec.rb +48 -0
  272. data/spec/models/verify_whats_app_phone_number_request_spec.rb +36 -0
  273. metadata +357 -1
data/openapi.yaml CHANGED
@@ -213,6 +213,14 @@ tags:
213
213
  - name: Logs
214
214
  description: |
215
215
  Publishing logs for transparency and debugging. Each log includes the platform API endpoint, HTTP status code, request/response bodies, duration, and retry attempts. Logs are automatically deleted after 7 days.
216
+ - name: WhatsApp
217
+ description: |
218
+ WhatsApp Business API for sending messages, managing contacts, templates, broadcasts, and conversations.
219
+ All endpoints require an accountId parameter identifying the WhatsApp-connected social account.
220
+ - name: WhatsApp Phone Numbers
221
+ description: |
222
+ Manage WhatsApp phone numbers: purchase, verify, and release numbers for your WhatsApp Business account.
223
+ Requires a paid plan.
216
224
  components:
217
225
  securitySchemes:
218
226
  bearerAuth:
@@ -11262,3 +11270,2139 @@ paths:
11262
11270
  '401': { $ref: '#/components/responses/Unauthorized' }
11263
11271
  '403':
11264
11272
  description: Inbox addon required
11273
+ # ──────────────────────────────────────────────────────────────────────────
11274
+ # BULK SEND
11275
+ # ──────────────────────────────────────────────────────────────────────────
11276
+
11277
+ /v1/whatsapp/bulk:
11278
+ post:
11279
+ operationId: sendWhatsAppBulk
11280
+ tags: [WhatsApp]
11281
+ summary: Bulk send template messages
11282
+ description: |
11283
+ Send a template message to multiple recipients in a single request. Maximum 100 recipients per request.
11284
+ Only template messages are supported for bulk sending (not free-form text).
11285
+
11286
+ Each recipient can have optional per-recipient template variables for personalization.
11287
+ Returns detailed results for each recipient.
11288
+ security:
11289
+ - bearerAuth: []
11290
+ requestBody:
11291
+ required: true
11292
+ content:
11293
+ application/json:
11294
+ schema:
11295
+ type: object
11296
+ required:
11297
+ - accountId
11298
+ - recipients
11299
+ - template
11300
+ properties:
11301
+ accountId:
11302
+ type: string
11303
+ description: WhatsApp social account ID
11304
+ recipients:
11305
+ type: array
11306
+ maxItems: 100
11307
+ description: List of recipients (max 100)
11308
+ items:
11309
+ type: object
11310
+ required:
11311
+ - phone
11312
+ properties:
11313
+ phone:
11314
+ type: string
11315
+ description: Recipient phone number in E.164 format
11316
+ variables:
11317
+ type: object
11318
+ additionalProperties: { type: string }
11319
+ description: Per-recipient template variables keyed by index (e.g., "1", "2")
11320
+ template:
11321
+ type: object
11322
+ required:
11323
+ - name
11324
+ - language
11325
+ properties:
11326
+ name:
11327
+ type: string
11328
+ description: Template name
11329
+ language:
11330
+ type: string
11331
+ description: Template language code
11332
+ components:
11333
+ type: array
11334
+ description: Base template components
11335
+ items:
11336
+ type: object
11337
+ example:
11338
+ accountId: "507f1f77bcf86cd799439011"
11339
+ recipients:
11340
+ - phone: "+1234567890"
11341
+ variables: { "1": "John" }
11342
+ - phone: "+0987654321"
11343
+ variables: { "1": "Jane" }
11344
+ template:
11345
+ name: "welcome_message"
11346
+ language: "en_US"
11347
+ responses:
11348
+ '200':
11349
+ description: Bulk send completed
11350
+ content:
11351
+ application/json:
11352
+ schema:
11353
+ type: object
11354
+ properties:
11355
+ success: { type: boolean }
11356
+ summary:
11357
+ type: object
11358
+ properties:
11359
+ total: { type: integer }
11360
+ sent: { type: integer }
11361
+ failed: { type: integer }
11362
+ results:
11363
+ type: array
11364
+ items:
11365
+ type: object
11366
+ properties:
11367
+ phone: { type: string }
11368
+ success: { type: boolean }
11369
+ messageId: { type: string }
11370
+ error: { type: string }
11371
+ '400': { description: Validation error (missing fields, too many recipients, etc.) }
11372
+ '401': { $ref: '#/components/responses/Unauthorized' }
11373
+ '404': { description: WhatsApp account not found }
11374
+
11375
+ # ──────────────────────────────────────────────────────────────────────────
11376
+ # CONTACTS
11377
+ # ──────────────────────────────────────────────────────────────────────────
11378
+
11379
+ /v1/whatsapp/contacts:
11380
+ get:
11381
+ operationId: getWhatsAppContacts
11382
+ tags: [WhatsApp]
11383
+ summary: List contacts
11384
+ description: |
11385
+ List WhatsApp contacts for an account. Supports filtering by tags, groups, opt-in status,
11386
+ and text search. Returns contacts sorted by name with available filter options.
11387
+ security:
11388
+ - bearerAuth: []
11389
+ parameters:
11390
+ - name: accountId
11391
+ in: query
11392
+ required: true
11393
+ description: WhatsApp social account ID
11394
+ schema:
11395
+ type: string
11396
+ - name: search
11397
+ in: query
11398
+ required: false
11399
+ description: Search contacts by name, phone, email, or company
11400
+ schema:
11401
+ type: string
11402
+ - name: tag
11403
+ in: query
11404
+ required: false
11405
+ description: Filter by tag
11406
+ schema:
11407
+ type: string
11408
+ - name: group
11409
+ in: query
11410
+ required: false
11411
+ description: Filter by group
11412
+ schema:
11413
+ type: string
11414
+ - name: optedIn
11415
+ in: query
11416
+ required: false
11417
+ description: Filter by opt-in status
11418
+ schema:
11419
+ type: string
11420
+ enum: ["true", "false"]
11421
+ - name: limit
11422
+ in: query
11423
+ required: false
11424
+ description: Maximum results (default 50)
11425
+ schema:
11426
+ type: integer
11427
+ default: 50
11428
+ - name: skip
11429
+ in: query
11430
+ required: false
11431
+ description: Offset for pagination
11432
+ schema:
11433
+ type: integer
11434
+ default: 0
11435
+ responses:
11436
+ '200':
11437
+ description: Contacts retrieved successfully
11438
+ content:
11439
+ application/json:
11440
+ schema:
11441
+ type: object
11442
+ properties:
11443
+ success: { type: boolean }
11444
+ contacts:
11445
+ type: array
11446
+ items:
11447
+ type: object
11448
+ properties:
11449
+ id: { type: string }
11450
+ phone: { type: string }
11451
+ waId: { type: string }
11452
+ name: { type: string }
11453
+ email: { type: string }
11454
+ company: { type: string }
11455
+ tags:
11456
+ type: array
11457
+ items: { type: string }
11458
+ groups:
11459
+ type: array
11460
+ items: { type: string }
11461
+ isOptedIn: { type: boolean }
11462
+ lastMessageSentAt: { type: string, format: date-time }
11463
+ lastMessageReceivedAt: { type: string, format: date-time }
11464
+ messagesSentCount: { type: integer }
11465
+ messagesReceivedCount: { type: integer }
11466
+ customFields: { type: object }
11467
+ notes: { type: string }
11468
+ createdAt: { type: string, format: date-time }
11469
+ filters:
11470
+ type: object
11471
+ properties:
11472
+ tags:
11473
+ type: array
11474
+ items: { type: string }
11475
+ groups:
11476
+ type: array
11477
+ items: { type: string }
11478
+ pagination:
11479
+ type: object
11480
+ properties:
11481
+ total: { type: integer }
11482
+ limit: { type: integer }
11483
+ skip: { type: integer }
11484
+ hasMore: { type: boolean }
11485
+ '400': { description: accountId is required }
11486
+ '401': { $ref: '#/components/responses/Unauthorized' }
11487
+ '404': { description: WhatsApp account not found }
11488
+ post:
11489
+ operationId: createWhatsAppContact
11490
+ tags: [WhatsApp]
11491
+ summary: Create contact
11492
+ description: |
11493
+ Create a new WhatsApp contact. Phone number must be unique per account
11494
+ and in E.164 format (e.g., +1234567890).
11495
+ security:
11496
+ - bearerAuth: []
11497
+ requestBody:
11498
+ required: true
11499
+ content:
11500
+ application/json:
11501
+ schema:
11502
+ type: object
11503
+ required:
11504
+ - accountId
11505
+ - phone
11506
+ - name
11507
+ properties:
11508
+ accountId:
11509
+ type: string
11510
+ description: WhatsApp social account ID
11511
+ phone:
11512
+ type: string
11513
+ description: Phone number in E.164 format
11514
+ name:
11515
+ type: string
11516
+ description: Contact name
11517
+ email:
11518
+ type: string
11519
+ description: Contact email
11520
+ company:
11521
+ type: string
11522
+ description: Company name
11523
+ tags:
11524
+ type: array
11525
+ items: { type: string }
11526
+ description: Tags for categorization
11527
+ groups:
11528
+ type: array
11529
+ items: { type: string }
11530
+ description: Groups the contact belongs to
11531
+ isOptedIn:
11532
+ type: boolean
11533
+ default: true
11534
+ description: Whether the contact has opted in to receive messages
11535
+ customFields:
11536
+ type: object
11537
+ additionalProperties: { type: string }
11538
+ description: Custom key-value fields
11539
+ notes:
11540
+ type: string
11541
+ description: Notes about the contact
11542
+ example:
11543
+ accountId: "507f1f77bcf86cd799439011"
11544
+ phone: "+1234567890"
11545
+ name: "John Doe"
11546
+ email: "john@example.com"
11547
+ tags: ["vip", "newsletter"]
11548
+ groups: ["customers"]
11549
+ responses:
11550
+ '200':
11551
+ description: Contact created successfully
11552
+ content:
11553
+ application/json:
11554
+ schema:
11555
+ type: object
11556
+ properties:
11557
+ success: { type: boolean }
11558
+ contact:
11559
+ type: object
11560
+ properties:
11561
+ id: { type: string }
11562
+ phone: { type: string }
11563
+ name: { type: string }
11564
+ email: { type: string }
11565
+ company: { type: string }
11566
+ tags:
11567
+ type: array
11568
+ items: { type: string }
11569
+ groups:
11570
+ type: array
11571
+ items: { type: string }
11572
+ isOptedIn: { type: boolean }
11573
+ createdAt: { type: string, format: date-time }
11574
+ '400': { description: Validation error (missing fields, invalid phone number) }
11575
+ '401': { $ref: '#/components/responses/Unauthorized' }
11576
+ '404': { description: WhatsApp account not found }
11577
+ '409': { description: Contact with this phone number already exists }
11578
+
11579
+ /v1/whatsapp/contacts/{contactId}:
11580
+ get:
11581
+ operationId: getWhatsAppContact
11582
+ tags: [WhatsApp]
11583
+ summary: Get contact
11584
+ description: Retrieve a single WhatsApp contact by ID with full details.
11585
+ security:
11586
+ - bearerAuth: []
11587
+ parameters:
11588
+ - name: contactId
11589
+ in: path
11590
+ required: true
11591
+ description: Contact ID
11592
+ schema:
11593
+ type: string
11594
+ responses:
11595
+ '200':
11596
+ description: Contact retrieved successfully
11597
+ content:
11598
+ application/json:
11599
+ schema:
11600
+ type: object
11601
+ properties:
11602
+ success: { type: boolean }
11603
+ contact:
11604
+ type: object
11605
+ properties:
11606
+ id: { type: string }
11607
+ phone: { type: string }
11608
+ waId: { type: string }
11609
+ name: { type: string }
11610
+ email: { type: string }
11611
+ company: { type: string }
11612
+ tags:
11613
+ type: array
11614
+ items: { type: string }
11615
+ groups:
11616
+ type: array
11617
+ items: { type: string }
11618
+ isOptedIn: { type: boolean }
11619
+ optInDate: { type: string, format: date-time }
11620
+ optOutDate: { type: string, format: date-time }
11621
+ isBlocked: { type: boolean }
11622
+ lastMessageSentAt: { type: string, format: date-time }
11623
+ lastMessageReceivedAt: { type: string, format: date-time }
11624
+ messagesSentCount: { type: integer }
11625
+ messagesReceivedCount: { type: integer }
11626
+ customFields: { type: object }
11627
+ notes: { type: string }
11628
+ createdAt: { type: string, format: date-time }
11629
+ updatedAt: { type: string, format: date-time }
11630
+ '401': { $ref: '#/components/responses/Unauthorized' }
11631
+ '404': { $ref: '#/components/responses/NotFound' }
11632
+ put:
11633
+ operationId: updateWhatsAppContact
11634
+ tags: [WhatsApp]
11635
+ summary: Update contact
11636
+ description: |
11637
+ Update an existing WhatsApp contact. All fields are optional; only provided fields will be updated.
11638
+ Custom fields are merged with existing values. Set a custom field to null to remove it.
11639
+ security:
11640
+ - bearerAuth: []
11641
+ parameters:
11642
+ - name: contactId
11643
+ in: path
11644
+ required: true
11645
+ description: Contact ID
11646
+ schema:
11647
+ type: string
11648
+ requestBody:
11649
+ required: true
11650
+ content:
11651
+ application/json:
11652
+ schema:
11653
+ type: object
11654
+ properties:
11655
+ name:
11656
+ type: string
11657
+ description: Contact name
11658
+ email:
11659
+ type: string
11660
+ description: Contact email
11661
+ company:
11662
+ type: string
11663
+ description: Company name
11664
+ tags:
11665
+ type: array
11666
+ items: { type: string }
11667
+ description: Tags (replaces existing)
11668
+ groups:
11669
+ type: array
11670
+ items: { type: string }
11671
+ description: Groups (replaces existing)
11672
+ isOptedIn:
11673
+ type: boolean
11674
+ description: Opt-in status (changes are timestamped)
11675
+ isBlocked:
11676
+ type: boolean
11677
+ description: Block status
11678
+ customFields:
11679
+ type: object
11680
+ additionalProperties: { type: string, nullable: true }
11681
+ description: Custom fields to merge (set value to null to remove a field)
11682
+ notes:
11683
+ type: string
11684
+ description: Notes about the contact
11685
+ example:
11686
+ name: "John Doe Updated"
11687
+ tags: ["vip", "premium"]
11688
+ customFields: { "plan": "enterprise", "remove_me": null }
11689
+ responses:
11690
+ '200':
11691
+ description: Contact updated successfully
11692
+ content:
11693
+ application/json:
11694
+ schema:
11695
+ type: object
11696
+ properties:
11697
+ success: { type: boolean }
11698
+ contact:
11699
+ type: object
11700
+ properties:
11701
+ id: { type: string }
11702
+ phone: { type: string }
11703
+ name: { type: string }
11704
+ email: { type: string }
11705
+ company: { type: string }
11706
+ tags:
11707
+ type: array
11708
+ items: { type: string }
11709
+ groups:
11710
+ type: array
11711
+ items: { type: string }
11712
+ isOptedIn: { type: boolean }
11713
+ isBlocked: { type: boolean }
11714
+ customFields: { type: object }
11715
+ notes: { type: string }
11716
+ updatedAt: { type: string, format: date-time }
11717
+ '401': { $ref: '#/components/responses/Unauthorized' }
11718
+ '404': { $ref: '#/components/responses/NotFound' }
11719
+ delete:
11720
+ operationId: deleteWhatsAppContact
11721
+ tags: [WhatsApp]
11722
+ summary: Delete contact
11723
+ description: Permanently delete a WhatsApp contact.
11724
+ security:
11725
+ - bearerAuth: []
11726
+ parameters:
11727
+ - name: contactId
11728
+ in: path
11729
+ required: true
11730
+ description: Contact ID
11731
+ schema:
11732
+ type: string
11733
+ responses:
11734
+ '200':
11735
+ description: Contact deleted successfully
11736
+ content:
11737
+ application/json:
11738
+ schema:
11739
+ type: object
11740
+ properties:
11741
+ success: { type: boolean }
11742
+ message: { type: string }
11743
+ example:
11744
+ success: true
11745
+ message: "Contact deleted successfully"
11746
+ '401': { $ref: '#/components/responses/Unauthorized' }
11747
+ '404': { $ref: '#/components/responses/NotFound' }
11748
+
11749
+ /v1/whatsapp/contacts/import:
11750
+ post:
11751
+ operationId: importWhatsAppContacts
11752
+ tags: [WhatsApp]
11753
+ summary: Bulk import contacts
11754
+ description: |
11755
+ Import up to 1000 contacts at once. Each contact requires a phone number and name.
11756
+ Duplicates are skipped by default. Supports default tags and groups applied to all imported contacts.
11757
+ security:
11758
+ - bearerAuth: []
11759
+ requestBody:
11760
+ required: true
11761
+ content:
11762
+ application/json:
11763
+ schema:
11764
+ type: object
11765
+ required:
11766
+ - accountId
11767
+ - contacts
11768
+ properties:
11769
+ accountId:
11770
+ type: string
11771
+ description: WhatsApp social account ID
11772
+ contacts:
11773
+ type: array
11774
+ maxItems: 1000
11775
+ description: Contacts to import (max 1000)
11776
+ items:
11777
+ type: object
11778
+ required:
11779
+ - phone
11780
+ - name
11781
+ properties:
11782
+ phone:
11783
+ type: string
11784
+ description: Phone number in E.164 format
11785
+ name:
11786
+ type: string
11787
+ description: Contact name
11788
+ email:
11789
+ type: string
11790
+ company:
11791
+ type: string
11792
+ tags:
11793
+ type: array
11794
+ items: { type: string }
11795
+ groups:
11796
+ type: array
11797
+ items: { type: string }
11798
+ customFields:
11799
+ type: object
11800
+ additionalProperties: { type: string }
11801
+ notes:
11802
+ type: string
11803
+ defaultTags:
11804
+ type: array
11805
+ items: { type: string }
11806
+ description: Tags applied to all imported contacts
11807
+ defaultGroups:
11808
+ type: array
11809
+ items: { type: string }
11810
+ description: Groups applied to all imported contacts
11811
+ skipDuplicates:
11812
+ type: boolean
11813
+ default: true
11814
+ description: Skip contacts with existing phone numbers
11815
+ example:
11816
+ accountId: "507f1f77bcf86cd799439011"
11817
+ contacts:
11818
+ - phone: "+1234567890"
11819
+ name: "John Doe"
11820
+ email: "john@example.com"
11821
+ - phone: "+0987654321"
11822
+ name: "Jane Smith"
11823
+ defaultTags: ["imported"]
11824
+ defaultGroups: ["new-leads"]
11825
+ responses:
11826
+ '200':
11827
+ description: Import completed
11828
+ content:
11829
+ application/json:
11830
+ schema:
11831
+ type: object
11832
+ properties:
11833
+ success: { type: boolean }
11834
+ summary:
11835
+ type: object
11836
+ properties:
11837
+ total: { type: integer }
11838
+ created: { type: integer }
11839
+ skipped: { type: integer }
11840
+ failed: { type: integer }
11841
+ results:
11842
+ type: array
11843
+ items:
11844
+ type: object
11845
+ properties:
11846
+ phone: { type: string }
11847
+ name: { type: string }
11848
+ success: { type: boolean }
11849
+ contactId: { type: string }
11850
+ error: { type: string }
11851
+ '400': { description: Validation error (missing fields, too many contacts) }
11852
+ '401': { $ref: '#/components/responses/Unauthorized' }
11853
+ '404': { description: WhatsApp account not found }
11854
+
11855
+ /v1/whatsapp/contacts/bulk:
11856
+ post:
11857
+ operationId: bulkUpdateWhatsAppContacts
11858
+ tags: [WhatsApp]
11859
+ summary: Bulk update contacts
11860
+ description: |
11861
+ Perform bulk operations on multiple contacts (max 500 per request). Supported actions:
11862
+ addTags, removeTags, addGroups, removeGroups, optIn, optOut, block, unblock.
11863
+ security:
11864
+ - bearerAuth: []
11865
+ requestBody:
11866
+ required: true
11867
+ content:
11868
+ application/json:
11869
+ schema:
11870
+ type: object
11871
+ required:
11872
+ - action
11873
+ - contactIds
11874
+ properties:
11875
+ action:
11876
+ type: string
11877
+ enum: [addTags, removeTags, addGroups, removeGroups, optIn, optOut, block, unblock]
11878
+ description: Bulk action to perform
11879
+ contactIds:
11880
+ type: array
11881
+ maxItems: 500
11882
+ items: { type: string }
11883
+ description: Contact IDs to update (max 500)
11884
+ tags:
11885
+ type: array
11886
+ items: { type: string }
11887
+ description: Tags to add or remove (required for addTags/removeTags)
11888
+ groups:
11889
+ type: array
11890
+ items: { type: string }
11891
+ description: Groups to add or remove (required for addGroups/removeGroups)
11892
+ examples:
11893
+ addTags:
11894
+ summary: Add tags to contacts
11895
+ value:
11896
+ action: "addTags"
11897
+ contactIds: ["507f1f77bcf86cd799439011", "507f1f77bcf86cd799439012"]
11898
+ tags: ["vip", "priority"]
11899
+ optOut:
11900
+ summary: Opt out contacts
11901
+ value:
11902
+ action: "optOut"
11903
+ contactIds: ["507f1f77bcf86cd799439011"]
11904
+ responses:
11905
+ '200':
11906
+ description: Bulk update completed
11907
+ content:
11908
+ application/json:
11909
+ schema:
11910
+ type: object
11911
+ properties:
11912
+ success: { type: boolean }
11913
+ action: { type: string }
11914
+ modified: { type: integer, description: Number of contacts modified }
11915
+ matched: { type: integer, description: Number of contacts matched }
11916
+ '400': { description: Validation error (invalid action, missing required fields) }
11917
+ '401': { $ref: '#/components/responses/Unauthorized' }
11918
+ delete:
11919
+ operationId: bulkDeleteWhatsAppContacts
11920
+ tags: [WhatsApp]
11921
+ summary: Bulk delete contacts
11922
+ description: Permanently delete multiple contacts at once (max 500 per request).
11923
+ security:
11924
+ - bearerAuth: []
11925
+ requestBody:
11926
+ required: true
11927
+ content:
11928
+ application/json:
11929
+ schema:
11930
+ type: object
11931
+ required:
11932
+ - contactIds
11933
+ properties:
11934
+ contactIds:
11935
+ type: array
11936
+ maxItems: 500
11937
+ items: { type: string }
11938
+ description: Contact IDs to delete (max 500)
11939
+ example:
11940
+ contactIds: ["507f1f77bcf86cd799439011", "507f1f77bcf86cd799439012"]
11941
+ responses:
11942
+ '200':
11943
+ description: Bulk delete completed
11944
+ content:
11945
+ application/json:
11946
+ schema:
11947
+ type: object
11948
+ properties:
11949
+ success: { type: boolean }
11950
+ deleted: { type: integer, description: Number of contacts deleted }
11951
+ '400': { description: contactIds array is required }
11952
+ '401': { $ref: '#/components/responses/Unauthorized' }
11953
+
11954
+ # ──────────────────────────────────────────────────────────────────────────
11955
+ # GROUPS
11956
+ # ──────────────────────────────────────────────────────────────────────────
11957
+
11958
+ /v1/whatsapp/groups:
11959
+ get:
11960
+ operationId: getWhatsAppGroups
11961
+ tags: [WhatsApp]
11962
+ summary: List contact groups
11963
+ description: |
11964
+ List all contact groups for a WhatsApp account with contact counts.
11965
+ Groups are derived from the groups field on contacts, not stored as separate documents.
11966
+ security:
11967
+ - bearerAuth: []
11968
+ parameters:
11969
+ - name: accountId
11970
+ in: query
11971
+ required: true
11972
+ description: WhatsApp social account ID
11973
+ schema:
11974
+ type: string
11975
+ responses:
11976
+ '200':
11977
+ description: Groups retrieved successfully
11978
+ content:
11979
+ application/json:
11980
+ schema:
11981
+ type: object
11982
+ properties:
11983
+ success: { type: boolean }
11984
+ groups:
11985
+ type: array
11986
+ items:
11987
+ type: object
11988
+ properties:
11989
+ name: { type: string }
11990
+ totalCount: { type: integer, description: Total contacts in this group }
11991
+ optedInCount: { type: integer, description: Opted-in contacts in this group }
11992
+ summary:
11993
+ type: object
11994
+ properties:
11995
+ totalContacts: { type: integer }
11996
+ optedInContacts: { type: integer }
11997
+ groupCount: { type: integer }
11998
+ '400': { description: accountId is required }
11999
+ '401': { $ref: '#/components/responses/Unauthorized' }
12000
+ '404': { description: WhatsApp account not found }
12001
+ post:
12002
+ operationId: renameWhatsAppGroup
12003
+ tags: [WhatsApp]
12004
+ summary: Rename group
12005
+ description: Rename a contact group. This updates the group name on all contacts that belong to the group.
12006
+ security:
12007
+ - bearerAuth: []
12008
+ requestBody:
12009
+ required: true
12010
+ content:
12011
+ application/json:
12012
+ schema:
12013
+ type: object
12014
+ required:
12015
+ - accountId
12016
+ - oldName
12017
+ - newName
12018
+ properties:
12019
+ accountId:
12020
+ type: string
12021
+ description: WhatsApp social account ID
12022
+ oldName:
12023
+ type: string
12024
+ description: Current group name
12025
+ newName:
12026
+ type: string
12027
+ description: New group name
12028
+ example:
12029
+ accountId: "507f1f77bcf86cd799439011"
12030
+ oldName: "customers"
12031
+ newName: "active-customers"
12032
+ responses:
12033
+ '200':
12034
+ description: Group renamed successfully
12035
+ content:
12036
+ application/json:
12037
+ schema:
12038
+ type: object
12039
+ properties:
12040
+ success: { type: boolean }
12041
+ message: { type: string }
12042
+ modified: { type: integer, description: Number of contacts updated }
12043
+ '400': { description: Validation error (missing fields, same name) }
12044
+ '401': { $ref: '#/components/responses/Unauthorized' }
12045
+ '404': { description: WhatsApp account not found }
12046
+ delete:
12047
+ operationId: deleteWhatsAppGroup
12048
+ tags: [WhatsApp]
12049
+ summary: Delete group
12050
+ description: Delete a contact group. This removes the group from all contacts but does not delete the contacts themselves.
12051
+ security:
12052
+ - bearerAuth: []
12053
+ requestBody:
12054
+ required: true
12055
+ content:
12056
+ application/json:
12057
+ schema:
12058
+ type: object
12059
+ required:
12060
+ - accountId
12061
+ - groupName
12062
+ properties:
12063
+ accountId:
12064
+ type: string
12065
+ description: WhatsApp social account ID
12066
+ groupName:
12067
+ type: string
12068
+ description: Group name to delete
12069
+ example:
12070
+ accountId: "507f1f77bcf86cd799439011"
12071
+ groupName: "old-leads"
12072
+ responses:
12073
+ '200':
12074
+ description: Group deleted successfully
12075
+ content:
12076
+ application/json:
12077
+ schema:
12078
+ type: object
12079
+ properties:
12080
+ success: { type: boolean }
12081
+ message: { type: string }
12082
+ modified: { type: integer, description: Number of contacts updated }
12083
+ '400': { description: Validation error (missing fields) }
12084
+ '401': { $ref: '#/components/responses/Unauthorized' }
12085
+ '404': { description: WhatsApp account not found }
12086
+
12087
+ # ──────────────────────────────────────────────────────────────────────────
12088
+ # TEMPLATES
12089
+ # ──────────────────────────────────────────────────────────────────────────
12090
+
12091
+ /v1/whatsapp/templates:
12092
+ get:
12093
+ operationId: getWhatsAppTemplates
12094
+ tags: [WhatsApp]
12095
+ summary: List templates
12096
+ description: |
12097
+ List all message templates for the WhatsApp Business Account (WABA) associated with the given account.
12098
+ Templates are fetched directly from the WhatsApp Cloud API.
12099
+ security:
12100
+ - bearerAuth: []
12101
+ parameters:
12102
+ - name: accountId
12103
+ in: query
12104
+ required: true
12105
+ description: WhatsApp social account ID
12106
+ schema:
12107
+ type: string
12108
+ responses:
12109
+ '200':
12110
+ description: Templates retrieved successfully
12111
+ content:
12112
+ application/json:
12113
+ schema:
12114
+ type: object
12115
+ properties:
12116
+ success: { type: boolean }
12117
+ templates:
12118
+ type: array
12119
+ items:
12120
+ type: object
12121
+ properties:
12122
+ id: { type: string, description: WhatsApp template ID }
12123
+ name: { type: string }
12124
+ status: { type: string, enum: [APPROVED, PENDING, REJECTED] }
12125
+ category: { type: string, enum: [AUTHENTICATION, MARKETING, UTILITY] }
12126
+ language: { type: string }
12127
+ components:
12128
+ type: array
12129
+ items:
12130
+ type: object
12131
+ '400': { description: accountId is required or WABA ID not found }
12132
+ '401': { $ref: '#/components/responses/Unauthorized' }
12133
+ '404': { description: WhatsApp account not found }
12134
+ post:
12135
+ operationId: createWhatsAppTemplate
12136
+ tags: [WhatsApp]
12137
+ summary: Create template
12138
+ description: |
12139
+ Create a new message template. Template names must be lowercase, start with a letter,
12140
+ and contain only letters, numbers, and underscores. Templates are submitted to Meta for review.
12141
+ security:
12142
+ - bearerAuth: []
12143
+ requestBody:
12144
+ required: true
12145
+ content:
12146
+ application/json:
12147
+ schema:
12148
+ type: object
12149
+ required:
12150
+ - accountId
12151
+ - name
12152
+ - category
12153
+ - language
12154
+ - components
12155
+ properties:
12156
+ accountId:
12157
+ type: string
12158
+ description: WhatsApp social account ID
12159
+ name:
12160
+ type: string
12161
+ pattern: "^[a-z][a-z0-9_]*$"
12162
+ description: Template name (lowercase, letters/numbers/underscores, must start with a letter)
12163
+ category:
12164
+ type: string
12165
+ enum: [AUTHENTICATION, MARKETING, UTILITY]
12166
+ description: Template category
12167
+ language:
12168
+ type: string
12169
+ description: Template language code (e.g., en_US)
12170
+ components:
12171
+ type: array
12172
+ description: Template components (header, body, footer, buttons)
12173
+ items:
12174
+ type: object
12175
+ example:
12176
+ accountId: "507f1f77bcf86cd799439011"
12177
+ name: "order_confirmation"
12178
+ category: "UTILITY"
12179
+ language: "en_US"
12180
+ components:
12181
+ - type: "body"
12182
+ text: "Your order {{1}} has been confirmed. Expected delivery: {{2}}"
12183
+ responses:
12184
+ '200':
12185
+ description: Template created and submitted for review
12186
+ content:
12187
+ application/json:
12188
+ schema:
12189
+ type: object
12190
+ properties:
12191
+ success: { type: boolean }
12192
+ template:
12193
+ type: object
12194
+ properties:
12195
+ id: { type: string }
12196
+ name: { type: string }
12197
+ status: { type: string }
12198
+ category: { type: string }
12199
+ language: { type: string }
12200
+ '400': { description: Validation error (invalid name format, missing fields, invalid category) }
12201
+ '401': { $ref: '#/components/responses/Unauthorized' }
12202
+ '404': { description: WhatsApp account not found }
12203
+
12204
+ /v1/whatsapp/templates/{templateName}:
12205
+ get:
12206
+ operationId: getWhatsAppTemplate
12207
+ tags: [WhatsApp]
12208
+ summary: Get template
12209
+ description: Retrieve a single message template by name.
12210
+ security:
12211
+ - bearerAuth: []
12212
+ parameters:
12213
+ - name: templateName
12214
+ in: path
12215
+ required: true
12216
+ description: Template name
12217
+ schema:
12218
+ type: string
12219
+ - name: accountId
12220
+ in: query
12221
+ required: true
12222
+ description: WhatsApp social account ID
12223
+ schema:
12224
+ type: string
12225
+ responses:
12226
+ '200':
12227
+ description: Template retrieved successfully
12228
+ content:
12229
+ application/json:
12230
+ schema:
12231
+ type: object
12232
+ properties:
12233
+ success: { type: boolean }
12234
+ template:
12235
+ type: object
12236
+ properties:
12237
+ id: { type: string }
12238
+ name: { type: string }
12239
+ status: { type: string }
12240
+ category: { type: string }
12241
+ language: { type: string }
12242
+ components:
12243
+ type: array
12244
+ items:
12245
+ type: object
12246
+ '400': { description: accountId is required }
12247
+ '401': { $ref: '#/components/responses/Unauthorized' }
12248
+ '404': { $ref: '#/components/responses/NotFound' }
12249
+ patch:
12250
+ operationId: updateWhatsAppTemplate
12251
+ tags: [WhatsApp]
12252
+ summary: Update template
12253
+ description: |
12254
+ Update a message template's components. Only certain fields can be updated depending on
12255
+ the template's current approval state. Approved templates can only have components updated.
12256
+ security:
12257
+ - bearerAuth: []
12258
+ parameters:
12259
+ - name: templateName
12260
+ in: path
12261
+ required: true
12262
+ description: Template name
12263
+ schema:
12264
+ type: string
12265
+ requestBody:
12266
+ required: true
12267
+ content:
12268
+ application/json:
12269
+ schema:
12270
+ type: object
12271
+ required:
12272
+ - accountId
12273
+ - components
12274
+ properties:
12275
+ accountId:
12276
+ type: string
12277
+ description: WhatsApp social account ID
12278
+ components:
12279
+ type: array
12280
+ description: Updated template components
12281
+ items:
12282
+ type: object
12283
+ example:
12284
+ accountId: "507f1f77bcf86cd799439011"
12285
+ components:
12286
+ - type: "body"
12287
+ text: "Updated: Your order {{1}} is confirmed. Delivery by {{2}}"
12288
+ responses:
12289
+ '200':
12290
+ description: Template updated successfully
12291
+ content:
12292
+ application/json:
12293
+ schema:
12294
+ type: object
12295
+ properties:
12296
+ success: { type: boolean }
12297
+ template:
12298
+ type: object
12299
+ properties:
12300
+ id: { type: string }
12301
+ name: { type: string }
12302
+ status: { type: string }
12303
+ '400': { description: Validation error (missing fields) }
12304
+ '401': { $ref: '#/components/responses/Unauthorized' }
12305
+ '404': { $ref: '#/components/responses/NotFound' }
12306
+ delete:
12307
+ operationId: deleteWhatsAppTemplate
12308
+ tags: [WhatsApp]
12309
+ summary: Delete template
12310
+ description: Permanently delete a message template by name.
12311
+ security:
12312
+ - bearerAuth: []
12313
+ parameters:
12314
+ - name: templateName
12315
+ in: path
12316
+ required: true
12317
+ description: Template name
12318
+ schema:
12319
+ type: string
12320
+ - name: accountId
12321
+ in: query
12322
+ required: true
12323
+ description: WhatsApp social account ID
12324
+ schema:
12325
+ type: string
12326
+ responses:
12327
+ '200':
12328
+ description: Template deleted successfully
12329
+ content:
12330
+ application/json:
12331
+ schema:
12332
+ type: object
12333
+ properties:
12334
+ success: { type: boolean }
12335
+ message: { type: string }
12336
+ example:
12337
+ success: true
12338
+ message: "Template \"order_confirmation\" deleted successfully"
12339
+ '400': { description: accountId or template name is required }
12340
+ '401': { $ref: '#/components/responses/Unauthorized' }
12341
+ '404': { $ref: '#/components/responses/NotFound' }
12342
+
12343
+ # ──────────────────────────────────────────────────────────────────────────
12344
+ # BROADCASTS
12345
+ # ──────────────────────────────────────────────────────────────────────────
12346
+
12347
+ /v1/whatsapp/broadcasts:
12348
+ get:
12349
+ operationId: getWhatsAppBroadcasts
12350
+ tags: [WhatsApp]
12351
+ summary: List broadcasts
12352
+ description: |
12353
+ List all WhatsApp broadcasts for an account. Returns broadcasts sorted by creation date
12354
+ (newest first) without the full recipients list for performance.
12355
+ security:
12356
+ - bearerAuth: []
12357
+ parameters:
12358
+ - name: accountId
12359
+ in: query
12360
+ required: true
12361
+ description: WhatsApp social account ID
12362
+ schema:
12363
+ type: string
12364
+ - name: status
12365
+ in: query
12366
+ required: false
12367
+ description: Filter by broadcast status
12368
+ schema:
12369
+ type: string
12370
+ enum: [draft, scheduled, sending, completed, failed, cancelled]
12371
+ - name: limit
12372
+ in: query
12373
+ required: false
12374
+ description: Maximum results (default 50)
12375
+ schema:
12376
+ type: integer
12377
+ default: 50
12378
+ - name: skip
12379
+ in: query
12380
+ required: false
12381
+ description: Offset for pagination
12382
+ schema:
12383
+ type: integer
12384
+ default: 0
12385
+ responses:
12386
+ '200':
12387
+ description: Broadcasts retrieved successfully
12388
+ content:
12389
+ application/json:
12390
+ schema:
12391
+ type: object
12392
+ properties:
12393
+ success: { type: boolean }
12394
+ broadcasts:
12395
+ type: array
12396
+ items:
12397
+ type: object
12398
+ properties:
12399
+ id: { type: string }
12400
+ name: { type: string }
12401
+ description: { type: string }
12402
+ template:
12403
+ type: object
12404
+ properties:
12405
+ name: { type: string }
12406
+ language: { type: string }
12407
+ status: { type: string, enum: [draft, scheduled, sending, completed, failed, cancelled] }
12408
+ recipientCount: { type: integer }
12409
+ scheduledAt: { type: string, format: date-time }
12410
+ startedAt: { type: string, format: date-time }
12411
+ completedAt: { type: string, format: date-time }
12412
+ sentCount: { type: integer }
12413
+ deliveredCount: { type: integer }
12414
+ readCount: { type: integer }
12415
+ failedCount: { type: integer }
12416
+ createdAt: { type: string, format: date-time }
12417
+ pagination:
12418
+ type: object
12419
+ properties:
12420
+ total: { type: integer }
12421
+ limit: { type: integer }
12422
+ skip: { type: integer }
12423
+ hasMore: { type: boolean }
12424
+ '400': { description: accountId is required }
12425
+ '401': { $ref: '#/components/responses/Unauthorized' }
12426
+ '404': { description: WhatsApp account not found }
12427
+ post:
12428
+ operationId: createWhatsAppBroadcast
12429
+ tags: [WhatsApp]
12430
+ summary: Create broadcast
12431
+ description: |
12432
+ Create a new draft broadcast. Optionally include initial recipients.
12433
+ After creation, add recipients and then send or schedule the broadcast.
12434
+ security:
12435
+ - bearerAuth: []
12436
+ requestBody:
12437
+ required: true
12438
+ content:
12439
+ application/json:
12440
+ schema:
12441
+ type: object
12442
+ required:
12443
+ - accountId
12444
+ - name
12445
+ - template
12446
+ properties:
12447
+ accountId:
12448
+ type: string
12449
+ description: WhatsApp social account ID
12450
+ name:
12451
+ type: string
12452
+ description: Broadcast name
12453
+ description:
12454
+ type: string
12455
+ description: Broadcast description
12456
+ template:
12457
+ type: object
12458
+ required:
12459
+ - name
12460
+ - language
12461
+ properties:
12462
+ name:
12463
+ type: string
12464
+ description: Template name
12465
+ language:
12466
+ type: string
12467
+ description: Template language code
12468
+ components:
12469
+ type: array
12470
+ description: Base template components
12471
+ items:
12472
+ type: object
12473
+ recipients:
12474
+ type: array
12475
+ description: Initial recipients (optional)
12476
+ items:
12477
+ type: object
12478
+ required:
12479
+ - phone
12480
+ properties:
12481
+ phone:
12482
+ type: string
12483
+ description: Phone number in E.164 format
12484
+ name:
12485
+ type: string
12486
+ variables:
12487
+ type: object
12488
+ additionalProperties: { type: string }
12489
+ description: Per-recipient template variables
12490
+ example:
12491
+ accountId: "507f1f77bcf86cd799439011"
12492
+ name: "Weekly Newsletter"
12493
+ description: "Weekly product updates"
12494
+ template:
12495
+ name: "weekly_update"
12496
+ language: "en_US"
12497
+ recipients:
12498
+ - phone: "+1234567890"
12499
+ name: "John"
12500
+ variables: { "1": "John" }
12501
+ responses:
12502
+ '200':
12503
+ description: Broadcast created as draft
12504
+ content:
12505
+ application/json:
12506
+ schema:
12507
+ type: object
12508
+ properties:
12509
+ success: { type: boolean }
12510
+ broadcast:
12511
+ type: object
12512
+ properties:
12513
+ id: { type: string }
12514
+ name: { type: string }
12515
+ description: { type: string }
12516
+ template: { type: object }
12517
+ status: { type: string, description: Always "draft" for new broadcasts }
12518
+ recipientCount: { type: integer }
12519
+ createdAt: { type: string, format: date-time }
12520
+ '400': { description: Validation error (missing name, template, etc.) }
12521
+ '401': { $ref: '#/components/responses/Unauthorized' }
12522
+ '404': { description: WhatsApp account not found }
12523
+
12524
+ /v1/whatsapp/broadcasts/{broadcastId}:
12525
+ get:
12526
+ operationId: getWhatsAppBroadcast
12527
+ tags: [WhatsApp]
12528
+ summary: Get broadcast
12529
+ description: Retrieve detailed information about a single broadcast including delivery statistics.
12530
+ security:
12531
+ - bearerAuth: []
12532
+ parameters:
12533
+ - name: broadcastId
12534
+ in: path
12535
+ required: true
12536
+ description: Broadcast ID
12537
+ schema:
12538
+ type: string
12539
+ responses:
12540
+ '200':
12541
+ description: Broadcast retrieved successfully
12542
+ content:
12543
+ application/json:
12544
+ schema:
12545
+ type: object
12546
+ properties:
12547
+ success: { type: boolean }
12548
+ broadcast:
12549
+ type: object
12550
+ properties:
12551
+ id: { type: string }
12552
+ name: { type: string }
12553
+ description: { type: string }
12554
+ template: { type: object }
12555
+ status: { type: string, enum: [draft, scheduled, sending, completed, failed, cancelled] }
12556
+ recipientCount: { type: integer }
12557
+ scheduledAt: { type: string, format: date-time }
12558
+ startedAt: { type: string, format: date-time }
12559
+ completedAt: { type: string, format: date-time }
12560
+ sentCount: { type: integer }
12561
+ deliveredCount: { type: integer }
12562
+ readCount: { type: integer }
12563
+ failedCount: { type: integer }
12564
+ createdAt: { type: string, format: date-time }
12565
+ updatedAt: { type: string, format: date-time }
12566
+ '401': { $ref: '#/components/responses/Unauthorized' }
12567
+ '404': { $ref: '#/components/responses/NotFound' }
12568
+ delete:
12569
+ operationId: deleteWhatsAppBroadcast
12570
+ tags: [WhatsApp]
12571
+ summary: Delete broadcast
12572
+ description: Delete a broadcast. Only draft or cancelled broadcasts can be deleted.
12573
+ security:
12574
+ - bearerAuth: []
12575
+ parameters:
12576
+ - name: broadcastId
12577
+ in: path
12578
+ required: true
12579
+ description: Broadcast ID
12580
+ schema:
12581
+ type: string
12582
+ responses:
12583
+ '200':
12584
+ description: Broadcast deleted successfully
12585
+ content:
12586
+ application/json:
12587
+ schema:
12588
+ type: object
12589
+ properties:
12590
+ success: { type: boolean }
12591
+ message: { type: string }
12592
+ example:
12593
+ success: true
12594
+ message: "Broadcast deleted successfully"
12595
+ '400': { description: Can only delete draft or cancelled broadcasts }
12596
+ '401': { $ref: '#/components/responses/Unauthorized' }
12597
+ '404': { $ref: '#/components/responses/NotFound' }
12598
+
12599
+ /v1/whatsapp/broadcasts/{broadcastId}/send:
12600
+ post:
12601
+ operationId: sendWhatsAppBroadcast
12602
+ tags: [WhatsApp]
12603
+ summary: Send broadcast
12604
+ description: |
12605
+ Start sending a broadcast immediately. The broadcast must be in draft or scheduled status
12606
+ and have at least one recipient. Messages are sent sequentially with rate limiting.
12607
+ security:
12608
+ - bearerAuth: []
12609
+ parameters:
12610
+ - name: broadcastId
12611
+ in: path
12612
+ required: true
12613
+ description: Broadcast ID
12614
+ schema:
12615
+ type: string
12616
+ responses:
12617
+ '200':
12618
+ description: Broadcast send completed
12619
+ content:
12620
+ application/json:
12621
+ schema:
12622
+ type: object
12623
+ properties:
12624
+ success: { type: boolean }
12625
+ status: { type: string, enum: [completed, failed], description: Final broadcast status }
12626
+ sent: { type: integer, description: Number of messages sent successfully }
12627
+ failed: { type: integer, description: Number of messages that failed }
12628
+ total: { type: integer, description: Total recipient count }
12629
+ example:
12630
+ success: true
12631
+ status: "completed"
12632
+ sent: 95
12633
+ failed: 5
12634
+ total: 100
12635
+ '400': { description: Invalid broadcast status or no recipients }
12636
+ '401': { $ref: '#/components/responses/Unauthorized' }
12637
+ '404': { $ref: '#/components/responses/NotFound' }
12638
+
12639
+ /v1/whatsapp/broadcasts/{broadcastId}/schedule:
12640
+ post:
12641
+ operationId: scheduleWhatsAppBroadcast
12642
+ tags: [WhatsApp]
12643
+ summary: Schedule broadcast
12644
+ description: |
12645
+ Schedule a draft broadcast for future sending. The scheduled time must be in the future
12646
+ and no more than 30 days in advance. The broadcast must be in draft status and have recipients.
12647
+ security:
12648
+ - bearerAuth: []
12649
+ parameters:
12650
+ - name: broadcastId
12651
+ in: path
12652
+ required: true
12653
+ description: Broadcast ID
12654
+ schema:
12655
+ type: string
12656
+ requestBody:
12657
+ required: true
12658
+ content:
12659
+ application/json:
12660
+ schema:
12661
+ type: object
12662
+ required:
12663
+ - scheduledAt
12664
+ properties:
12665
+ scheduledAt:
12666
+ type: string
12667
+ format: date-time
12668
+ description: ISO 8601 date-time for sending (must be in the future, max 30 days)
12669
+ example:
12670
+ scheduledAt: "2026-03-15T10:00:00Z"
12671
+ responses:
12672
+ '200':
12673
+ description: Broadcast scheduled successfully
12674
+ content:
12675
+ application/json:
12676
+ schema:
12677
+ type: object
12678
+ properties:
12679
+ success: { type: boolean }
12680
+ broadcast:
12681
+ type: object
12682
+ properties:
12683
+ id: { type: string }
12684
+ status: { type: string, description: "\"scheduled\"" }
12685
+ scheduledAt: { type: string, format: date-time }
12686
+ '400': { description: Invalid schedule time or broadcast not in draft status }
12687
+ '401': { $ref: '#/components/responses/Unauthorized' }
12688
+ '404': { $ref: '#/components/responses/NotFound' }
12689
+ delete:
12690
+ operationId: cancelWhatsAppBroadcastSchedule
12691
+ tags: [WhatsApp]
12692
+ summary: Cancel scheduled broadcast
12693
+ description: |
12694
+ Cancel a scheduled broadcast and return it to draft status. Only broadcasts in
12695
+ scheduled status can be cancelled.
12696
+ security:
12697
+ - bearerAuth: []
12698
+ parameters:
12699
+ - name: broadcastId
12700
+ in: path
12701
+ required: true
12702
+ description: Broadcast ID
12703
+ schema:
12704
+ type: string
12705
+ responses:
12706
+ '200':
12707
+ description: Schedule cancelled, broadcast returned to draft
12708
+ content:
12709
+ application/json:
12710
+ schema:
12711
+ type: object
12712
+ properties:
12713
+ success: { type: boolean }
12714
+ broadcast:
12715
+ type: object
12716
+ properties:
12717
+ id: { type: string }
12718
+ status: { type: string, description: "\"draft\"" }
12719
+ message: { type: string }
12720
+ example:
12721
+ success: true
12722
+ broadcast:
12723
+ id: "507f1f77bcf86cd799439011"
12724
+ status: "draft"
12725
+ message: "Broadcast returned to draft status"
12726
+ '400': { description: Broadcast is not scheduled }
12727
+ '401': { $ref: '#/components/responses/Unauthorized' }
12728
+ '404': { $ref: '#/components/responses/NotFound' }
12729
+
12730
+ /v1/whatsapp/broadcasts/{broadcastId}/recipients:
12731
+ get:
12732
+ operationId: getWhatsAppBroadcastRecipients
12733
+ tags: [WhatsApp]
12734
+ summary: List recipients
12735
+ description: |
12736
+ List recipients of a broadcast with their delivery status. Supports filtering
12737
+ by delivery status and pagination.
12738
+ security:
12739
+ - bearerAuth: []
12740
+ parameters:
12741
+ - name: broadcastId
12742
+ in: path
12743
+ required: true
12744
+ description: Broadcast ID
12745
+ schema:
12746
+ type: string
12747
+ - name: status
12748
+ in: query
12749
+ required: false
12750
+ description: Filter by recipient delivery status
12751
+ schema:
12752
+ type: string
12753
+ enum: [pending, sent, delivered, read, failed]
12754
+ - name: limit
12755
+ in: query
12756
+ required: false
12757
+ description: Maximum results (default 100)
12758
+ schema:
12759
+ type: integer
12760
+ default: 100
12761
+ - name: skip
12762
+ in: query
12763
+ required: false
12764
+ description: Offset for pagination
12765
+ schema:
12766
+ type: integer
12767
+ default: 0
12768
+ responses:
12769
+ '200':
12770
+ description: Recipients retrieved successfully
12771
+ content:
12772
+ application/json:
12773
+ schema:
12774
+ type: object
12775
+ properties:
12776
+ success: { type: boolean }
12777
+ recipients:
12778
+ type: array
12779
+ items:
12780
+ type: object
12781
+ properties:
12782
+ phone: { type: string }
12783
+ name: { type: string }
12784
+ variables: { type: object }
12785
+ status: { type: string, enum: [pending, sent, delivered, read, failed] }
12786
+ messageId: { type: string }
12787
+ error: { type: string }
12788
+ sentAt: { type: string, format: date-time }
12789
+ deliveredAt: { type: string, format: date-time }
12790
+ readAt: { type: string, format: date-time }
12791
+ pagination:
12792
+ type: object
12793
+ properties:
12794
+ total: { type: integer }
12795
+ limit: { type: integer }
12796
+ skip: { type: integer }
12797
+ hasMore: { type: boolean }
12798
+ summary:
12799
+ type: object
12800
+ properties:
12801
+ total: { type: integer }
12802
+ pending: { type: integer }
12803
+ sent: { type: integer }
12804
+ delivered: { type: integer }
12805
+ read: { type: integer }
12806
+ failed: { type: integer }
12807
+ '401': { $ref: '#/components/responses/Unauthorized' }
12808
+ '404': { $ref: '#/components/responses/NotFound' }
12809
+ patch:
12810
+ operationId: addWhatsAppBroadcastRecipients
12811
+ tags: [WhatsApp]
12812
+ summary: Add recipients
12813
+ description: |
12814
+ Add recipients to a draft broadcast. Maximum 1000 recipients per request.
12815
+ Duplicate phone numbers are automatically skipped.
12816
+ security:
12817
+ - bearerAuth: []
12818
+ parameters:
12819
+ - name: broadcastId
12820
+ in: path
12821
+ required: true
12822
+ description: Broadcast ID
12823
+ schema:
12824
+ type: string
12825
+ requestBody:
12826
+ required: true
12827
+ content:
12828
+ application/json:
12829
+ schema:
12830
+ type: object
12831
+ required:
12832
+ - recipients
12833
+ properties:
12834
+ recipients:
12835
+ type: array
12836
+ maxItems: 1000
12837
+ description: Recipients to add (max 1000)
12838
+ items:
12839
+ type: object
12840
+ required:
12841
+ - phone
12842
+ properties:
12843
+ phone:
12844
+ type: string
12845
+ description: Phone number in E.164 format
12846
+ name:
12847
+ type: string
12848
+ variables:
12849
+ type: object
12850
+ additionalProperties: { type: string }
12851
+ example:
12852
+ recipients:
12853
+ - phone: "+1234567890"
12854
+ name: "John"
12855
+ variables: { "1": "John" }
12856
+ - phone: "+0987654321"
12857
+ name: "Jane"
12858
+ responses:
12859
+ '200':
12860
+ description: Recipients added successfully
12861
+ content:
12862
+ application/json:
12863
+ schema:
12864
+ type: object
12865
+ properties:
12866
+ success: { type: boolean }
12867
+ added: { type: integer, description: Number of new recipients added }
12868
+ duplicates: { type: integer, description: Number of duplicate phone numbers skipped }
12869
+ totalRecipients: { type: integer, description: Total recipient count after addition }
12870
+ '400': { description: Validation error or broadcast not in draft status }
12871
+ '401': { $ref: '#/components/responses/Unauthorized' }
12872
+ '404': { $ref: '#/components/responses/NotFound' }
12873
+ delete:
12874
+ operationId: removeWhatsAppBroadcastRecipients
12875
+ tags: [WhatsApp]
12876
+ summary: Remove recipients
12877
+ description: Remove recipients from a draft broadcast by phone number.
12878
+ security:
12879
+ - bearerAuth: []
12880
+ parameters:
12881
+ - name: broadcastId
12882
+ in: path
12883
+ required: true
12884
+ description: Broadcast ID
12885
+ schema:
12886
+ type: string
12887
+ requestBody:
12888
+ required: true
12889
+ content:
12890
+ application/json:
12891
+ schema:
12892
+ type: object
12893
+ required:
12894
+ - phones
12895
+ properties:
12896
+ phones:
12897
+ type: array
12898
+ items: { type: string }
12899
+ description: Phone numbers to remove
12900
+ example:
12901
+ phones: ["+1234567890", "+0987654321"]
12902
+ responses:
12903
+ '200':
12904
+ description: Recipients removed successfully
12905
+ content:
12906
+ application/json:
12907
+ schema:
12908
+ type: object
12909
+ properties:
12910
+ success: { type: boolean }
12911
+ removed: { type: integer, description: Number of recipients removed }
12912
+ totalRecipients: { type: integer, description: Remaining recipient count }
12913
+ '400': { description: Validation error or broadcast not in draft status }
12914
+ '401': { $ref: '#/components/responses/Unauthorized' }
12915
+ '404': { $ref: '#/components/responses/NotFound' }
12916
+
12917
+ # ──────────────────────────────────────────────────────────────────────────
12918
+ # BUSINESS PROFILE
12919
+ # ──────────────────────────────────────────────────────────────────────────
12920
+
12921
+ /v1/whatsapp/business-profile:
12922
+ get:
12923
+ operationId: getWhatsAppBusinessProfile
12924
+ tags: [WhatsApp]
12925
+ summary: Get business profile
12926
+ description: Retrieve the WhatsApp Business profile for the account (about, address, description, email, websites, etc.).
12927
+ security:
12928
+ - bearerAuth: []
12929
+ parameters:
12930
+ - name: accountId
12931
+ in: query
12932
+ required: true
12933
+ description: WhatsApp social account ID
12934
+ schema:
12935
+ type: string
12936
+ responses:
12937
+ '200':
12938
+ description: Business profile retrieved successfully
12939
+ content:
12940
+ application/json:
12941
+ schema:
12942
+ type: object
12943
+ properties:
12944
+ success: { type: boolean }
12945
+ businessProfile:
12946
+ type: object
12947
+ properties:
12948
+ about: { type: string, description: Short description (max 139 chars) }
12949
+ address: { type: string }
12950
+ description: { type: string, description: Full description (max 512 chars) }
12951
+ email: { type: string }
12952
+ profilePictureUrl: { type: string, format: uri }
12953
+ websites:
12954
+ type: array
12955
+ items: { type: string }
12956
+ maxItems: 2
12957
+ vertical: { type: string, description: Business category }
12958
+ '400': { description: accountId is required or phone number ID not found }
12959
+ '401': { $ref: '#/components/responses/Unauthorized' }
12960
+ '404': { description: WhatsApp account not found }
12961
+ post:
12962
+ operationId: updateWhatsAppBusinessProfile
12963
+ tags: [WhatsApp]
12964
+ summary: Update business profile
12965
+ description: |
12966
+ Update the WhatsApp Business profile. All fields are optional; only provided fields will be updated.
12967
+ Constraints: about max 139 chars, description max 512 chars, max 2 websites.
12968
+ security:
12969
+ - bearerAuth: []
12970
+ requestBody:
12971
+ required: true
12972
+ content:
12973
+ application/json:
12974
+ schema:
12975
+ type: object
12976
+ required:
12977
+ - accountId
12978
+ properties:
12979
+ accountId:
12980
+ type: string
12981
+ description: WhatsApp social account ID
12982
+ about:
12983
+ type: string
12984
+ maxLength: 139
12985
+ description: Short business description (max 139 characters)
12986
+ address:
12987
+ type: string
12988
+ description: Business address
12989
+ description:
12990
+ type: string
12991
+ maxLength: 512
12992
+ description: Full business description (max 512 characters)
12993
+ email:
12994
+ type: string
12995
+ format: email
12996
+ description: Business email
12997
+ websites:
12998
+ type: array
12999
+ maxItems: 2
13000
+ items: { type: string, format: uri }
13001
+ description: Business websites (max 2)
13002
+ vertical:
13003
+ type: string
13004
+ description: Business category (e.g., RETAIL, ENTERTAINMENT, etc.)
13005
+ profilePictureHandle:
13006
+ type: string
13007
+ description: Handle from resumable upload for profile picture
13008
+ example:
13009
+ accountId: "507f1f77bcf86cd799439011"
13010
+ about: "We help businesses grow"
13011
+ description: "Premium business solutions for startups and enterprises"
13012
+ email: "hello@example.com"
13013
+ websites: ["https://example.com"]
13014
+ responses:
13015
+ '200':
13016
+ description: Business profile updated successfully
13017
+ content:
13018
+ application/json:
13019
+ schema:
13020
+ type: object
13021
+ properties:
13022
+ success: { type: boolean }
13023
+ message: { type: string }
13024
+ example:
13025
+ success: true
13026
+ message: "Business profile updated successfully"
13027
+ '400': { description: Validation error (field too long, too many websites, etc.) }
13028
+ '401': { $ref: '#/components/responses/Unauthorized' }
13029
+ '404': { description: WhatsApp account not found }
13030
+
13031
+ # ──────────────────────────────────────────────────────────────────────────
13032
+ # PHONE NUMBERS
13033
+ # ──────────────────────────────────────────────────────────────────────────
13034
+
13035
+ /v1/whatsapp/phone-numbers:
13036
+ get:
13037
+ operationId: getWhatsAppPhoneNumbers
13038
+ tags: [WhatsApp Phone Numbers]
13039
+ summary: List phone numbers
13040
+ description: |
13041
+ List all WhatsApp phone numbers purchased by the authenticated user.
13042
+ By default, released numbers are excluded.
13043
+ security:
13044
+ - bearerAuth: []
13045
+ parameters:
13046
+ - name: status
13047
+ in: query
13048
+ required: false
13049
+ description: Filter by status (by default excludes released numbers)
13050
+ schema:
13051
+ type: string
13052
+ enum: [provisioning, active, suspended, releasing, released]
13053
+ - name: profileId
13054
+ in: query
13055
+ required: false
13056
+ description: Filter by profile
13057
+ schema:
13058
+ type: string
13059
+ responses:
13060
+ '200':
13061
+ description: Phone numbers retrieved successfully
13062
+ content:
13063
+ application/json:
13064
+ schema:
13065
+ type: object
13066
+ properties:
13067
+ numbers:
13068
+ type: array
13069
+ items:
13070
+ type: object
13071
+ properties:
13072
+ _id: { type: string }
13073
+ phoneNumber: { type: string }
13074
+ country: { type: string }
13075
+ status: { type: string, enum: [pending_payment, provisioning, active, suspended, releasing, released] }
13076
+ profileId: { type: object }
13077
+ provisionedAt: { type: string, format: date-time }
13078
+ metaPreverifiedId: { type: string }
13079
+ metaVerificationStatus: { type: string }
13080
+ createdAt: { type: string, format: date-time }
13081
+ '401': { $ref: '#/components/responses/Unauthorized' }
13082
+
13083
+ /v1/whatsapp/phone-numbers/available:
13084
+ get:
13085
+ operationId: searchAvailableWhatsAppNumbers
13086
+ tags: [WhatsApp Phone Numbers]
13087
+ summary: Search available numbers
13088
+ description: |
13089
+ Search for available US phone numbers that can be purchased for WhatsApp Business.
13090
+ Requires a paid plan. Numbers are sourced from Telnyx.
13091
+ security:
13092
+ - bearerAuth: []
13093
+ parameters:
13094
+ - name: prefix
13095
+ in: query
13096
+ required: false
13097
+ description: Area code to search (e.g., "212" for New York)
13098
+ schema:
13099
+ type: string
13100
+ - name: locality
13101
+ in: query
13102
+ required: false
13103
+ description: City name (e.g., "New York")
13104
+ schema:
13105
+ type: string
13106
+ - name: contains
13107
+ in: query
13108
+ required: false
13109
+ description: Pattern to match within the phone number
13110
+ schema:
13111
+ type: string
13112
+ - name: limit
13113
+ in: query
13114
+ required: false
13115
+ description: Maximum results (default 20, max 100)
13116
+ schema:
13117
+ type: integer
13118
+ default: 20
13119
+ maximum: 100
13120
+ responses:
13121
+ '200':
13122
+ description: Available numbers retrieved
13123
+ content:
13124
+ application/json:
13125
+ schema:
13126
+ type: object
13127
+ properties:
13128
+ numbers:
13129
+ type: array
13130
+ items:
13131
+ type: object
13132
+ '401': { $ref: '#/components/responses/Unauthorized' }
13133
+ '403': { description: A paid plan is required }
13134
+
13135
+ /v1/whatsapp/phone-numbers/preverified:
13136
+ get:
13137
+ operationId: getPreverifiedWhatsAppNumbers
13138
+ tags: [WhatsApp Phone Numbers]
13139
+ summary: Get pre-verified numbers
13140
+ description: |
13141
+ Returns the user's pre-verified phone number IDs that are ready for OTP-free
13142
+ Embedded Signup. Only returns numbers with verified Meta status and non-expired verification.
13143
+ security:
13144
+ - bearerAuth: []
13145
+ parameters:
13146
+ - name: profileId
13147
+ in: query
13148
+ required: true
13149
+ description: Profile ID to filter by
13150
+ schema:
13151
+ type: string
13152
+ responses:
13153
+ '200':
13154
+ description: Pre-verified numbers retrieved
13155
+ content:
13156
+ application/json:
13157
+ schema:
13158
+ type: object
13159
+ properties:
13160
+ preVerifiedIds:
13161
+ type: array
13162
+ items: { type: string }
13163
+ description: IDs to pass in FB.login() extras.setup.preVerifiedPhone.ids
13164
+ numbers:
13165
+ type: array
13166
+ items:
13167
+ type: object
13168
+ properties:
13169
+ id: { type: string }
13170
+ phoneNumber: { type: string }
13171
+ metaPreverifiedId: { type: string }
13172
+ metaVerifiedAt: { type: string, format: date-time }
13173
+ metaVerificationExpiresAt: { type: string, format: date-time }
13174
+ '400': { description: profileId is required }
13175
+ '401': { $ref: '#/components/responses/Unauthorized' }
13176
+
13177
+ /v1/whatsapp/phone-numbers/purchase:
13178
+ post:
13179
+ operationId: purchaseWhatsAppPhoneNumber
13180
+ tags: [WhatsApp Phone Numbers]
13181
+ summary: Purchase phone number
13182
+ description: |
13183
+ Initiate purchasing a WhatsApp phone number. Payment-first flow: the user does not pick
13184
+ a specific number. The system either creates a Stripe Checkout Session (first number)
13185
+ or increments the existing subscription quantity and provisions inline (subsequent numbers).
13186
+
13187
+ Requires a paid plan. The maximum number of phone numbers is determined by the user's plan.
13188
+ security:
13189
+ - bearerAuth: []
13190
+ requestBody:
13191
+ required: true
13192
+ content:
13193
+ application/json:
13194
+ schema:
13195
+ type: object
13196
+ required:
13197
+ - profileId
13198
+ properties:
13199
+ profileId:
13200
+ type: string
13201
+ description: Profile to associate the number with
13202
+ example:
13203
+ profileId: "507f1f77bcf86cd799439011"
13204
+ responses:
13205
+ '200':
13206
+ description: |
13207
+ Either a checkout URL (first number) or the provisioned phone number (subsequent numbers).
13208
+ content:
13209
+ application/json:
13210
+ schema:
13211
+ oneOf:
13212
+ - type: object
13213
+ description: Checkout session created (first number)
13214
+ properties:
13215
+ message: { type: string }
13216
+ checkoutUrl: { type: string, format: uri }
13217
+ - type: object
13218
+ description: Phone number provisioned inline (subsequent numbers)
13219
+ properties:
13220
+ message: { type: string }
13221
+ phoneNumber:
13222
+ type: object
13223
+ properties:
13224
+ id: { type: string }
13225
+ phoneNumber: { type: string }
13226
+ status: { type: string }
13227
+ country: { type: string }
13228
+ provisionedAt: { type: string, format: date-time }
13229
+ metaPreverifiedId: { type: string }
13230
+ metaVerificationStatus: { type: string }
13231
+ '400': { description: Plan limit reached or profileId required }
13232
+ '401': { $ref: '#/components/responses/Unauthorized' }
13233
+ '403': { description: A paid plan is required }
13234
+
13235
+ /v1/whatsapp/phone-numbers/{phoneNumberId}:
13236
+ get:
13237
+ operationId: getWhatsAppPhoneNumber
13238
+ tags: [WhatsApp Phone Numbers]
13239
+ summary: Get phone number
13240
+ description: |
13241
+ Retrieve the current status of a purchased phone number. Used to poll for
13242
+ Meta pre-verification completion after purchase.
13243
+ security:
13244
+ - bearerAuth: []
13245
+ parameters:
13246
+ - name: phoneNumberId
13247
+ in: path
13248
+ required: true
13249
+ description: Phone number record ID
13250
+ schema:
13251
+ type: string
13252
+ responses:
13253
+ '200':
13254
+ description: Phone number retrieved successfully
13255
+ content:
13256
+ application/json:
13257
+ schema:
13258
+ type: object
13259
+ properties:
13260
+ phoneNumber:
13261
+ type: object
13262
+ properties:
13263
+ id: { type: string }
13264
+ phoneNumber: { type: string }
13265
+ status: { type: string, enum: [pending_payment, provisioning, active, suspended, releasing, released] }
13266
+ country: { type: string }
13267
+ metaPreverifiedId: { type: string }
13268
+ metaVerificationStatus: { type: string }
13269
+ provisionedAt: { type: string, format: date-time }
13270
+ '401': { $ref: '#/components/responses/Unauthorized' }
13271
+ '404': { $ref: '#/components/responses/NotFound' }
13272
+ delete:
13273
+ operationId: releaseWhatsAppPhoneNumber
13274
+ tags: [WhatsApp Phone Numbers]
13275
+ summary: Release phone number
13276
+ description: |
13277
+ Release a purchased phone number. This will:
13278
+ 1. Disconnect any linked WhatsApp social account
13279
+ 2. Decrement the Stripe subscription quantity (or cancel if last number)
13280
+ 3. Release the number from Telnyx
13281
+ 4. Mark the number as released
13282
+ security:
13283
+ - bearerAuth: []
13284
+ parameters:
13285
+ - name: phoneNumberId
13286
+ in: path
13287
+ required: true
13288
+ description: Phone number record ID
13289
+ schema:
13290
+ type: string
13291
+ responses:
13292
+ '200':
13293
+ description: Phone number released successfully
13294
+ content:
13295
+ application/json:
13296
+ schema:
13297
+ type: object
13298
+ properties:
13299
+ message: { type: string }
13300
+ phoneNumber:
13301
+ type: object
13302
+ properties:
13303
+ id: { type: string }
13304
+ phoneNumber: { type: string }
13305
+ status: { type: string, description: "\"released\"" }
13306
+ releasedAt: { type: string, format: date-time }
13307
+ '400': { description: Phone number is already released or being released }
13308
+ '401': { $ref: '#/components/responses/Unauthorized' }
13309
+ '404': { $ref: '#/components/responses/NotFound' }
13310
+
13311
+ /v1/whatsapp/phone-numbers/{phoneNumberId}/request-code:
13312
+ post:
13313
+ operationId: requestWhatsAppVerificationCode
13314
+ tags: [WhatsApp Phone Numbers]
13315
+ summary: Request OTP
13316
+ description: |
13317
+ Request a new OTP verification code from Meta for a pre-verified phone number.
13318
+ Useful when the initial SMS did not arrive or when re-verifying before the 90-day expiry.
13319
+ security:
13320
+ - bearerAuth: []
13321
+ parameters:
13322
+ - name: phoneNumberId
13323
+ in: path
13324
+ required: true
13325
+ description: Phone number record ID
13326
+ schema:
13327
+ type: string
13328
+ requestBody:
13329
+ required: false
13330
+ content:
13331
+ application/json:
13332
+ schema:
13333
+ type: object
13334
+ properties:
13335
+ method:
13336
+ type: string
13337
+ enum: [SMS, VOICE]
13338
+ default: SMS
13339
+ description: Delivery method for the verification code
13340
+ example:
13341
+ method: "SMS"
13342
+ responses:
13343
+ '200':
13344
+ description: Verification code requested successfully
13345
+ content:
13346
+ application/json:
13347
+ schema:
13348
+ type: object
13349
+ properties:
13350
+ message: { type: string }
13351
+ method: { type: string, enum: [SMS, VOICE] }
13352
+ example:
13353
+ message: "Verification code sent via SMS"
13354
+ method: "SMS"
13355
+ '400': { description: Number has not been added to Meta pre-verified pool }
13356
+ '401': { $ref: '#/components/responses/Unauthorized' }
13357
+ '404': { $ref: '#/components/responses/NotFound' }
13358
+
13359
+ /v1/whatsapp/phone-numbers/{phoneNumberId}/verify:
13360
+ post:
13361
+ operationId: verifyWhatsAppPhoneNumber
13362
+ tags: [WhatsApp Phone Numbers]
13363
+ summary: Verify OTP
13364
+ description: |
13365
+ Manually verify a phone number by entering the OTP code received via SMS or voice call.
13366
+ This is a fallback for when the auto-verification webhook does not capture the code.
13367
+ Verification is valid for 90 days.
13368
+ security:
13369
+ - bearerAuth: []
13370
+ parameters:
13371
+ - name: phoneNumberId
13372
+ in: path
13373
+ required: true
13374
+ description: Phone number record ID
13375
+ schema:
13376
+ type: string
13377
+ requestBody:
13378
+ required: true
13379
+ content:
13380
+ application/json:
13381
+ schema:
13382
+ type: object
13383
+ required:
13384
+ - code
13385
+ properties:
13386
+ code:
13387
+ type: string
13388
+ description: 6-digit verification code
13389
+ example:
13390
+ code: "123456"
13391
+ responses:
13392
+ '200':
13393
+ description: Phone number verified successfully (or already verified)
13394
+ content:
13395
+ application/json:
13396
+ schema:
13397
+ type: object
13398
+ properties:
13399
+ message: { type: string }
13400
+ metaVerifiedAt: { type: string, format: date-time }
13401
+ metaVerificationExpiresAt: { type: string, format: date-time }
13402
+ example:
13403
+ message: "Phone number verified successfully"
13404
+ metaVerifiedAt: "2026-03-11T12:00:00Z"
13405
+ metaVerificationExpiresAt: "2026-06-09T12:00:00Z"
13406
+ '400': { description: Invalid code or number not in Meta pre-verified pool }
13407
+ '401': { $ref: '#/components/responses/Unauthorized' }
13408
+ '404': { $ref: '#/components/responses/NotFound' }