Skip to main content
Solved

Way to bulk apply RevCat entitlements?


Forum|alt.badge.img+4

Hi all

Looking at potentially doing a campaign where group of users get X days free access to app. Many of these are previous subscribers or trials that no longer have an active subscription. 

I know on the customer level we can manually apply a single entitlement. Is there a way in the RevCat console to do this in bulk? e.g. all customers in a list (from RevCat customer list) get an entitlement applied? 

Thanks

 

Best answer by tina

Hey @Kim 

You can write a script that does this for you through our Grant a Promotional Entitlement endpoint. A bulk import for that endpoint is an interesting use case, I’ll add this as an idea for an API overhaul that we have planned on the future roadmap!

View original
Did this post help you find an answer to your question?

tina
RevenueCat Staff
Forum|alt.badge.img+10
  • RevenueCat Staff
  • March 18, 2022

Hey @Kim 

You can write a script that does this for you through our Grant a Promotional Entitlement endpoint. A bulk import for that endpoint is an interesting use case, I’ll add this as an idea for an API overhaul that we have planned on the future roadmap!


Forum|alt.badge.img+4
  • Member
  • March 18, 2022

Thanks @tina 


Would be benefical if we could create a customer list, then an action is apply entitlement. Right now we can only do it from a single customer. 

 

Keep me posted 

 

Thanks 

 

Kim 


Forum|alt.badge.img

Thanks Tina!, and Kim for the question

Just wanted to note the +1 here for the request.

We needed to provide an entitlement to all our existing users and that ended up being really time taking. In such cases, we also did not want to just keep issuing requests to revenue Cat and hit the rate limiters.

Also, since I always end up googling bash things, leaving a quick script for the other visitors

 

### Script revCatCommand.sh

user_id=$1

result=$(curl --request POST \
     --url https://api.revenuecat.com/v1/subscribers/$1/entitlements/<entitlement_id>/promotional \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer <secret>' \
     --header 'Content-Type: application/json' \
     --data '
{
     "duration": "<duration>"
}
')

if [[ "$result" == *"code"* ]]; then
	echo $user_id >> failure_cases
else
	echo $user_id >> success_cases
fi

exit 0

### Script to_run.sh

counter=1
while IFS= read -r user_id
do
  bash revCatCommand.sh $user_id &
  counter=$((counter+1))
  if [[ $(($counter % 10)) == 0 ]]; then
  	sleep 1
  fi
done < user_list.csv

 


+1 for this request also and thanks Harpeet for sharing your script too πŸ™


Forum|alt.badge.img+1

Hi @tina,

I was wondering if there’s a way to grant entitlement permanently through an API endpoint β€” I noticed the duration parameter with the `lifetime` option has been deprecated.


Did this post help you find an answer to your question?

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings