Skip to content

Support sending messages by channel ID (not just phone number) #70

@nafg

Description

@nafg

Context

The current SmsService trait abstracts sending SMS messages to phone numbers:

trait SmsService {
  def sendMessage(recipients: Seq[PhoneNumber], message: String): Task[Unit]
}

For Entrance Group, this means every outbound message creates a new "manual campaign" via the Create Campaign API. This is a workaround — Entrance Group's API is designed around channels, not phone numbers. The intended flow is:

  1. A conversation happens on a channel (identified by channel_id)
  2. You send replies to that channel, not by specifying a phone number

When we receive an incoming webhook, the payload includes channel_id (see #69 for full payload documentation). We should be able to reply on that same channel.

Proposal

Make the message target generic so it can be a phone number, a channel ID, or other identifiers. This could work several ways:

Option A: Generic target type

trait MessagingService[Target] {
  def sendMessage(recipients: Seq[Target], message: String): Task[Unit]
}

// Phone-number based (Twilio, current Entrance Group workaround)
type SmsService = MessagingService[PhoneNumber]

// Channel-based (Entrance Group proper API)
type ChannelMessagingService = MessagingService[ChannelId]

This is also forward-looking: the same pattern could support email addresses, WhatsApp group IDs, GroupMe member/group IDs, etc.

Option B: Entrance Group-specific channel send

Add a channel-based send method to the Entrance Group implementation specifically, alongside the existing phone-number based API.

Motivation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions