Contact us to find a verified advocacy website.
Action: Send Petition
When one of the organizations you host creates an active petition, send it and we will display it to the legislators set by its signees.
Connect:
Send Type: POST, Content: JSON
Endpoints:
Live: https://HopeSmart.com/set_petition
Test: https://test.HopeSmart.com/set_petition
POST JSON Data:
apikey
(Required)The apikey crated on your verified HopeSmart.com account (Char: 255)
petition
(Required)This is your petition information array.(JSON Object)
petition_key
(Required)
This is your petition key used to reference the petition a signee will be signing. (Char: 255)
title
(Required)
The petition title. Legislators can use titles to get a gist of what the petition is about. (Char: 255)
text
(Required)
The petition body text. Currently, <a, <img, <br tags and /n line breaks will be displayed, other custom css and html tags may not.
You can bold with <b>bold text</b> or class="bold" and italic with <i>italic text</i> or class="italic".
Hot links will take your links href and create a new link labled ( link ).
(Text Field)
tags
A comma separated list of searchable tags to reference this petition by our users and legislators. Ex: Medicare,Medical,Hospital(Char: 255)
advocate_site_name
This is your company/site name, not the organization creating the petition. (Char: 255)
advocate_sign_url
(Required)
This is the URL we should link to when one of our members wants to sign your petition. (Char: 255)
organization_name
This is the name of your clients organization. The Creator of the Petition. (Char: 255)
organization_key
(Required)
This is a reference key to your client organization. We will need this to notify you of abuse or issues with this client organization. (Char: 255)
display_org_name
If you want to show your client organizaitons name set this to 1. (Int: 1 or 0)
display_adv_name
If you want to show your compnay/site name set this to 1 to brand it, or 0 to remove (white label) it. (Int: 1 or 0)
Return JSON Data:
petition
Response: "created" or "updated". This will return "created" if the petition key you sent is new, and "updated" if we find your petition key. Only returned if successful.(Char: 255)
status
Status code for your request. (Int: 3)
error
An error message, empty if succesful. (Char: 255)
Curl Example: (All One Line)
curl --header "Content-Type: application/json" --request POST --data '{YOUR_JSON_DATA}' https://HopeSmart.com/set_petition
PHP Example:
$data = array(
"apikey" => "YOUR_API_KEY"
,"petition" => array(
,"petition_key"=>"234"
,"title"=>"City Potholes"
,"text"=>"Potholes taking over city."
,"tags"=>"potholes,erosion"
,"advocate_site_name"=>"Advocatz.com"
,"advocate_sign_url"=>"https://Advocatz.com/234"
,"organization_name"=>"Pothole Protectors"
,"organization_key"=>"ph234"
,"display_org_name"=>1
,"display_adv_name"=>0
)
);
$data_string = json_encode($data);
$ch = curl_init('http://api.local/rest/users');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
Action: Deactivate / Reactivate Petition
When you initially send a petition it is automatically active. If your client completes their campaign you can tell us to deactivate the petition. Deactivated petitions are no longer shown to the general public, and are marked inactive for legislators.
Connect:
Send Type: POST, Content: JSON
Endpoints:
Live: https://HopeSmart.com/toggle_petition
Test: https://test.HopeSmart.com/toggle_petition
POST JSON Data:
apikey
(Required)The apikey crated on your verified HopeSmart.com account (Char: 255)
petition_key
(Required)
Your petition key identifier so we can reference the right petition.(Char: 255)
organization_key
(Required)
The key identifier for the organization that created the petition. (Char: 255)
petition_active
(Required)
Set the petition to active (1) or inactive (0)(Int: 1 or 0)
Return JSON Data:
activated
If the petition is active we will return 1, otherwize 0, this is not returned if there was an error(Int: 1)
status
Status code for your request. (int 3)
error
An error message, empty if succesful. (char 255)
Curl Example: (All One Line)
curl --header "Content-Type: application/json" --request POST --data '{YOUR_JSON_DATA}' https://HopeSmart.com/get_hskey
PHP Example:
$data = array(
"apikey" => "YOUR_API_KEY"
,"petition_key" => "234"
,"organization_key" => "ph234"
,"petition_active" => 0
);
$data_string = json_encode($data);
$ch = curl_init('http://api.local/rest/users');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
Action: Send Signee Data
Signee data is made available to legislators and officials so they can respond to signees. Signee data is encrypted and will not be made available to the general public. Signee data is not shared with other organizations or advocate sites.
Connect:
Send Type: POST, Content: JSON
Endpoints:
Live: https://HopeSmart.com/set_signee
Test: https://test.HopeSmart.com/set_signee
POST JSON Data:
apikey
(Required)The apikey crated on your verified HopeSmart.com account (Char: 255)
hs_key
(Required)
Send a list of HopeSmart legislator keys in an array, if the keys exists, those legislators pages will show the petition.
Ex: ['HSUS123','HSUS222']
(Array)
petition_key
(Required)
Your petition key identification. (Char: 255)
organization_key
(Required)
The organization key identification (Char: 255)
signee
(Required)
The signee data.(JSON Object)
name_first
(Required)
Signee first name (Char: 200)
name_middle
Signee middle name (Char: 200)
name_last
(Required)
Signee last name (Char: 200)
name_prefix
Ex: mr, mrs (Char: 20)
name_suffix
Ex: Jr. Sr. (Char: 20)
email
(Required - or cellphone)
Ex: Signee@mysite.com, this field is required if you do not send a cellphone. (Char: 200)
street
Ex: 300 Somestreet st. (Char: 200)
city
Ex: Somecity (Char: 255)
postcode
Ex: 30290 (Char: 30)
country
(Required)
Ex: US (Char: 2)
phone
Ex: 222-222-2222 (Char: 200)
cellphone
(Required - or email)
Ex: 555-555-5555, this field is required if you do not send an email. (Char: 200)
occupation
Ex: Dog Catcher (Char: 255)
party
Ex: Democrat, Republican, Independant, R, D, I, whatever (Char: 60)
dob
Date of birth in format YYYY-MM-DD, Ex: 1973-10-20 (Char: 20)
signee_note
Signee note acompanying their signature of petition. This will be truncated to 255 characters if too long.(Char: 255)
Return JSON Data:
signee
Returns "signed" if successful. This field is not returnend if there was an error.(Char: 255)
status
Status code for your request. (int 3)
error
An error message, empty if succesful. (char 255)
Curl Example: (All One Line)
curl --header "Content-Type: application/json" --request POST --data '{YOUR_JSON_DATA}' https://HopeSmart.com/get_hskey
PHP Example:
$data = array(
"apikey" => "YOUR_API_KEY"
,"hs_key" => array('HSUS123','HSUS222')
,"petition_key" => '234'
,"organization_key" => 'ph234'
,"signee" => array(
,"name_first"=>"Joe"
,"name_middle"=>"J."
,"name_last"=>"Testerson"
,"name_prefix"=>"Mr."
,"name_suffix"=>"Jr."
,"email"=>"Joe@Tester.com"
,"street"=>"4 House St."
,"city"=>"Somecity"
,"state"=>"NY"
,"postcode"=>"39485"
,"country"=>"US"
,"phone"=>"222-222-2222"
,"cellphone"=>"555-555-5555"
,"occupation"=>"Disco Dancer"
,"party"=>"R"
,"dob"=>"1973-10-20"
,"signee_note"=>"My Notes"
)
);
$data_string = json_encode($data);
$ch = curl_init('http://api.local/rest/users');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
Action: Pull HopeSmart Legislator Key
Use this to associate a HopeSmart Key with a legislator. You can store this key in your database if you don't want to call HopeSmart twice each time you want to send petition data.
The more fields you fill out, the more accurate the match will be. We suggest you fill in as many fields as possible so we can contact these legislators and notify them new petition information is ready for them to view.
If more than one match is found both will be sent.
Connect:
Send Type: POST, Content: JSON
Endpoints:
Live: https://HopeSmart.com/get_hskey
Test: https://test.HopeSmart.com/get_hskey
POST JSON Data:
apikey
(Required)The apikey crated on your verified HopeSmart.com account (Char: 255)
legislator
(Required)This field holds your legislator data. The more data you send the more precise your result.(JSON Object)
name_prefix
Ex: Mr. (Char: 20)
name_first
(Required)
Ex: Abraham (Char: 60)
name_middle
Ex: J. (Char: 60)
name_last
(Required)
Ex: Lincoln (Char: 60)
email
Ex: Abe@Lincoln.com (Char: 255)
phone
Ex: 123-123-1234 (Char: 60)
street
Ex: 1600 Pennsylvania Ave NW (Char: 255)
city
(* Required)
Ex: Washington (Char: 255)
region
(* Required)
Ex: DC (Char: 2)
postcode
(* Required)
Ex: 20500 (Char: 5)
* USA use 5 digit code.
country
(Required)
Ex: US (Char: 2)
district_type
(Required)
Ex: national_exec | national_upper | national_lower | state_exec | state_upper | state_lower | local_exec | local | school | judicial | census | county | watershed (Char: 30)
title
Ex: President, this is just the title of the position the leader holds. (Char: 255)
party
Ex: Republican (Char: 60)
district_type key
national_exec - Ex: (President)
national_upper - Ex: (Senator)
national_lower - Ex: (House)
state_exec - Ex: (Governor)
state_upper - Ex: (State Senator)
state_lower - Ex: (State House)
local_exec - Ex: (Mayor)
local|school|judicial|census|county|watershed
- Ex: (Alderman/Judges/Other Local Leaeders)
* Required:
Depending on your district_type, you may not need to send full address information.
Ex: district_type of national_exec would be a national leader where state/region and city and post code do not matter.
Ex: district_type of national_upper | national_lower | state_exec | state_upper | state_lower would would not need a city or postcode, but would need a state/region, like a senator
Other district types require all address parts city, state/region, post code.
Note:
Provide Email and Phone if you have it, that helps us contact legislators to connect with the petitions you send.
Developers please feel free to contact us for clarifications on data parameters or other questions if needed.
Return JSON Data:
hskeys
An array of legislators that match the data you sent. Only sent if a legislator was found.(array)
hskey
The HopeSmart Legislators key. (char 255)
name_first
The Legislators first name. (char 60)
name_last
The Legislators last name. (char 60)
city
The Legislators city. (char 255)
state
The Legislators state. ny (char 2)
country
The Legislators country. us (char 2)
status
Status code for your request. (int 3)
error
An error message, empty if succesful. (char 255)
Curl Example: (All One Line)
curl --header "Content-Type: application/json" --request POST --data '{YOUR_JSON_DATA}' https://HopeSmart.com/get_hskey
PHP Example:
$data = array(
"apikey" => "YOUR_API_KEY"
,"legislator" => array(
,"name_prefix"=>"Mr."
,"name_first"=>"Abraham"
,"name_middle"=>"J."
,"name_last"=>"Lincoln"
,"email"=>"Abe@Linc.com"
,"phone"=>"123-123-1234"
,"street"=>"1600 Pennsylvania Ave NW"
,"city"=>"Washington"
,"region"=>"dc"
,"postcode"=>"23858"
,"country"=>"us"
,"district_type"=>"national_exec"
,"title"=>"president"
,"party"=>"republican"
)
);
$data_string = json_encode($data);
$ch = curl_init('http://api.local/rest/users');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);