Closed verymilan closed 5 months ago
Double-opt-in is a feature currently associated with Keila’s forms while the contacts API is designed to ingest data from other sources. I think it would be nice to add DOI support to the API but it's not yet on the roadmap. Maybe we should add a JSON endpoint for forms instead of making this part of the authenticated API …
I read that for Mailchimp there is a contact status "pending", that can be used with their API. Keila also sets a status, maybe this could be extended to also support "pending" for when this lands on the roadmap? An endpoint for forms sounds nice as well.
That’s not possible because Keila doesn’t actually create contacts for people who sign in via a DOI form. Instead, a "FormParams" entity is created that is once again submitted when a user confirms their email.
Are you sure the sender is set up correctly? You can check if your request was registered with Keila.Repo.all(Keila.Contacts.FormParams)
from IEx.
Whoops deleted my comment and right after, Firefox decided to show me that there was a reply. I have updated my request and it now works ... for some reason.
Originally it looked like this:
"contact%5Bemail%5D=" + urllib.parse.quote_plus(session['sender']) + "contact%5Bfirst_name%5D=" + session['firstname'] + "&contact%5Blast_name%5D=" + session['lastname']
Here Keila responded with 200 but nothing happened.
Now it looks like this, I tried to encode this as well (as a whole) but couldn't preserve the =
, landing me in a 400
(I think thats the reason).:
"contact[email]=" + session['sender'] + "&" + "contact[first_name]=" + session['firstname'] + "&" + "contact[last_name]=" + session['lastname']
As long as the 'Content-Type': 'application/x-www-form-urlencoded'
header is present, it now works. Maybe the Python requests library already does some encoding by itself due to me using requests.post(uri, data ...
? I have not yet tried this in a Keila setup with more logoutput yet.
But hey it works 😅
Edit: You might want to take a look at this: https://betatim.github.io/posts/python-create-multipart-formdata/
I’ll close this for now because the API is working as intended. We should consider a separate endpoint for creating FormParams/DOI signups in the future.
Hi there I've just created a custom form for Keila, but it looks like DOI is not triggered when using the API. This would be a nice addition (unless I use the wrong API call?) – because otherwise my form can't be used unless I somehow figure out how to implement DOI for that form... .