Pushed offers a very powerful subscription management system so you can handle subscriptions in your apps and channels. We call it Members-Only feature, and it is meant to easily manage subscriptions in Pushed.
Managing subscribers is a feature available in Pro and Enterprise plan. First of all, to enable Members-Only feature you must set your app or channel as Private (in settings), and then toggle the Members-Only switch:
Once you have enabled Members-Only feature you will gain access to the Manage Subscribers features:
In this screen you can perform all the operations related to managing subscribers: invite a user, remove a user or check an invitation.
Inviting Users Inviting subscribers is really easy. We will cover two ways of doing it (using the web application and programatically using our API). Once the user is invited he will receive an email message and a Pushed notification. Once the users accepts the invitation, the user will be shown in the Subscribers tab.
To invite a user using the web application all you have to do is to Pending Invitations and click in Invite New User, the following modal window will be shown:
In the modal window you can specify one, or multiple emails (separated by commas).
If you want to invite user programmatically using our API, here's the documentation of the request you can use. Additionally, you can find a sample of the API request here.
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "source_type=your_source_type" \
--form-string "source_alias=your_app_or_channel_alias" \
--form-string "emails=emails_list_comma_separated" \
https://api.pushed.co/1/subscription/invite
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/subscription/invite", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"source_type" => "your_source_type",
"source_alias" => "your_app_or_channel_alias",
"emails" => "emails_list_comma_separated"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/subscription/invite",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"source_type" => "your_source_type",
"source_alias" => "your_app_or_channel_alias",
"emails" => "emails_list_comma_separated"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/subscription/invite")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:source_type => "your_source_type",
:source_alias => "your_app_or_channel_alias",
:emails => "emails_list_comma_separated"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/subscription/invite', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"source_type": "your_source_type",
"source_alias": "your_app_or_channel_alias",
"emails": "emails_list_comma_separated"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"source_type": "your_source_type",
"source_alias": "your_app_or_channel_alias",
"emails": "emails_list_comma_separated"
}
r = requests.post("https://api.pushed.co/1/subscription/invite", data=payload)
print(r.text)
Removing Subscribers If you want to remove a subscriber, you can do it any time in the web application, at the red button :
Or you can also use our API endpoint :
Sample Code: Command Line
Copy Codecurl -X DELETE -s \
--form-string "pushed_id=user_pushed_id" \
--form-string "api_key=user_api_key" \
--form-string "subscription_alias=alias_of_the_subscription" \
--form-string "subscription_email=email_of_the_subscription" \
https://api.pushed.co/1/app/subscription
use LWP::UserAgent;
LWP::UserAgent->new()->delete(
"https://api.pushed.co/1/app/subscription", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"subscription_alias" => "alias_of_the_subscription",
"subscription_email" => "email_of_the_subscription"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/app/subscription",
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => array(
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"subscription_alias" => "alias_of_the_subscription",
"subscription_email" => "email_of_the_subscription"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/app/subscription")
req = Net::HTTP::Delete.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:subscription_alias => "alias_of_the_subscription",
:subscription_email => "email_of_the_subscription"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('DELETE', '/1/app/subscription', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"subscription_alias": "alias_of_the_subscription",
"subscription_email": "email_of_the_subscription"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"subscription_alias": "alias_of_the_subscription",
"subscription_email": "email_of_the_subscription"
}
r = requests.delete("https://api.pushed.co/1/app/subscription", data=payload)
print(r.text)
Checking Invitations Status If the invitation has been accepted, it will appear in the Subscribers tab, otherwise it will be visible in Pending Invitations tab.
Sending notifications to subscribers After the use has accepted the invitation, you can send him notifications directly using the "Send Notification" button as shown below:
Or using the specific endpoint in our API, here's a sample request:
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "target_type=subscription_alias" \
--form-string "content=Your notification content." \
--form-string "subscription_alias=alias_of_the_subscription" \
https://api.pushed.co/1/push
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/push", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "subscription_alias",
"content" => "Your notification content.",
"subscription_alias" => "alias_of_the_subscription"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/push",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "subscription_alias",
"content" => "Your notification content.",
"subscription_alias" => "alias_of_the_subscription"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:target_type => "subscription_alias",
:content => "Your notification content.",
:subscription_alias => "alias_of_the_subscription"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "subscription_alias",
"content": "Your notification content.",
"subscription_alias": "alias_of_the_subscription"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "subscription_alias",
"content": "Your notification content.",
"subscription_alias": "alias_of_the_subscription"
}
r = requests.post("https://api.pushed.co/1/push", data=payload)
print(r.text)
If you have any more question, please do not hesitate contacting us .