While Ocoya offers a direct Zapier integration for many common workflows, you might encounter situations where you need more specific control or want to leverage API features not yet available in the standard integration. This guide demonstrates how to use Zapier's "Webhooks by Zapier" feature to send a POST request directly to the Ocoya API to create a new post.
Start Your Zap:
Log in to your Zapier account and create a new Zap.
Set up the Trigger step based on the event you want to initiate the post creation (e.g., New row in Google Sheets, New message in Slack, etc.). Configure and test your trigger as needed.
Add the Webhook Action Step:
Click the "+" icon to add an Action step.
Search for and select Webhooks by Zapier.
Choose the Action Event:
Under "Action Event", select POST.
Click Continue.
Configure the POST Request - URL:
You need the endpoint URL for creating posts from the Ocoya API documentation. Navigate to docs.ocoya.com > Endpoints > Posts > Create post.
Copy the POST URL provided: https://app.ocoya.com/api/_public/v1/post
Paste this URL into the URL field in Zapier.
The "Create post" endpoint requires your workspaceId as a query parameter. Append ?workspaceId= to the end of the URL you just pasted.
Now, find your Ocoya Workspace ID:
Go to your Ocoya account.
Click your Workspace name (top left) > Workspace settings.
Navigate to the General tab.
Scroll down to the bottom to find your API workspace id. Copy it.
Go back to Zapier and paste your copied Workspace ID directly after the =.
The final URL should look similar to this (replace YOUR_WORKSPACE_ID with your actual ID):
βhttps://app.ocoya.com/api/_public/v1/post workspaceId=YOUR_WORKSPACE_ID
Configure the POST Request - Payload:
Change the Payload Type dropdown from "Form" to Json.
In the Data section, you need to define the body of your request based on the parameters listed in the Ocoya API Documentation under "Create post" > "Request parameters".
For a simple text post (as shown in the video), add a field for caption:
In the left input box under "Data", type caption.
In the right input box, enter the text for your post. You can type static text or map data from your Zapier Trigger step. (Example shown: "a post using Ocoya + Zapier").
Note: Refer to the API docs for other required/optional parameters like mediaUrls, socialProfileIds, scheduledAt etc., and add them here as needed. You can find your socialProfileIds in 'Socials'.
Configure the POST Request - Headers:
Scroll down in the Zapier configuration panel. You need to add an authentication header.
Find the Headers section.
In the left input box (header name), type X-API-Key. (You can verify this name in the Ocoya API docs under Fundamentals > Authentication).
Now, you need your Ocoya API Key:
Go back to your Ocoya Workspace settings.
Navigate to the Developers section > API.
Click Create new token.
Give it a recognizable name (e.g., "Zapier Webhook"). Click Create.
Important: Ocoya will show your API Key only once. Copy it immediately and store it securely.
Go back to Zapier and paste your copied API Key into the right input box next to X-API-Key.
Test the Webhook Step:
Ensure "Wrap Request In Array" is set to No and "Unflatten" is set to Yes (these are defaults but good to check).
Click Continue.
Zapier will show a summary of the request. Click Test step.
Zapier will send the request to Ocoya. If successful, you'll see a success message and response data (like a postGroupId).
Verify in Ocoya:
Go to your Ocoya account and navigate to the Planner or Posts section.
You should see the new post created by the Zapier test (e.g., "a post using Ocoya + Zapier"). It will likely be a draft unless you provided socialProfileIds or scheduledAt data.
Publish Your Zap:
If the test was successful and the post appeared in Ocoya, you can now Publish your Zap in Zapier.
Your Zap is now active! Whenever your trigger event occurs, Zapier will use the webhook to send the data directly to Ocoya's API and create a post according to your configuration.