https://retellai.com/?utm_source=discord&utm_medium=seo logo
Is there a way to trace or log which source ( webh...
# ❓・ai-evy-support
n
@AI Evy Is there a way to trace or log which source ( webhook, API call, etc.) initiated each outbound call?
a
Thanks for tagging me @nouman_59969. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Outbound Calls (Make Calls)](https://docs.retellai.com/deploy/outbound-call) [[2] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) ​
### Answer Yes, you can use the
metadata
parameter when creating outbound calls to track which source initiated each call. [(1) ]() [(2) ]() When making an outbound call, include custom metadata to identify the source:
Copy code
javascript
const registerCallResponse = await retell.call.createPhoneCall({
  from_number: '+14157774444',
  to_number: '+12137774445',
  metadata: { "customer_id": "cust_123" }
}) ;
[(1) ]() The
metadata
field is described as "an arbitrary object for storage purpose only. You can put anything here like your internal customer id associated with the call." [(2) ]() You could structure it like: -
{ "source": "webhook", "webhook_id": "xyz" }
-
{ "source": "api", "triggered_by": "crm_integration" }
This metadata is then available when you: 1. Poll the Get Call API - retrieve call details including your stored metadata [(1) ]() 2. Receive webhooks - the
call.ended
and
call.analyzed
webhooks include the metadata you set This approach lets you trace back every outbound call to its originating source.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.