On our Shopify website, in the footer, we have a submit button, for a newsletter form, where the customer can put down his phone number and email.
The code for the Newsletter portion looks like this
{% form 'customer', id: unique, data-newsletter-form: '', class: class %}
{% endform %}
One of the first changes I made, was to the button I added an OnClick function,
onclick="addUser()"
Then on the bottom, I added this code,
Which will allow me to define the addUser function.
Now, I’m not sure about this part, but after trying to do a lot of self studying, I think the next correct step would be to make the addUser() function look something like this
function addUser(){
fetch('https://api.attentivemobile.com/v1/subscriptions', {
method: 'POST',
headers: {
'Authorization': 'Bearer
Am I moving in the right direction?
What I used to create that code was the documentation that the app I'm trying to integrate sent me
[https://docs.attentivemobile.com/openapi/reference/tag/Subscribers/](https://docs.attentivemobile.com/openapi/reference/tag/Subscribers/)
On the right hand side, they have payload and curl samples, and I used an online tool that helped me convert it to the JS function.
The signupsourceID was provided by Attentive Support so I have that. I am assuming I will also have to ask them for the Bearer Auth Token.
My question is, how I can take the email and phone from the form when they submit, and add it to the fetch call?
I am assuming I can pass the variables to my AddUser() function, but I'm not sure how to do that in Shopify liquid code.
I have a programming background, but very little in Javascript, CSS, or Shopify Liquid. I was assigned this task and have been trying to figure out how to program it in for close to the past 3 weeks.
I have slowly been making progress but I am still quite far behind. If anyone could help me or just provide some suggestions or advice, I would greatly appreciate it.