Building "Subscribe form" HTML programatically from list ID?

I'm trying to figure out how to create a subscribe form given a list ID.  So let's say that the API helps me find my list 'mainlist' with the list_id of 66223bf9db512300eb449a642eae2748.  How do I get from that to the form's action  (e.g.  the name/ID of the email field (cm-ijktty-ijktty), and possibly even the custom input's IDs like cm-f-ydjylt ....

I hope there is some way to build this form programatically without our HTML-non-savvy clients having to login and copy the HTML out themselves...

Mathew Mathew, 8 years ago

If you are using the API already, can you not just add subscribers directly via the API too? Perhaps you can explain a little more what you are trying to achieve.

Get in touch with us on Twitter:
We're also on Facebook:
karelia, 8 years ago

I'm using the API, but only as far as to generate the subscribe-me form for clients to put on their (third-party) websites, so that people who visit the website can subscribe themselves.  So my code's only point of contact with the API is in accessing the client (who handles subscriptions and sending) and choosing/creating a list that the subscription form is associated with.

In case that didn't clarify, let me break it down more specifically.

We have a program that we sell that people use to create their own websites.
We want people to sign up for a c/send account through us.
We hope to have a module for our website creation software that is a "sign-up form" that our customers can put onto their websites, for *their* viewers to add themselves to *their* mailing list.

Currently, the only way that I know of to create a subscribe form is to log into our c/send account, choose the client from the list of clients sending themselves, Click Manage Subscribers, select the appropriate list, then click "Create a subscribe form" and go through the steps of generating the code.

Or, the client themselves would have to login and go through a similar process.

I'm trying to avoid those tedious steps, and use the API from our program to look up the appropriate list from the client's account, and SOMEHOW from that list ID, generate the signup form ourselves, and put it on their website.

Hope that clarifies things.   I really hope there is a way to do this!

Mathew Mathew, 8 years ago

OK, that makes sense, but in your sign up form module you could use any old HTML form code you like, and just submit it to your own code which will add that person via the API.

You don't need to use Campaign Monitor's specific signup form if you are using the API on the back end to submit it to the list ID you already have.

Does that make sense?

Get in touch with us on Twitter:
We're also on Facebook:
karelia, 8 years ago

So I can see how your solution would work, and I can do that if I need to, although wouldn't it be easier to have the submission to add a subscriber to the list go directly to Campaign Monitor, and cut out the middleman (my server)?

karelia, 8 years ago

A follow-up question -- If I end up needing to use the API, am I correct in my perception that you can't add with custom fields AND have a nice way to re-add somebody if they are currently unsubscribed?  Both Subscriber.Add and Subscriber.AddWithCustomFields say "this method should be used with caution and only where suitable" so it seems like what one really needs is "Subscriber.AddAndResubscribeWithCustomFields" or something... :-)

Blake, 8 years ago

We actually do have a Subscriber.AddAndResubscribeWithCustomFields method, which is probably what you'll need to use for what you're trying to do.

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free