Skip to main content
Back to messaging or digital channels Connect a Twilio phone number to your agent so customers reach it over SMS and MMS. You prepare a messaging-capable sender in Twilio, hand Artemis the account credentials, and then point the number’s incoming-message webhook at a connection-specific URL that Twilio signs on every request. The setup requires:
  1. Twilio setup: Choose the project, get a messaging-capable number, complete sender compliance, and copy the Account SID and Auth Token.
  2. Artemis channel configuration: Configure the connection using those credentials, then copy the generated webhook URL.
  3. Webhook configuration in Twilio: Set the number’s incoming-message webhook to that URL and select HTTP POST.
After you complete the configuration, an SMS to your Twilio number opens a session in Artemis, the bound deployment answers it, and the reply goes back to the sender through Twilio’s Messages API. Important considerations
  • The reply doesn’t travel in the webhook response: Artemis returns an empty TwiML acknowledgement immediately and queues the agent, then sends the reply as a separate outbound API call. A 2xx on the webhook proves delivery of the inbound message and nothing more.
  • Twilio signs the webhook URL itself: The signature covers the full external URL and the sorted form fields. Scheme, host, port, and path all participate, so a proxy that rewrites any of them breaks signature validation even though the request arrives intact.
  • One account boundary: The Account SID, Auth Token, phone number, and any Messaging Service SID have to come from the same Twilio project or subaccount. Mixing a subaccount number with parent-account credentials fails in ways that look like a configuration error.
  • Compliance sits outside Artemis: Sender registration, consent, and opt-out rules belong to Twilio and the carriers. A working webhook doesn’t exempt your traffic from them.

Prerequisites

  • A Twilio account with access to the project or subaccount that owns the sender and its billing.
  • A messaging-capable Twilio phone number for the destination countries, in E.164 format with the leading plus and country code.
  • Any sender registration your traffic needs, such as A2P 10DLC brand and campaign registration for United States long-code traffic.
  • Artemis project access with permission to open Deployments -> Channels, and a deployed agent in the environment you intend to bind.

How Artemis routes Twilio SMS messages

Twilio calls a URL you choose per phone number, so Artemis puts the connection identifier in the path rather than reading it from the payload. Artemis keys each conversation to the Twilio number and the customer number together, so the same person messaging two of your Twilio numbers holds two separate sessions.

Twilio setup

Do this work in the Twilio Console before you open Artemis.
1

Open the project that owns the sender

Sign in to the Twilio Console, then use the account selector at the top of the page to switch to the project or subaccount that owns the production phone number and its billing.Everything you collect from here has to come from this one account boundary. Twilio scopes the Auth Token to the account, so credentials from a parent account can’t authenticate a subaccount’s traffic.
2

Get a messaging-capable phone number

  1. Go to Phone Numbers -> Manage -> Active numbers.
  2. Confirm the number you intend to use lists SMS capability, and MMS as well if your agent will handle media.
  3. If you need a new number, buy one from Phone Numbers -> Buy a number, filtering by the capabilities and country you need.
Keep the full E.164 value, including the leading plus and country code. Capability varies by country, so a number that sends SMS in one market may not support MMS in another.
3

Complete sender and destination compliance

Finish the registration, sender-verification, consent, and opt-out requirements Twilio shows for your countries and traffic type.United States long-code traffic needs A2P 10DLC brand and campaign registration. Carriers filter unregistered traffic rather than failing it loudly, so messages appear to send and never arrive. Twilio surfaces this as error 30034.Configuring a webhook doesn’t bypass any of this. Start compliance early, because it waits on external review rather than on you.
4

Copy the Account SID and Auth Token

  1. Open the Twilio Console dashboard for the selected account.
  2. Find the account information panel, which shows the Account SID and the Auth Token.
  3. Copy the AC-prefixed Account SID, then reveal and copy the Auth Token.
The Auth Token authenticates outbound API calls and validates inbound request signatures, so treat it as a high-value secret and store it in your secret manager rather than in a ticket or a shared document.
5

Decide whether to use a Messaging Service

A Messaging Service is optional. Use one when you want Twilio to pick a sender from a pool, apply sticky sender behavior, or carry an A2P campaign registration.
  1. Go to Messaging -> Services and create a service, or open an existing one.
  2. Add your phone number to the service’s sender pool. Twilio’s sender pool guidance covers the rules.
  3. Copy the MG-prefixed SID.
Leave the SID out of the Artemis connection to reply from the inbound number instead. Twilio’s Messaging Services documentation explains what each mode changes.
6

Account for trial restrictions

A trial project restricts which recipients and senders you can use, and adds branding to outbound messages.Prove production behavior on an upgraded account with an approved sender. A trial test that works tells you the wiring is right, not that your launch will work.

Artemis channel configuration

Create the connection before you configure the Twilio webhook. The callback URL contains the connection identifier, so you can’t finalize it in Twilio until Artemis has generated it.
  1. Open Artemis and select the project.
  2. Go to Deployments -> Channels -> Twilio SMS -> + New.
  3. Configure the following fields:
  4. Select Create.
  5. Open the connection and copy the Webhook URL from the Overview tab.
    The URL ends with your connection identifier. Copy it exactly, because Twilio signs the complete URL and any difference invalidates the signature.

Validation checklist


Webhook configuration in Twilio

Twilio calls this URL every time the number receives a message. Configure it on the number itself, or on the Messaging Service when that service owns inbound handling.
1

Open the sender's incoming-message settings

For a direct number, go to Phone Numbers -> Manage -> Active numbers and select the number.For a Messaging Service that owns inbound handling, open the service and use its integration settings instead. Configure one or the other, because two handlers pointing at the same connection produce duplicate replies.
2

Set the incoming-message webhook

  1. Scroll to the Messaging section of the number’s configuration.
  2. In the A message comes in field, select Webhook.
  3. Paste the Artemis Webhook URL exactly as shown, including the connection identifier at the end.
  4. Select HTTP POST from the method dropdown.
  5. Select Save.
Twilio sends application/x-www-form-urlencoded POST fields including MessageSid, AccountSid, From, To, Body, NumMedia, and any MediaUrl fields. Twilio’s incoming message webhook reference lists them all.
3

Keep the external URL identical to what Artemis expects

Twilio signs the complete URL plus the sorted form fields using HMAC-SHA1 with your Auth Token, then sends the result in X-Twilio-Signature. Artemis validates the signature using its configured public base URL.Configure that base URL to the same external address Twilio calls, and forward the X-Twilio-Signature header unchanged. HTTPS termination and reverse-proxy host and protocol settings all have to agree, because scheme, host, port, path, and form values all participate in validation.
4

Understand the response Twilio receives

Artemis returns HTTP 200 with an empty TwiML response straight away and queues the agent. Twilio treats that as an acknowledgement and sends nothing to the customer.The agent’s reply follows separately through the Messages API. Twilio expects a response within 15 seconds and calls the fallback webhook when the primary fails or times out, which is why the acknowledgement returns before the agent runs.

Verify the connection

Artemis doesn’t synthesize Twilio requests, so a real SMS is the only end-to-end proof.
  1. From an allowed recipient, send a short SMS to the Twilio number that you can search for later.
    On a trial project, the recipient has to be a verified caller ID.
  2. Confirm Twilio reports a 2xx webhook result and that Artemis opens one session.
  3. Check that the agent replies once to the original sender.
    The reply arrives from the inbound Twilio number, or from the Messaging Service when you supplied its SID. The empty TwiML acknowledgement isn’t the reply, so a 2xx with no message means the outbound path failed.
  4. Send a second message from the same customer number to the same Twilio number, and confirm it continues the existing session rather than starting a new one.
    A different sender or recipient number opens a separate conversation.
  5. Send an MMS where the number, destination, and carrier support it, and confirm the agent handles the downloaded attachment.
  6. Repeat the whole test on an upgraded account with the production sender and an ordinary recipient, then check opt-in and opt-out handling, delivery status, throughput, and per-segment cost.

SMS behavior and limits

SMS is a plain-text channel with carrier economics attached, which changes how you author agent responses.

Secure the connection

Twilio authentication rests on one credential doing two jobs, and on a URL that both sides have to match exactly. Every inbound request carries X-Twilio-Signature. Artemis computes HMAC-SHA1 over the configured public callback URL and the sorted form parameters using the Auth Token as the key. Twilio’s security guide describes the same calculation from the sending side. Treat the external URL as signed data. Keep HTTPS termination, host, protocol, and port aligned with the public base URL you configured for Artemis, and pass the signature header through untouched. A reverse proxy that presents a different internal URL to Artemis breaks validation even though nothing about the message changed. The Auth Token validates inbound signatures and authorizes outbound sends, so rotate it in Twilio and Artemis as one coordinated change rather than two. A rotation applied on one side only stops inbound and outbound traffic at the same moment. Use separate Twilio subaccounts or senders, credentials, webhooks, and connections for development and production.

Manage the channel connection

Opening a connection shows four tabs. The delete control sits beside the connection name.
Connection Summary reports the connection’s state and identity.Setup Instructions shows the Webhook URL to configure in Twilio and the Connection Identifier it ends with, each with a copy control. Compare the URL here with what Twilio actually calls whenever signature validation fails.

Troubleshoot connection issues


Twilio reference

Use these Twilio pages when you need detail beyond what this article covers. Related articles: