Integrate Ayrshare with Notion
Example code of Notion social posting integration:
In Notion, create a database in table view with the following column names and column types:
Postas Title column type (you don’t have a choice here with the column type)
Platformsas Multi Select column type with values:
Imagesas Files & Media column type .
Profile Keysas Text column type.
Statusas Text column type.
Schedule Dateas Date column type with Date Format Month/Day/Year, Time Format 24 Hours, and include time
Notion Database Example
These fields will be used in the script specified later in this page. Please note, some social networks "platforms" require images or videos. For example, Instagram requires and image or video and TikTok requires a video. Please see the endpoints for the different networks.
We need some sample data to test the post. Here is a suggestion:
Profile Keys: If you are on the Business Plan and want to post to a client's profile, enter their Profile Key. Otherwise, leave blank.
Status: Enter "pending". The script only grabs records that are set to "pending". Please be sure "pending” is lowercase.
Schedule Date: Leave blank since we'll just test immediate posting right now. Later you can select a future date to schedule the post.
You can name the integration "Ayrshare" to identify it easily and choose the appropriate workspace that will have the post data.
Finally, the default capabilities that have been selected for you will do. Submit to create the integration.
If successful, an internal integration token will be available to you. Note this for future steps in this page.
And gather your Notion integration token.
Page with Internal Integration Token
Open the Notion database that you created earlier. Click on the ellipsis on the top right corner of the page and go to Add Connection.
Here you can search for the internal integration you created in the previous step by the name you chose for it.
Once you click on the internal integration, you have now connected this Notion database to the integration.
You can now run a script in your local environment that will read data from the Notion database and make a post through the Ayrshare API for each row in it with status of "pending".
Make sure to set the following environment variables used in the script:
API_KEY: this is
API Keyyou get from Ayrshare. This is the primary API Key for your Ayrshare primary profile.
NOTION_DATABASE_ID: Open the database you created earlier in this page and get the database ID from the URL.
NOTION_KEY: internal integration token from earlier.
- Clone the repository:
git clone https://github.com/ayrshare/notion
- cd into the notion directory and run
- Update the
.envfile with your Ayrshare
If successful, all "pending’" status columns will be changed to "success’" and the posts will have been made to the appropriate social networks.