SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How to Get the Timestamp for Incoming Messages in Twilio Webhooks

Objective

When building applications that receive SMS, MMS, or WhatsApp messages using Twilio, it’s common to want a precise timestamp for when Twilio received each message. This is especially important for logging, auditing, and troubleshooting.

Currently, Twilio’s webhook payload for incoming messages does not include a timestamp field (such as DateCreated) by default. However, there are ways to obtain this information for your records.

 

Product

Programmable Messaging

 

Procedure 

What’s Included in the Incoming Message Webhook?

When Twilio receives an incoming message for your phone number, it sends an HTTP request (webhook) to your application. The webhook includes several parameters, such as:

  • From: The sender’s phone number
  • To: Your Twilio phone number
  • Body: The content of the message
  • MessageSid: The unique identifier for the message

For a full list of parameters, see Twilio’s webhook documentation.

How to Get the Timestamp (DateCreated)

Although the webhook does not include a timestamp, you can retrieve it using the MessageSid provided in the webhook. Here’s how:

  1. Receive the webhook from Twilio as usual.
  2. Extract the MessageSid from the webhook payload.
  3. Make a request to the Message Resource API using the MessageSid.
  4. The API response will include the date_created field, which is the timestamp when Twilio received the message.

Example: Fetching the Timestamp

curl -X GET "https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json" \
-u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token

The response will include:

{
  "sid": "SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "date_created": "Thu, 12 Feb 2026 08:50:06 +0000",
  ...
}

Why Isn’t the Timestamp Included by Default?

Twilio’s webhook payload is designed to be lightweight and fast. While many useful fields are included, the timestamp is not currently part of the default payload. However, Twilio is always listening to customer feedback, and this feature has been requested for future consideration.

Workarounds and Best Practices

  • API Lookup: Use the MessageSid to fetch the timestamp as described above.
  • Server-Side Timestamp: Record the time your server receives the webhook as an approximate timestamp (note: this may differ slightly from Twilio’s actual receipt time).
  • Feature Requests: If this feature is important to your workflow, let Twilio know! Customer feedback helps shape future improvements.

 

Additional Information 

  • The incoming message webhook does not include a timestamp by default.
  • You can retrieve the exact timestamp using the Message Resource API and the MessageSid.
  • Twilio is considering this feature for future updates based on customer feedback.

For more details, see:


 

Have more questions? Submit a request
Powered by Zendesk