How to Add Subscribers Using the API
Collect subscribers using our API
This guide provides information on how you can use our API to add subscribers.
Why use our API to add Subscribers
There are many different reasons for why you might want to use our API for adding subscribers, but a few of them are:
- Building your own custom subscriber form (like a popup or checkout form)
- Building your own custom integration with another service and Postscript
- Adding subscribers you’ve collected elsewhere to Postscript
How to use our API to add Subscribers
In order to use the API to add subscribers, you need to take the following steps:
- Log into your Postscript dashboard
- Navigate to your Account API page to get your API Key
- If you already have one generated, click Show link and copy the key. If you don't already have one generated, click the button Create Security Key Pair, then click the Show link and copy the key.
- In the KEYWORDS section, create a new keyword you want to use to track opt-ins from this source.
- Then select OPT IN and create whatever REPLY you want (what you want the user to get back when they sign up).
- Copy the Keyword you created, you will use this in the next step
- Now you can add subscribers to Postscript using the API by setting up your API call in the below way:
curl --request POST \
--url https://api.postscript.io/v1/subscribers \
--header 'Accept: application/json' \
--header 'Authorization: Bearer [use the API key from your Postscript account page]' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"tags": [
"VIP",
"Custom Checkout"
],
"email": "[subscriber email]"
},
"phone_number": "[subscriber phone number]",
"keyword": "[keyword obtained from step above]"
}
'
Compliance
Anywhere you are collecting subscriber information, you’ll want to be sure to add compliant language, like the below example.
Example compliant language when collecting subscriber information:
<<compliance_language>>
[The terms and conditions and privacy policy pages should be linked in this message]For more information on compliance, see our guide here.
And that’s everything you need to know to start using our API to add subscribers. You can find more detailed information about how our Subscriber API works here.
If you have any questions, drop them in the forum!
Updated almost 3 years ago