What has worked for me:
- For humans pitching a politician / political party: threats that would hurt their cause.
After receiving non-stop phone calls from my local political party's office - and repeatedly telling them to stop calling me - I resorted to "the only people I hate more than {the other political party} are spammers. If you call me one more time I will vote for {the other political party}". I never received another call.
After the last election cycle I was left with a bloody battlefield of torn vote-for-me signs that I didn't consent to being outside my house. Recently I've had three local politicians knock on my door and ask to put their signs up. My response was "if you put a sign outside my house I will put up my own sign that reads "don't vote for anyone who has a sign outside my house". No signs so far.
- For spam calls on the iPhone: Settings -> Apps -> Phone -> Screen Unknown Callers -> Ask Reason for Calling. No spammer will bother, at least in my experience.
- For spam texts on the iPhone: Settings -> Apps -> Messages -> Unknown Senders -> Screen Unknown Senders.
Yes, it takes discipline early on. That "1" new Unknown Senders message notification on your Messages app is just screaming at you to pay attention to it. Don't go there - it's just more spam. If it's not then they'll call you and go through your reason-for-calling filter.