- Twilio setup: Choose the project, get a messaging-capable number, complete sender compliance, and copy the Account SID and Auth Token.
- Artemis channel configuration: Configure the connection using those credentials, then copy the generated webhook URL.
- Webhook configuration in Twilio: Set the number’s incoming-message webhook to that URL and select HTTP POST.
- 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
- Go to Phone Numbers -> Manage -> Active numbers.
- Confirm the number you intend to use lists SMS capability, and MMS as well if your agent will handle media.
- If you need a new number, buy one from Phone Numbers -> Buy a number, filtering by the capabilities and country you need.
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
- Open the Twilio Console dashboard for the selected account.
- Find the account information panel, which shows the Account SID and the Auth Token.
- Copy the
AC-prefixed Account SID, then reveal and copy the Auth Token.
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.
- Go to Messaging -> Services and create a service, or open an existing one.
- Add your phone number to the service’s sender pool. Twilio’s sender pool guidance covers the rules.
- Copy the
MG-prefixed SID.
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.- Open Artemis and select the project.
- Go to Deployments -> Channels -> Twilio SMS -> + New.
-
Configure the following fields:
- Select Create.
-
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
- Scroll to the Messaging section of the number’s configuration.
- In the A message comes in field, select Webhook.
- Paste the Artemis Webhook URL exactly as shown, including the connection identifier at the end.
- Select HTTP POST from the method dropdown.
- Select Save.
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.- 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. - Confirm Twilio reports a 2xx webhook result and that Artemis opens one session.
- 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. - 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. - Send an MMS where the number, destination, and carrier support it, and confirm the agent handles the downloaded attachment.
- 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 carriesX-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.- Overview
- Credentials
- Configuration
- Deployment
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: