Skip to content

Latest commit

 

History

History
407 lines (288 loc) · 11.4 KB

SmsApi.md

File metadata and controls

407 lines (288 loc) · 11.4 KB

Apideck.Sms

Class Name

SmsApi

Methods

Create Message

Method: messagesAdd

smsApi.messagesAdd(body)

Parameters

Name Type Description Notes
message Message
raw [boolean] Include raw response. Mostly used for debugging purposes (optional) defaults to false
consumerId [string] ID of the consumer which you want to get or push data from (optional)
appId [string] The ID of your Unify application (optional)
serviceId [string] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. (optional)

Response Type

CreateMessageResponse

HTTP response details

Status code Description
201 Messages
400 Bad Request
401 Unauthorized
402 Payment Required
404 The specified resource was not found
422 Unprocessable
4/5xx Unexpected error

Example Usage

import { Apideck } from '@apideck/node';

const apideck = new Apideck({
  apiKey: 'REPLACE_WITH_API_KEY',
  appId: 'REPLACE_WITH_APP_ID',
  consumerId: 'REPLACE_WITH_CONSUMER_ID'
});

const params = {
  message: {
    from: '+15017122661',
    to: '+15017122662',
    subject: 'Picture',
    body: 'Hi! How are you doing?',
    type: 'sms',
    scheduled_at: '2020-09-30T07:43:32.000Z',
    webhook_url: 'https://unify.apideck.com/webhook/webhooks/eyz329dkffdl4949/x/sms',
    reference: 'CUST001',
    messaging_service_id: '123456',
    pass_through: [
      {
        service_id: 'string',
        operation_id: 'string',
        extend_object: {},
        extend_paths: [
          {
            path: '$.nested.property',
            value: [Object]
          }
        ]
      }
    ]
  }
}

try {
  const { data } = await apideck.sms.messagesAdd(params)
  console.log('API called successfully', data)
} catch (error) {
  console.error(error)
  return error.json()
}

[Back to top] [Back to API list] [Back to README]

List Messages

Method: messagesAll

smsApi.messagesAll(body)

Parameters

Name Type Description Notes
raw [boolean] Include raw response. Mostly used for debugging purposes (optional) defaults to false
consumerId [string] ID of the consumer which you want to get or push data from (optional)
appId [string] The ID of your Unify application (optional)
serviceId [string] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. (optional)
cursor [string] Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. (optional)
limit [number] Number of results to return. Minimum 1, Maximum 200, Default 20 (optional) defaults to 20
fields [string] The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: `fields=name,email,addresses.city`

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
(optional)

Response Type

GetMessagesResponse

HTTP response details

Status code Description
200 Messages
400 Bad Request
401 Unauthorized
402 Payment Required
404 The specified resource was not found
422 Unprocessable
4/5xx Unexpected error

Example Usage

import { Apideck } from '@apideck/node';

const apideck = new Apideck({
  apiKey: 'REPLACE_WITH_API_KEY',
  appId: 'REPLACE_WITH_APP_ID',
  consumerId: 'REPLACE_WITH_CONSUMER_ID'
});

const params = {}

try {
  const { data } = await apideck.sms.messagesAll(params)
  console.log('API called successfully', data)
} catch (error) {
  console.error(error)
  return error.json()
}

[Back to top] [Back to API list] [Back to README]

Delete Message

Method: messagesDelete

smsApi.messagesDelete(body)

Parameters

Name Type Description Notes
id [string] ID of the record you are acting upon.
consumerId [string] ID of the consumer which you want to get or push data from (optional)
appId [string] The ID of your Unify application (optional)
serviceId [string] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. (optional)
raw [boolean] Include raw response. Mostly used for debugging purposes (optional) defaults to false

Response Type

DeleteMessageResponse

HTTP response details

Status code Description
200 Messages
400 Bad Request
401 Unauthorized
402 Payment Required
404 The specified resource was not found
422 Unprocessable
4/5xx Unexpected error

Example Usage

import { Apideck } from '@apideck/node';

const apideck = new Apideck({
  apiKey: 'REPLACE_WITH_API_KEY',
  appId: 'REPLACE_WITH_APP_ID',
  consumerId: 'REPLACE_WITH_CONSUMER_ID'
});

const params = {
  id: 'id_example'
}

try {
  const { data } = await apideck.sms.messagesDelete(params)
  console.log('API called successfully', data)
} catch (error) {
  console.error(error)
  return error.json()
}

[Back to top] [Back to API list] [Back to README]

Get Message

Method: messagesOne

smsApi.messagesOne(body)

Parameters

Name Type Description Notes
id [string] ID of the record you are acting upon.
consumerId [string] ID of the consumer which you want to get or push data from (optional)
appId [string] The ID of your Unify application (optional)
serviceId [string] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. (optional)
raw [boolean] Include raw response. Mostly used for debugging purposes (optional) defaults to false
fields [string] The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: `fields=name,email,addresses.city`

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
(optional)

Response Type

GetMessageResponse

HTTP response details

Status code Description
200 Messages
400 Bad Request
401 Unauthorized
402 Payment Required
404 The specified resource was not found
422 Unprocessable
4/5xx Unexpected error

Example Usage

import { Apideck } from '@apideck/node';

const apideck = new Apideck({
  apiKey: 'REPLACE_WITH_API_KEY',
  appId: 'REPLACE_WITH_APP_ID',
  consumerId: 'REPLACE_WITH_CONSUMER_ID'
});

const params = {
  id: 'id_example'
}

try {
  const { data } = await apideck.sms.messagesOne(params)
  console.log('API called successfully', data)
} catch (error) {
  console.error(error)
  return error.json()
}

[Back to top] [Back to API list] [Back to README]

Update Message

Method: messagesUpdate

smsApi.messagesUpdate(body)

Parameters

Name Type Description Notes
message Message
id [string] ID of the record you are acting upon.
consumerId [string] ID of the consumer which you want to get or push data from (optional)
appId [string] The ID of your Unify application (optional)
serviceId [string] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. (optional)
raw [boolean] Include raw response. Mostly used for debugging purposes (optional) defaults to false

Response Type

UpdateMessageResponse

HTTP response details

Status code Description
200 Messages
400 Bad Request
401 Unauthorized
402 Payment Required
404 The specified resource was not found
422 Unprocessable
4/5xx Unexpected error

Example Usage

import { Apideck } from '@apideck/node';

const apideck = new Apideck({
  apiKey: 'REPLACE_WITH_API_KEY',
  appId: 'REPLACE_WITH_APP_ID',
  consumerId: 'REPLACE_WITH_CONSUMER_ID'
});

const params = {
  id: 'id_example',
  message: {
    from: '+15017122661',
    to: '+15017122662',
    subject: 'Picture',
    body: 'Hi! How are you doing?',
    type: 'sms',
    scheduled_at: '2020-09-30T07:43:32.000Z',
    webhook_url: 'https://unify.apideck.com/webhook/webhooks/eyz329dkffdl4949/x/sms',
    reference: 'CUST001',
    messaging_service_id: '123456',
    pass_through: [
      {
        service_id: 'string',
        operation_id: 'string',
        extend_object: {},
        extend_paths: [
          {
            path: '$.nested.property',
            value: [Object]
          }
        ]
      }
    ]
  }
}

try {
  const { data } = await apideck.sms.messagesUpdate(params)
  console.log('API called successfully', data)
} catch (error) {
  console.error(error)
  return error.json()
}

[Back to top] [Back to API list] [Back to README]