Solved

Can't track profile activity by phone_number

  • 1 September 2021
  • 3 replies
  • 511 views

Badge +2

Hi all, 

I'd like to track profile activities by using the special field $phone_number as per this documentation

customer_properties: optional; JSON Object or null
Properties of the profile that triggered this event. You must identify the person by their email using a $email key (or by their phone number using a $phone_number key if you have SMS-only contacts)

 

But when I send the following request, it just does nothing even though 1 is being returned

curl --request POST \
--url https://a.klaviyo.com/api/track \
--header 'Accept: text/html' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'data={"token": "", "event": "Blueprint Opted IN", "customer_properties": {"$phone_number": "+44786213xxxx"}, "properties": {"blueprintOptinStatus": "OPTEDIN"}}'

A profile with the exact phone number exists on our Klaviyo dashboard

It works if I add the $email field. But I’d like to use it for my SMS-only contacts (as the documentation suggested)

What should I do?

icon

Best answer by alex.hong 2 September 2021, 01:01

View original

3 replies

Userlevel 7
Badge +58

Hi @Zolo ,

Thanks for posting your question to the Community!

In order to pull event tracking for SMS, you'll need to ensure that all profiles have consent applied for SMS. Based on the images you shared here, it's hard to see if consent is applied to the profile.

I suspect that SMS consent may not have been collected making a phone number only profile. Meaning, that if you have a normal contact that has only email consent and a phone number field, or a profile that has both email and sms consent, it still wouldn't work; being that it's not an sms only profile within Klaviyo. Emails on the other hand wouldn't be restricted to this limitation as email is how Klaviyo uses as an ID by default. So unless the profile is already created as a phone number/sms only profile; the api call using that phone number as an identifier wouldn't work.

In addition, unfortunately at this time it's not possible to use List API to pull profiles by phone number for profiles outside of the US.  At this time it can only used in this way for US profiles in accounts using our SMS functionality.

If you need to obtain the export profile telephone numbers with the API, I'd recommend you to use the Profiles API endpoint. You'll need the profile's ID to query this endpoint, but you can obtain the IDs of all the profiles in a List or Segment through the List & Segments endpoint.

I hope this answers your question. If there is anything else I can do to help please let me know.

Alex

Badge +2

Hi @alex.hong,

Thanks for a reply. 

I used a form like this

And the Collect SMS consent option is enabled on the phone number field 

So it means as long as the form has email address field, it wouldn’t work as I expected? 

Userlevel 7
Badge +58

Hello @Zolo ,

The form is correct and that is how you collect SMS. However, as mentioned before, what you are trying to achieve currently will not work to use List API to pull profiles by phone number for profiles outside of the US.  At this time it can only used in this way for US profiles in accounts using our SMS functionality. If you need to obtain the export profile telephone numbers with the API, I'd recommend you to use the Profiles API endpoint.

 

In addition, here are some documents on how to collect SMS for future reference.

Guide to Collecting SMS Consent via API

How to Collect SMS Consent

 

If you have further questions, please feel free to respond here. However, if you find yourself running into more technical issues I recommend reaching the Support team!

 

Have a good day,
Alex

Reply