v1

latestOpenAPI 3.0.02026-07-2447166133.5 KB
Internal Endpoints

Send a message from an internal endpoint

This operation sends a message to an external endpoint (phone number or email address) or a contact (secure messaging). Only one of secureEndpoint or smsOrEmailEndpoint should be specified. You will need to also specify the appropriate internal endpoint from the list of available internal endpoints for an organization. The RequestID returned by this API may be used to match against the RequestID field of the conversationItem.created webhook event to identify when the message is posted.

Send a secure message

  • Get the appropriate Spruce phone number from the list of internal endpoints for an organization (of channel type secure)
  • Specify the internal endpoint's endpoint.Id in the internalEndpointId path parameter
  • Get the Id of the appropriate contact to send the secure message to. You can list all contacts in the organization or search for the appropriate contact to determine the contact Id if you do not have it already.
  • Populate the destination.secureEndpoint object with the contactId, the appropriate deliveryMethod and subject for the conversation.

The deliveryMethod can be one of the following:

  • (Default) any_available_secure_conversation: The system will first try to deliver messages using conversations from the specified internal endpoint. Then it will try to deliver to any existing secure conversation with the recipient. Then, if no conversation exists, a new secure conversation will be created.
  • only_conversations_matching_internal_endpoint: The system will deliver messages in conversations from the specified internal endpoint. If such a conversation doesn't yet exist, a new one will be created.
  • new_conversation: This option will create a new conversation, separate from any existing conversation.

Send an SMS

  • Get the appropriate Spruce phone number from the list of internal endpoints for an organization (of channel type phone)
  • Specify the internal endpoint's endpoint.Id in the internalEndpointId path parameter
  • Specify the phone number to send the the message to in the destination.smsOrEmailEndpoint body parameter

Send an email

  • Get the appropriate Spruce phone number from the list of internal endpoints for an organization (of channel type email)
  • Specify the internal endpoint's endpoint.Id in the internalEndpointId path parameter
  • Specify the email address to send the the message to in the destination.smsOrEmailEndpoint body parameter

Send a fax

  • Get the appropriate Spruce fax number from the list of internal endpoints for an organization (of channel type fax)
  • Specify the internal endpoint's endpoint.Id in the internalEndpointId path parameter
  • Specify the fax number to send the the message to in the destination.faxEndpoint body parameter
  • Note: Each outbound fax message sent from an internal endpoint will result in a new fax conversation being created
post/internalendpoints/{internalEndpointId}/conversations

Path parameters

internalEndpointIdstring required

The id of the endpoint to send the message from.

Headers

s-idempotency-keystring

A unique value generated by the client used to recognize subsequent retries of the same request. Idempotency keys can be up to 255 characters long.

Request body

sendAtstring date-time

The date and time the message is scheduled to be sent

Example request

{
  "destination": {
    "secureEndpoint": {
      "deliveryMethod": "only_conversations_matching_internal_endpoint"
    }
  },
  "message": {
    "attachments": [
      {
        "attachmentId": "d7b25969-86ec-7e37-3776-3577-c0637a0c",
        "title": "My Image"
      }
    ],
    "author": "entity_0D4QABCC06000",
    "body": [
      {
        "type": "text",
        "value": "Hello, how are you?"
      }
    ]
  },
  "sendAt": "2020-04-01T00:00:00Z"
}

Response

ok response

requestIdstring required

The id of an asynchronous request

Example response

{
  "requestId": "asyncRequest_0D4QABCC06000"
}