Post to with more than one blog per ID

On it is possible to have more than one blogs under the same ID. The Actions directory has actions for posting to, but not for choosing which blog to post to if you do have more than one blog. I do not have the technical know how to even to write an action to do this, but I did wonder if it is something that is possible, or is it beyond Drafts’ capabilities.

Thank you.

If you have an action using Drafts’ credentials, you should be able to duplicate the action and change the modifier ID. Then when run it ill prompt you for an additional set of credentials to post with.

See the page on credentials for details about setting identifiers.

Thank for this, but I don’t think that it will work in this case. Because my two blogs are under the same account (read ID), they operate from the same Credential, from my understanding. So another way is needed to choose which blog to post to.

The API docs suggests there is a unique app token (bearer ID). That would presumably be your credential for each micro blog in the Action.

If that doesn’t help, perhaps you could share a link to a specific action you would like to utilise? We could then take a look at it and see if we can see if and where it cold be modified.

I logged into my account to look around, and it’s not at all clear how you would get a token specific to a blog. I only have one blog, so not sure I would be seeing the same thing. Probably worth asking over on the forum about the right way to get a Micropub token for a specific blog.

That said, once you do get the right token, if you are using this example action and want to use it for more than one different blog, it would require a minor modification to use a unique credential identifier for each blog you want to target…

// the "" in this line would have to be different
// in each copy of the action you want to target a different token
var credential = Credential.create("", "Insert app token generated on account page.");

Note the Send to example uses the app, which would, I presume, allow you to select which blog to use once it opens might also be an option.

1 Like

Thank you for your reply. I’ll follow up with the forum and see what I can find.

And you are correct, the app, both iOS and OS, allows you to select the blog that you want to post to before hitting publish. I just want to see if I can do it all from Drafts.

I posted a question on the forum, and while looking around found this Help item which appears relevant, Posting API.

In that post is the following,

For users who have multiple microblogs configured, /micropub?q=config will return of the list of sites. You can post to a specific microblog by passing an mp-destination parameter of the URL (uid from the configured list).

But I do not know how to use this. :frowning:

Not entirely sure this is right, but I think the way I read that, the necessary change would be the below. You will need to change the blogURL var to be the URL of the you want to target.

  post to hosted account
  using Micropub API

// CHANGE URL in quotes below...
var blogURL = "" 

// First run, you will be prompted for
// App Token. Generate tokens on the
// Account page
var credential = Credential.create("", "Insert app token generated on account page.");

credential.addTextField("apptoken", "App Token");

var appToken = credential.getValue("apptoken");

// Setup API and content 
var endpoint = ""
var content = draft.content

// create and post HTTP request
var http = HTTP.create();
var response = http.request({
  "url": endpoint,
  "method": "POST",
  "encoding": "form",
  "data": {
    "h": "entry",
    "content": content,
    "mp-destination": blogURL
  "headers": {
    "Authorization": "Bearer " + appToken

console.log("Response: " + response.statusCode);

if (response.statusCode != 200 && response.statusCode != 202) {;
1 Like

Thank you very much. I’ll let try this out and let you know.

It worked!! I got a couple of error messages, but they were a result of my syntactical errors in editing the action. I now have two separate actions to post to separate blogs under the same ID. Thank you again.

1 Like