Skip to main content

Setting up Twitter integration and automating Twitter posts with content updates

You can integrate Twitter with Kuroco to implement various automated Twitter posting functions, including automated posting to Twitter after content updates, Twitter API posting, and Twitter's built-in autopost function.

This tutorial describes how to set up Twitter integration and automate Twitter posts with Kuroco content updates.

caution

Due to Twitter specification updates, the method of API key retrieval may differ from this tutorial. Please visit the Twitter developer portal for the latest information.

Twitter settings

Sign up for an account

Before integrating Twitter into Kuroco, you must have a Twitter account. If you have not done so yet, please sign up on Twitter.

info

Visit Twitter's Help Center for more information on how to sign up.

Create an application on the Twitter developer portal

Next, you need to obtain a Twitter API key. Navigate to the Twitter developer portal and click [Sign up].

Image from Gyazo Enter your name and country in the essential access form, and select [Exploring the API] for "What's your use case?".

Image from Gyazo Review the Developer Agreement and Policy, check the box and click [Submit].

Image from Gyazo You will receive a verification e-mail in the inbox associated with your account.

Image from Gyazo Open the message and click [Confirm your email].

Image from Gyazo Enter your desired app name and click [Get keys].

Image from Gyazo You will be redirected to a screen displaying your API key.

Image from Gyazo Click [Skip to dashboard].

Image from Gyazo You will see a dialog entitled "Did you save your Keys and Tokens?". Copy them down and then click [Yes, I saved them].

Image from Gyazo You will be redirected to the dashboard.

Image from Gyazo In the sidebar menu, select [Projects & Apps]. The app you created earlier will be listed here.

Image from Gyazo

Configure app permissions

The default app permission is set to "Read Only", and you need to change it to "Read and Write".

To do this, first click [Set up] under "User authentication settings".

Image from Gyazo Enable the OAuth 1.0a option.

Image from Gyazo

Under "App permissions", select [Read and write].

Image from Gyazo Enter the following information under "GENERAL AUTHENTICATION SETTINGS" and click [Save].

FieldSample entryDescription
Callback URI / Redirect URLhttps://example.com/twitter-to-kurocoEnter the callback URI.
Website URLhttps://example.comEnter your site URL here.

Image from Gyazo

info

For more information about callback URLs, see Twitter Developer Apps: Callback URLs.

Re-issue your API key and secret

Click the [Keys and tokens] tab.

Image from Gyazo Under "Consumer Keys", click [Regenerate] next to "API Key and Secret".

Image from Gyazo In the confirmation dialog, select [Yes, regenerate].

Image from Gyazo This will generate a new API key and API key secret. Copy the contents, then click [Yes, I saved them].

Image from Gyazo

Generate your access token and secret

Next, click the [Keys and tokens] tab again.

Image from Gyazo Under "Authentication Tokens", click [Generate] next to "Access Token and Secret".

Image from Gyazo This will generate a new access token and access token secret. Copy the contents, then click [Yes, I saved them].

Image from Gyazo

Kuroco settings

Next, enter the Twitter key you obtained earlier in Kuroco.

Enter your Twitter keys

In Kuroco's admin panel sidebar, select [External system integration] -> [Twitter].

Image from Gyazo Fill in the information you copied earlier.

FieldDescription
EnableCheck the "Enable" box.
API KeyEnter the API key you copied.
API Key SecretEnter the API key secret you copied.
Access TokenEnter the access token you copied.
Access Token SecretEnter the access token secret you copied.

Image from Gyazo Verify that your keys have been successfully registered.

Image from Gyazo

Configure the content structure

Next, define the content to be integrated with Twitter.

For this tutorial, we will use the existing content structure "Announcements". You will need the content structure ID, which you can obtain from the admin panel.

In the left sidebar menu, click [Content structure].

Image from Gyazo

On the content structure list screen, verify the ID for "Announcements".

Image from Gyazo

Note down the ID (19 in this case) for use later.

Create a custom function

The next step is to create a new custom function.

In the left sidebar menu, select [Operation] -> [Custom function].

Image from Gyazo

On the Custom function list screen, click "Add" in the upper right corner.

Image from Gyazo

Input the following information in the Custom function editor:

FieldDescription
TitleTwitter autoposting
Identifierkuroco_to_twitter
Used by component(s)Trigger: After adding content
Text box: 1
ProcessPaste the source code below into the text area.
{assign var=url value="`$smarty.const.ROOT_URL`/article/`$topicsData.slug`"}
{twitter_post_message var=res text="Content updated! `$url`"}

Image from Gyazo After you are done, click [Add] to save the new custom function.

Operation check

Finally, verify that when you post in "Announcements", the same content set up in the custom function will also be posted to Twitter.


Support

If you have any other questions, please contact us or check out Our Slack Community.