Skip to content

Add support for transactional inbox messages#170

Merged
karngyan merged 1 commit intomainfrom
inapp-14180
Feb 11, 2026
Merged

Add support for transactional inbox messages#170
karngyan merged 1 commit intomainfrom
inapp-14180

Conversation

@karngyan
Copy link
Member

@karngyan karngyan commented Feb 11, 2026

Summary

Adds support for sending transactional inbox messages via the API client.

Changes

New API Method

  • Added sendInboxMessage() method to APIClient class
  • Posts to /v1/send/inbox_message endpoint
  • Follows the same pattern as existing sendEmail(), sendPush(), and sendSMS() methods

New Request Class

  • Added SendInboxMessageRequest class with full TypeScript type definitions
  • Required parameters:
    • identifiers: Customer identifier (id or email)
    • transactional_message_id: ID of the transactional message template
  • Optional parameters:
    • message_data: Dynamic data for message personalization
    • disable_message_retention: Disable message retention
    • queue_draft: Queue message as draft
    • send_at: Unix timestamp for scheduled delivery
    • language: Language code for message localization

Test Coverage

  • Added 5 comprehensive test cases covering:
    • Request validation (plain object rejection)
    • Basic usage with required parameters
    • Usage with all optional parameters
    • Email identifier support
    • Error handling

Developer Experience

  • Fixed husky pre-commit hook to use npx for better PATH resolution

Example Usage

import { APIClient, SendInboxMessageRequest } from 'customerio-node';

const client = new APIClient('your-app-api-key');

const request = new SendInboxMessageRequest({
  identifiers: { id: 'customer_123' },
  transactional_message_id: 1,
  message_data: {
    item_name: 'Premium Subscription',
    price: '$19.99'
  }
});

client.sendInboxMessage(request)
  .then(res => console.log(res))
  .catch(err => console.log(err.statusCode, err.message));

Testing

All tests pass with 100% code coverage for the new functionality:

✔ sendInboxMessage: passing in a plain object throws an error
✔ #sendInboxMessage: with template: success
✔ #sendInboxMessage: with optional parameters: success
✔ #sendInboxMessage: with email identifier: success
✔ #sendInboxMessage: error

Note

Low Risk
Adds a new API method and request type without changing existing send flows; risk is mainly around the new endpoint path/payload and is covered by unit tests.

Overview
Adds support for sending transactional inbox messages via the Node API client by introducing SendInboxMessageRequest (typed required/optional fields) and a new APIClient.sendInboxMessage() method that POSTs to /send/inbox_message.

Exports the new request type and adds test coverage for validation, optional parameters, alternate identifiers, and error propagation. Also updates the Husky pre-commit hook to run ts-node and pretty-quick via npx.

Written by Cursor Bugbot for commit cc7284a. This will update automatically on new commits. Configure here.

Co-authored-by: Cursor <cursoragent@cursor.com>
@karngyan karngyan merged commit 56d621c into main Feb 11, 2026
11 checks passed
@karngyan karngyan deleted the inapp-14180 branch February 11, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants