How to Give LoyaltyLion Points to Users for Instagram Subscriptions Using Shopify's API?

This topic was automatically generated from Slack. You can find the original thread here.

Hello everyone, I have a site on Shopify with LoyaltyLion app, I would like to give points to users when they subscribe to my channel on instagram, but there seems to be no such thing in the api, can you tell me how to solve this problem using your api?

Hi, I think your question is a great case for Pipedream bot to help. I’ll pass your question to the Pipedream bot now. Please feel free to ask it any question

Hello everyone, I have a site on Shopify with LoyaltyLion app, I would like to give points to users when they subscribe to my channel on instagram, but there seems to be no such thing in the api, can you tell me how to solve this problem using your api?

To achieve this, you can create a Pipedream workflow that triggers when a user subscribes to your Instagram channel and then adds points to the user’s LoyaltyLion account. However, you’ll need to find a way to link Instagram subscribers to their LoyaltyLion accounts (e.g., by matching their email addresses). First, you’ll need a trigger for new Instagram subscribers. Unfortunately, Instagram API doesn’t provide a direct webhook for new subscribers. You might need to periodically check for new subscribers using Instagram API and use a Pipedream Scheduler trigger to run the workflow at regular intervals. Once you have the new subscribers’ information, you can use the LoyaltyLion API to add points to their accounts. Here’s an example Pipedream component that makes a request to the LoyaltyLion API: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { loyaltylion: { type: "app", app: "loyaltylion", }, customerId: { type: "string", label: "Customer ID", }, points: { type: "integer", label: "Points to add", }, }, async run({ steps, $ }) { return await axios($, { method: "POST", url: `https://api.loyaltylion.com/v2/customers/${this.customerId}/activities`, headers: { Authorization: `Bearer ${this.loyaltylion.$auth.oauth_access_token}`, }, data: { name: "instagram_subscribe", points: this.points, }, }); }, }); Replace customerId and points with the appropriate values for each new subscriber. Please note that this is just a starting point, and you’ll need to customize the workflow according to your specific requirements.

Hello everyone, I have a site on Shopify with LoyaltyLion app, I would like to give points to users when they subscribe to my channel on youtube, but there seems to be no such thing in the api, can you tell me how to solve this problem using your api?

To achieve this, you can create a Pipedream workflow that triggers when a user subscribes to your YouTube channel and then adds points to the user’s LoyaltyLion account. However, you’ll need to find a way to link YouTube subscribers to their LoyaltyLion accounts (e.g., by matching their email addresses). First, you’ll need a trigger for new YouTube subscribers. YouTube API provides a webhook for new subscribers via PubSubHubbub. You can follow this guide to set up a webhook for new subscribers: Subscribe to Push Notifications  |  YouTube Data API  |  Google for Developers Once you have the new subscribers’ information, you can use the LoyaltyLion API to add points to their accounts. Here’s an example Pipedream component that makes a request to the LoyaltyLion API: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { loyaltylion: { type: "app", app: "loyaltylion", }, customerId: { type: "string", label: "Customer ID", }, points: { type: "integer", label: "Points to add", }, }, async run({ steps, $ }) { return await axios($, { method: "POST", url: `https://api.loyaltylion.com/v2/customers/${this.customerId}/activities`, headers: { Authorization: `Bearer ${this.loyaltylion.$auth.oauth_access_token}`, }, data: { name: "youtube_subscribe", points: this.points, }, }); }, }); Replace customerId and points with the appropriate values for each new subscriber. Please note that this is just a starting point, and you’ll need to customize the workflow according to your specific requirements.