import { MobilizeHub } from "@mobilizehub/api";const mobilizehub = new MobilizeHub({ apiKey: "<MOBILIZEHUB_API_KEY>" });const {result, error } = await mobilizehub.post.list({ orgId: "org_1234567890",});if (error) { // handle potential network or bad request error // a link to our docs will be in the `error.docs` field console.error(error.message); return;}// process requestconsole.log(result);
Find out more about the SDK in our documentation here.
Also, the SDK has been updated to include the following method:
Copy
import { MobilizeHub } from "@mobilizehub/api";const mobilizehub = new MobilizeHub({ apiKey: "<MOBILIZEHUB_API_KEY>" });const organization = await mobilizehub.organization.retrieve({ orgId: "org_1234567890",});if (organization.error) { // handle potential network or bad request error // a link to our docs will be in the `error.docs` field console.error(organization.error.message); return;}// process requestconsole.log(organization.result);
Find out more about the SDK in our documentation here.
import { MobilizeHub } from "@mobilizehub/api";const mobilizehub = new MobilizeHub({ apiKey: "<MOBILIZEHUB_API_KEY>" });const contact = await mobilizehub.contact.create({ email: "ryan@mobilizehub.com", orgId: "org_1234567890",});if (contact.error) { // handle potential network or bad request error // a link to our docs will be in the `error.docs` field console.error(contact.error.message); return;}const { result, error } = await mobilizehub.petition.addSignature({ petitionId: "pet_1234567890", orgId: "org_1234567890", contactId: contact.id,});if (error) { // handle potential network or bad request error // a link to our docs will be in the `error.docs` field console.error(error.message); return;}// process requestconsole.log(result);
Find out more about the SDK in our documentation here.
A basic sign-up example using the MobilizeHub SDK.Causes is an example of a sign-up form using the MobilizeHub API built with React Router V7Find out more about the example here and deploy it to Vercel.
This marks the public release of the MobilizeHub SDK with the following methods:
Contacts: Create, retrieve, update, and delete contacts.
Lists: Create, retrieve, delete, add contacts and remove contacts for lists.
To authenticate your requests, you will need to generate an API key in your organization’s dashboard as the apiKey.Get started with the SDK by installing it:
Copy
npm install @mobilizehub/api
Find out more about the SDK in our documentation here.
POST methods are used for creating and updating deleting data, while DELETE methods are used for removing data.
Data is passed as application/json in the request body.