YCloud SDK for Node.js
YCloud API
- API version: v2
The YCloud API is organized around REST. Our API is designed to have predictable, resource-oriented URLs, return JSON responses, and use standard HTTP response codes and verbs.
Requirements
Node 8 or higher.
Installation
npm install @ycloud-cpaas/ycloud-sdk-node
Getting Started
Usage with TypeScript
Please follow the installation instruction and execute the following code:
import * as ycloud from '@ycloud-cpaas/ycloud-sdk-node'
const configuration = new ycloud.Configuration({apiKey: 'YOUR_API_KEY'});
const api = new ycloud.BalanceApi(configuration);
api.retrieve()
.then(value => {
console.log('API called successfully. Returned data:', value.data);
})
.catch(reason => {
console.error(reason.response.data);
});
Documentation for API Endpoints
All URIs are relative to https://api.ycloud.com/v2
| Class | Method | HTTP request | Description |
|---|---|---|---|
| BalanceApi | retrieve | GET /balance | Retrieve balance |
| ContactsApi | attributesList | GET /contact/contacts/attributes | List contact attributes |
| ContactsApi | create | POST /contact/contacts | Create a contact |
| ContactsApi | delete | DELETE /contact/contacts/{id} | Delete a contact |
| ContactsApi | list | GET /contact/contacts | List contacts |
| ContactsApi | notesList | GET /contact/contacts/{id}/notes | List contact notes |
| ContactsApi | retrieve | GET /contact/contacts/{id} | Retrieve a contact |
| ContactsApi | update | PATCH /contact/contacts/{id} | Update a contact |
| CustomEventsApi | createDefinition | POST /event/definitions | Create an event definition |
| CustomEventsApi | createPropertyDefinition | POST /event/definitions/{name}/properties | Create an event property definition |
| CustomEventsApi | propertyDefinition | DELETE /event/definitions/{name}/properties/{propertyName} | Delete an event property definition |
| CustomEventsApi | propertyDefinition_0 | PATCH /event/definitions/{name}/properties/{propertyName} | Update an event property definition |
| CustomEventsApi | retrieveDefinition | GET /event/definitions/{name} | Retrieve an event definition |
| CustomEventsApi | sendEvent | POST /event/events | Send an event |
| CustomEventsApi | updateDefinition | PATCH /event/definitions/{name} | Update an event definition |
| EmailsApi | send | POST /emails | Send an email |
| SmsApi | list | GET /sms | List SMS records |
| SmsApi | send | POST /sms | Send an SMS |
| UnsubscribersApi | create | POST /unsubscribers | Create an unsubscriber |
| UnsubscribersApi | deleteByCustomerAndChannel | DELETE /unsubscribers/{customer}/{channel} | Delete an unsubscriber |
| UnsubscribersApi | list | GET /unsubscribers | List unsubscribers |
| UnsubscribersApi | listAllByCustomer | GET /unsubscribers/{customer} | List all unsubscribers by customer |
| UnsubscribersApi | retrieveByCustomerAndChannel | GET /unsubscribers/{customer}/{channel} | Retrieve an unsubscriber |
| VerifyApi | check | POST /verify/verificationChecks | Check a verification |
| VerifyApi | send | POST /verify/verifications | Start a verification |
| VoicesApi | list | GET /voices | List voice records |
| VoicesApi | send | POST /voices | Send a voice code |
| WebhookEndpointsApi | create | POST /webhookEndpoints | Create a webhook endpoint |
| WebhookEndpointsApi | delete | DELETE /webhookEndpoints/{id} | Delete a webhook endpoint |
| WebhookEndpointsApi | list | GET /webhookEndpoints | List webhook endpoints |
| WebhookEndpointsApi | retrieve | GET /webhookEndpoints/{id} | Retrieve a webhook endpoint |
| WebhookEndpointsApi | rotateSecret | POST /webhookEndpoints/{id}/rotateSecret | Rotate a webhook endpoint secret |
| WebhookEndpointsApi | update | PATCH /webhookEndpoints/{id} | Update a webhook endpoint |
| WhatsappBusinessAccountsApi | list | GET /whatsapp/businessAccounts | List WABAs |
| WhatsappBusinessAccountsApi | retrieve | GET /whatsapp/businessAccounts/{id} | Retrieve a WABA |
| WhatsappCallingApi | accept | POST /whatsapp/calls/accept | Accept a call |
| WhatsappCallingApi | connect | POST /whatsapp/calls/connect | Connect a call |
| WhatsappCallingApi | preAccept | POST /whatsapp/calls/preAccept | Pre-accept a call |
| WhatsappCallingApi | reject | POST /whatsapp/calls/reject | Reject a call |
| WhatsappCallingApi | terminate | POST /whatsapp/calls/terminate | Terminate a call |
| WhatsappFlowsApi | create | POST /whatsapp/flows | Create a flow |
| WhatsappFlowsApi | delete | DELETE /whatsapp/flows/{flowId} | Delete a flow |
| WhatsappFlowsApi | deprecate | POST /whatsapp/flows/{flowId}/deprecate | Deprecate a flow |
| WhatsappFlowsApi | list | GET /whatsapp/flows | List flows |
| WhatsappFlowsApi | preview | GET /whatsapp/flows/{flowId}/preview | generate a web preview URL with this flow. |
| WhatsappFlowsApi | publish | POST /whatsapp/flows/{flowId}/publish | Publish a flow |
| WhatsappFlowsApi | retrieve | GET /whatsapp/flows/{flowId} | Retrieve a flow |
| WhatsappFlowsApi | updateMetadata | PATCH /whatsapp/flows/{flowId}/metadata | Update flow metadata |
| WhatsappFlowsApi | updateStructure | PATCH /whatsapp/flows/{flowId}/assets | Update flow structure |
| WhatsappGroupsApi | approveJoinRequests | POST /whatsapp/{businessPhoneNumber}/groups/{groupId}/joinRequests/approve | Approve group join requests |
| WhatsappGroupsApi | create | POST /whatsapp/{businessPhoneNumber}/groups | Create a group |
| WhatsappGroupsApi | delete | DELETE /whatsapp/{businessPhoneNumber}/groups/{groupId} | Delete a group |
| WhatsappGroupsApi | list | GET /whatsapp/{businessPhoneNumber}/groups | List groups |
| WhatsappGroupsApi | listJoinRequests | GET /whatsapp/{businessPhoneNumber}/groups/{groupId}/joinRequests | List group join requests |
| WhatsappGroupsApi | rejectJoinRequests | POST /whatsapp/{businessPhoneNumber}/groups/{groupId}/joinRequests/reject | Reject group join requests |
| WhatsappGroupsApi | removeParticipants | POST /whatsapp/groups/{groupId}/participants/remove | Remove group participants |
| WhatsappGroupsApi | resetInviteLink | POST /whatsapp/{businessPhoneNumber}/groups/{groupId}/inviteLink/reset | Reset a group invite link |
| WhatsappGroupsApi | retrieve | GET /whatsapp/{businessPhoneNumber}/groups/{groupId} | Retrieve a group |
| WhatsappGroupsApi | retrieveInviteLink | GET /whatsapp/{businessPhoneNumber}/groups/{groupId}/inviteLink | Retrieve a group invite link |
| WhatsappGroupsApi | sendInviteLinkMessage | POST /whatsapp/{businessPhoneNumber}/groups/inviteLink/messages | Send a group invite link message |
| WhatsappGroupsApi | updateSettings | PATCH /whatsapp/{businessPhoneNumber}/groups/{groupId}/settings | Update group settings |
| WhatsappInboundMessagesApi | markAsRead | POST /whatsapp/inboundMessages/{id}/markAsRead | Mark message as read |
| WhatsappInboundMessagesApi | typingIndicator | POST /whatsapp/inboundMessages/{id}/typingIndicator | Mark message as read and display a typing indicator |
| WhatsappMediaApi | upload | POST /whatsapp/media/{phoneNumber}/upload | Upload media |
| WhatsappMessagesApi | retrieve | GET /whatsapp/messages/{id} | Retrieve a message |
| WhatsappMessagesApi | send | POST /whatsapp/messages | Enqueue a message |
| WhatsappMessagesApi | sendDirectly | POST /whatsapp/messages/sendDirectly | Send a message directly |
| WhatsappPhoneNumbersApi | deleteBusinessUsername | DELETE /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/businessUsername | Delete a phone number business username |
| WhatsappPhoneNumbersApi | list | GET /whatsapp/phoneNumbers | List phone numbers |
| WhatsappPhoneNumbersApi | register | POST /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/register | Register a phone number |
| WhatsappPhoneNumbersApi | retrieve | GET /whatsapp/phoneNumbers/{wabaId}/{phoneNumber} | Retrieve a phone number |
| WhatsappPhoneNumbersApi | retrieveBusinessUsername | GET /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/businessUsername | Retrieve a phone number business username |
| WhatsappPhoneNumbersApi | retrieveBusinessUsernameSuggestions | GET /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/businessUsername/suggestions | Retrieve phone number business username suggestions |
| WhatsappPhoneNumbersApi | retrieveCommerceSettings | GET /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/whatsappCommerceSettings | Retrieve commerce settings |
| WhatsappPhoneNumbersApi | retrieveProfile | GET /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/profile | Retrieve a phone number profile |
| WhatsappPhoneNumbersApi | retrieveSettings | GET /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/settings | Retrieve phone number settings |
| WhatsappPhoneNumbersApi | saveSettings | POST /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/settings | Save phone number settings |
| WhatsappPhoneNumbersApi | updateBusinessUsername | PATCH /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/businessUsername | Update a phone number business username |
| WhatsappPhoneNumbersApi | updateCommerceSettings | PATCH /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/whatsappCommerceSettings | Update commerce settings |
| WhatsappPhoneNumbersApi | updateDisplayName | PATCH /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/displayName | Update a phone number display name |
| WhatsappPhoneNumbersApi | updateProfile | PATCH /whatsapp/phoneNumbers/{wabaId}/{phoneNumber}/profile | Update a phone number profile |
| WhatsappTemplatesApi | create | POST /whatsapp/templates | Create a template |
| WhatsappTemplatesApi | deleteByName | DELETE /whatsapp/templates/{wabaId}/{name} | Delete templates by name |
| WhatsappTemplatesApi | deleteByNameAndLanguage | DELETE /whatsapp/templates/{wabaId}/{name}/{language} | Delete a template |
| WhatsappTemplatesApi | editByNameAndLanguage | PATCH /whatsapp/templates/{wabaId}/{name}/{language} | Edit a template |
| WhatsappTemplatesApi | list | GET /whatsapp/templates | List templates |
| WhatsappTemplatesApi | retrieveByNameAndLanguage | GET /whatsapp/templates/{wabaId}/{name}/{language} | Retrieve a template |
Documentation for Authorization
Authentication schemes defined for the API:
api_key
- Type: API key
- API key parameter name: X-API-Key
- Location: HTTP header