Basecamp API - Are there multiple schedules for each account? - basecamp

While building an integration to the Basecamp 3 API I'm using the todo lists endpoint which looks like https://3.basecampapi.com/{account_id}/buckets/${project_id}/todosets/${todo_set_id}/todolists.json which returns all of the todo lists in the account.
I don't fully understand the role of schedule in a Basecamp account, is there only one or can each account have many ?
I assumed I would issue a GET to something like /schedule_list.json and let the user choose the schedule he wants to create the entry in but for now I just assume that there is only one schedule in each project and auto-pick it for him.
Is this correct ? This is confusing to me because then I don't understand the purpose of entering both project_id and schedule_id (From the /project endpoint)
Thanks a lot for anyone with any input on this topic :D

Related

Azure API Management product subscription tracking

I am using Azure API Management for managing our APIs. Its containing product and all. Now I also want to catch some of the customer information into my database.
So my question is : "Is there anyway such that whenever someone is subscribing any product, my API will trigger?"
What I want to do is I will create an API which will fetch the details from Azure via REST API for all subscriptions and I want to call (auto trigger) that API whenever someone subscribe any product successfully. I know we can set the Approval workflow, we can send notification email also to any specific email id, but can we call any HTTP request?
Also if anyone have more idea about Developer portal then please share. (can we customize it, till what level, how, etc.)
Thanks in Advance..
One way is to put an Event Grid system topic on the resource group containing API Management service with
filter for Resource Write Success
subject filter / Subject begins with /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.ApiManagement/service/{apiManagementService}/subscriptions
and forward to Azure Function or WebHook - basically filter for activities logged as Subscribe to product or Update subscription on the resource.

Separate customers by user in Stripe API

I am trying to create a functionality using the Stripe API (not Stripe Connect) to let users add customers. If I understand this correctly, all customers will be added to my Stripe account. Is there a way I can distinguish which user added which customer, so that I can list all customers under one specific user?
I know Stripe Connect solves this problem, but it's not appropriate for my use case.
Thanks in advance.
About the only way you'll be able to do this - beyond tracking it in your own application's database, which you should definitely do - is to add Metadata to the Customers.
That said, you may want to reach out to Support and have them confirm that your use case makes sense; they may also have an alternative suggestion for you.
As #floatingLomas said, you can use the metadata field to store user info when creating a new customer (https://stripe.com/docs/api/customers/create), but as far as I know there's no specific API call to retrieve customers by metadata.
I mean, if your concern is to know who created a specific customer, it will be enough to retrieve that specific customer and look at its metadata field, but if you're looking for a solution which allow you to find all the customers added by a specific user, then I would suggest to create in your app a database table which keep track of that and do your searches through that.

Setting up stripe subscriptions for a Twitch.tv-like product

I am having some issues currently wrapping my head around the process of adding a customer to a plan.
A very broad idea of the payment type is to think Twitch Streaming. You can follow users for free but pay a small fee to "subscribe" to them.
Currently, when the user fills out the payment form, i create a source in the frontend through react-stripe-elements and then pass the source.id to my backend.
This is where things start to fall apart for me.
Should I create a different product per user so I can very easily view from the stripe dashboard which user/product is doing the best?
A way to go about this is when a user creates an account, my backend automatically creates a product for that specific user as well as a plan and then store the plan_id into the user model.
So when a user subscribes to another user, I can pull out the plan_id and create the subscription that way.
Currently, I create a source whenever a user submits the payment form.
let attach_source = async ( customer_id, source_id ) => {
await stripe.customers.createSource( customer_id, {
source: source_id
} )
}
Do I check if an error happened and see if the error is duplicate source? Or does Stripe take care of everything.
I am also curious how Stripe handles multiple subscriptions on the same customer from different credit cards. I don't see anywhere that states that a subscription takes from a specific source.
Thank you for taking your time to read this. Appreciate the help!
it looks like you are describing a billing user case from Stripe (https://stripe.com/docs/billing/subscriptions/creating)
You can probably get away without creating one plans per one customer. what you could do is to create a Plan with usage (https://stripe.com/docs/billing/subscriptions/quantities) so a min plan of 5 dollars subscription, when they want to contribute more, update the quantity of the plan
Currently stripe source has a fingerprint fields, where it will be unique for the same credit card number (https://stripe.com/docs/api/cards/object#card_object-fingerprint), you could compare fingerprint to determine if the card has been added. Stripe does not perform any duplication checking now
There is a default_source (https://stripe.com/docs/api/subscriptions/create#create_subscription-default_source) parameters where you can set different card for different subscriptions;

Connect Google calendar api and api.ai

So here is what i am trying to do :
I built a bot with api.ai for my business that is hosted on my webpage and my Facebook page right now. Bot works well.
I want to push it to the next step by allowing my customers to make querys on my calendar, ask to book a specific time, see if available, if not offer other time similar, then make a booking.
I have been reading this thread and the great answer attached to it but i think my case is a bit different.
I was wondering if the bot could always have a token so every guests won't have to Auth to query the calendar ?
Obviously i am new to this, i have been reading the guide of google calendar api and api.ai but i don't really see how to do that yet. I guess there is a way to store a token somewhere and then just trigger the query with some specific intents but not to sure how.
I have also done the node.js quickstart guide of the G-calendar api, and it works fine if that helps.
Thanks for your help !
You will probably want to use a Service Account that is permitted to the calendar in question. Service Accounts are similar to regular accounts, but they are expected to do server-to-server communication only, so the method to create an auth token is a little different to keep it secure.
See https://developers.google.com/identity/protocols/OAuth2ServiceAccount for more information about using Service Accounts.
In general, you'll be using a shared secret to create and sign a JSON Web Token (JWT) you send to Google's servers. You'll get back an access token which you'll then use to call the Calendar API. The access token expires in about an hour, at which point you'll need to repeat the process.
There are libraries available to do much of this for you. For example, if you're using the node.js library https://github.com/google/google-api-nodejs-client, then it will take care of this for you (although you need to modify the key file - see the documentation for details).

Scheduled and triggered jobs in Azure

For my Azure app I have a variety of scenarios for needing both scheduled and triggers jobs. Having researched both Azure WebJobs and Scheduler it appears I can accomplish this, but not in the best way possible.
My use cases will go something like:
Weekly email blast (seems right up the alley for Scheduler)
Event invites, dynamically timed based on event's time (I could have
a job check every hour to see if any need to be sent? or at the
event's creation create a Scheduled Job at the specific time, but
what happens if the event changes?)
Reminders based on #2 above
(same issues/questions)
Welcome emails (two versions, one if they
complete a walkthrough and another if they don't: how to manage the
timing of this?)
So basically I see how I can use Azure Scheduler to accomplish all of this, but not in the most efficient way. I would like to see if there's a way to manage Azure Scheduler along with some sort of triggered Jobs based on various criteria, controller by code. Does something like this exist?
Update
To add a bit more information to this,
I'm using Mandrill as these are transactional emails. The things that makes my use case not appropriate for Mailchimp or some automation platform is I have repeat templates I will be sending out (5ish) which are triggered dynamically based on my user's events and various configurations.
Examples:
1) New user registers. If they complete an on-boarding walkthrough they receive one type of welcome email, if they don't complete the on-boarding walkthrough within x minutes they receive an other type of welcome email.
2) An event is created by an admin. At that moment code will comb through all users to see who should be invited based on user's preferences, then send out personalized invites to each user.
Consider using the WebJobs SDK for some of this. For example, you could use an Azure Storage Queue to invoke your web job as event invites are created or modified in your application. You may want to have different queues that different web jobs are triggered from too. For example, one for invites, another for reminders, and one for welcome emails.
The weekly email blast may be a separate scheduled web job in your scenario.
Putting my business cap on, it sounds like you have a need of something that will handle your email marketing/automation. Consider looking at 3rd party products that specialize in this, instead of hand-coding it. Mailchimp # http://mailchimp.com comes to mind. They have a feature called Goal completion more info at: http://blog.mailchimp.com/new-trigger-emails-from-website-traffic/
Alternatively, a monitoring and automation service that my company provides (CloudMonix # http://cloudmonix.com ) allows for automatically kicking off tasks based on some very custom criteria. CloudMonix knows nothing about email marketing, but it can kick-off a Web job or an Azure automation job if some SQL record appeared in the database or a metric published somewhere.

Resources