Text Messages ============= Use this endpoint to manipulate and obtain details on Salesbox's Text Messages. Base Endpoint ------------ .. code-block:: text https://segmentai.salesbox.com.br/api/text-messages Get Text Message -------------- .. code-block:: text GET /api/text-messages/{id} Get an individual Text Message by ID. **HTTP Request** ``GET /api/text-messages/ID`` **Response** ``Expected Response Code: 200`` .. code-block:: json { "textMessage": { "id": 1, "content": "Your appointment is confirmed for tomorrow at 2 PM", "recipient": "+1234567890", "status": "sent", "sentAt": "2024-01-15T10:00:00+00:00", "deliveredAt": "2024-01-15T10:00:05+00:00", "createdAt": "2024-01-15T09:55:00+00:00", "modifiedAt": "2024-01-15T10:00:05+00:00", "createdBy": 1, "createdByUser": "John Smith", "modifiedBy": 1, "modifiedByUser": "John Smith", "campaign": { "id": 5, "name": "Appointment Reminders" } } } **Text Message Properties** .. list-table:: :header-rows: 1 * - Name - Type - Description * - ``id`` - int - ID of the Text Message * - ``content`` - string - Content of the message * - ``recipient`` - string - Phone number of the recipient * - ``status`` - string - Status of the message (draft, queued, sent, delivered, failed) * - ``sentAt`` - datetime/null - When the message was sent * - ``deliveredAt`` - datetime/null - When the message was delivered * - ``createdAt`` - datetime - Message creation date/time * - ``modifiedAt`` - datetime/null - Message last modified date/time * - ``createdBy`` - int - ID of the User that created the message * - ``createdByUser`` - string - Name of the User that created the message * - ``modifiedBy`` - int - ID of the User that last modified the message * - ``modifiedByUser`` - string - Name of the User that last modified the message * - ``campaign`` - object/null - Associated campaign details List Text Messages ---------------- .. code-block:: text GET /api/text-messages Get a list of text messages. **Query Parameters** .. list-table:: :header-rows: 1 * - Name - Type - Description * - ``search`` - string - Text to search messages by * - ``page`` - int - Which page to display * - ``limit`` - int - How many records to return * - ``orderBy`` - string - Column to sort by * - ``orderByDir`` - string - Sort direction: asc or desc * - ``status`` - string - Filter by message status * - ``campaignId`` - int - Filter by campaign ID Create Text Message ----------------- .. code-block:: text POST /api/text-messages/new Create a new text message. **Request Body** .. list-table:: :header-rows: 1 * - Name - Type - Description * - ``content`` - string - Message content * - ``recipient`` - string - Recipient phone number * - ``campaignId`` - int - Associated campaign ID (optional) * - ``scheduledFor`` - datetime - When to send the message (optional) Edit Text Message --------------- .. code-block:: text PATCH /api/text-messages/{id}/edit Edit an existing text message. **Request Body** Same fields as Create Text Message. Delete Text Message ----------------- .. code-block:: text DELETE /api/text-messages/{id}/delete Delete an existing text message. Send Text Message --------------- .. code-block:: text POST /api/text-messages/{id}/send Send a text message immediately.