cancel
Showing results for 
Search instead for 
Did you mean: 

Custom field in POST url

Occasional Participant

Custom field in POST url

I'm trying to add existing custom field data via POST url, no luck so far. Is this supported? If so, how do I find the custom_field name to POST? I've tried 'cf_text_name--0', 'cf_text--0', etc.

 

Following this: http://techblog.constantcontact.com/api/release-updates/announcing-a-new-signup-form-post-url/

 

7 REPLIES 7
Honored Contributor

Re: Custom field in POST url

Hello,

 

While this feature is technically supported, the format for it is currently not very user friendly and is more difficult to implement. In the future we hope to improve how our forms handle custom fields, which would also impact the post URL and the usability of this feature.

 

At present, the best way to discover how to implement a specific custom field is to create a form through our UI that includes the desried field and generate the embed code for that form. After doing so, you will find HTML in the embed code in this format:

<input data-id="Custom field 5_value:input" type="text" name="cf_text_value--0" value="">
<input data-id="Custom field 5_name:input" type="hidden" name="cf_text_name--0" value="custom_field_5">
<input data-id="Custom field 5_label:input" type="hidden" name="cf_text_label--0" value="Custom field 5">   

This example is for my own account, so the actual field names and values will likely vary some for your own account. If you wanted to include the custom field shown on this form, you would need to send 3 additional fields in your POST request:

  • cf_text_value--0
  • cf_text_name--0
  • cf_text_label--0

 

The first field whose name includes "value" is the field whose stored value will be input into the contact record. The other two fields are used to identify which custom field is being used.

 

If you have any questions, please let me know!

 

Sincerely

Elijah G.
API Support Engineer
Occasional Participant

Re: Custom field in POST url

Now I'm getting an error when trying to add a url to my custom field:

 

{"success":false,"err":"Request contained errors","offenders":[{"err":"cf_text_value--0 is invalid","offender":"cf_text_value--0"}]} [response] => Array ( [code] => 400 [message] => Bad Request )

Honored Contributor

Re: Custom field in POST url

If you're receiving an error, I would strongly suggest logging in to your own Constant Contact account and creating a form that contains the custom field(s) that you want. Once you've created that form, you will want to get the Embed code for the form and find those fields in the code. Their format should be similar to what I have provided, but it will likely be a bit diferent.

 

Once you have that code, you should be able to follow the steps I've povided to get things working. If you're still having difficulty, it would be a big help to me if you could provide the form data that you're sending (except for the CA).

 

Sincerely,

Elijah G.
API Support Engineer
Occasional Participant

Re: Custom field in POST url

I should've been more clear - I was able to follow your instructions and add records with the custom field just fine. However, when I tried to a post a URL to a custom field I received an error. As a workaround I'm just going to break out the endpoint of the URL and build the rest out in the email templates. 

Honored Contributor

Re: Custom field in POST url

Thanks for clarifying! I did a bit of digging and what you're seeing is actually the validation rules for these custom fields that apply to the POST URL and to the embeddable forms. Current only the following characters are allowed for Custom Fields through this system:

a-z
A-Z
0-9
-
_
.
'
`
Spaces

After review, this does seem a bit limited, so I will be following up with our product folks to see if we can look at loosening this a little bit to allow for more advanced use-cases such as yours.

 

If you have any questions, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer
Highlighted
Occasional Participant

Re: Custom field in POST url

I figured it was a validation error of some sort. 

 

So now the question becomes how can I pass in a URL fragment into an autoresponder wysiwyg email template? I would like to use the visual editor as opposed to creating an email from scratch if possible.

 

It doesn't seem like it's possible to insert a custom field into a link element however. For example by doing this:

I've read through this documenation https://knowledgebase.constantcontact.com/articles/KnowledgeBase/13914-Personal-Contact-Details-for-... but is this only possible by creating a custom-coded email? 

 

 

Honored Contributor

Re: Custom field in POST url

There's actually different processes that are used for custom emails and for templated emails such as our autoresponders. You can find directions for how to create a dynamic link in an email that uses a template here: https://knowledgebase.constantcontact.com/articles/KnowledgeBase/13914-Personal-Contact-Details-for-...

 

If you have any questions, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer