Sample: Create an Integration with Twitter
This sample Twitter integration connects with the Twitter API and pulls relevant information by searching for a specific hashtag.
This integration is intended to provide an example of how you might choose to integrate with Twitter and should not be used in a production org.
Create a Twitter Application
An administrator must create a Twitter application to give the integration setting access to basic information from Twitter.
- Go to https://apps.twitter.com/.
- Log in with your Twitter account.
- Click Create New App.
- Populate
Name
,Description
, andWebsite
. - Click Create Your Twitter Application.
- Make note of the
Consumer Key
andConsumer Secret
.
Create Callout Integration Setting
- In the tab bar, click App Launcher, or in Salesforce Classic, click Nimble AMS, Staff View, Button, All Tabs.
- Click Integration Settings.
Click New.
In
Record Type
, selectCallout
.- In
Name
, enter a name in pascal case to identify the integration. - In
Description
, enter a description you can reference to understand the integration setting's purpose. In
Authentication Key
, enter a secure authentication key.We recommend using a unique 256-bit WEP authentication key for each integration setting. You can generate a random key, using a random key generator such as Random Key Generator (external).
In
Class
, enterSampleCalloutIntegration
.Status
is populated.If you want to record log detail for the integration setting, in
Logging Level
, select the log detail level. More information about the level of detail stored can be found on the Understanding Logging Level page.To set the number of days the integration callout is retained within Nimble AMS, set the Archive Schedule Information:
In
Archive Format
, enter the Apex scheduler expression. This field controls the frequency with which the archiving scheduled job is executed. See Apex Scheduler (external) to learn more about Apex schedules.In
Archive Completed Storage Days
, enter the number of days the integration callouts with a Status ofCompleted
will be retained.In
Archive Failed Storage Days
, enter the number of days the integration callouts with a Status ofFailed
will be retained.Deselect
Archive Active
.The archiving scheduled job must be created before it is activated. Any changes to the archiving scheduled job must be made while the archiving job is inactive.
Click Save.
Click Edit.
Select
Archive Active
.Click Save.
Create Callout Integration Parameters
- Click Integration Settings.
- Select a list view—like All Inbound Integrations—and click Go!
- Click the name of the integration setting to which you want to add an integration parameter
Create the Endpoint integration parameter:
From the Inbound Integration Settings related list, click New Integration Parameter.
Integration Setting
is populated.In
Key
, enterEndpoint
.In
Value
, enterhttps://api.twitter.com/1.1/search/tweets.json?q=%23
Click Save.
Create the Hashtag integration parameter:
From the Inbound Integration Settings related list, click New Integration Parameter.
Integration Setting
is populated.In
Key
, enterHashtag
.In
Value
, enter the hashtag value for which the integration will search. For example, if you want to search for #Awesome, enterAwesome
.Click Save.
Create the Key integration parameter:
From the Inbound Integration Settings related list, click New Integration Parameter.
Integration Setting
is populated.In
Key
, enterKey
.In
Value
, enter theConsumer Key
for your Twitter Application.Click Save.
Create the Secret integration parameter:
From the Inbound Integration Settings related list, click New Integration Parameter.
Integration Setting
is populated.In
Key
, enterSecret
.In
Value
, enter theConsumer Secret
for your Twitter Application.Click Save.
Create Integration Callout Worker
Administrators must create an integration callout worker to build and send the request to the third-party API. During the communication process, the integration callout worker saves the Request and Response on the integration callout for each execution.
- In the tab bar, click App Launcher, or in Salesforce Classic, click Nimble AMS, Staff View, Button, All Tabs.
- Click Integration Settings.
- Select a list view—like All Callout Integrations—and click Go!
- Click the name of the integration setting to which you want to add an integration callout worker.
From the Integration Callout Workers related list, click New Integration Callout Worker.
Integration Setting
is populated.In Worker Schedule, enter the Apex scheduler expression. This field controls the frequency with which the integration callout worker is executed. See Apex Scheduler to learn how to configure this field.
Deselect Worker Active.
The integration callout worker must first be created before it is activated. Changes to the integration callout worker must be made while the integration callout worker is inactive.
Click Save.
- Click Edit.
Select Worker Active to activate the integration callout worker.
- Click Save.
Create Integration Response Worker
Administrators must create an integration response worker to collect integration callouts with the Status of Pending
. The integration response worker processes the response and updates the Status of the integration callout to Completed
or Failed
. The IntegrationSetting Apex class processes the response and determines whether the Status of the integration callout is set to Completed
or Failed
.
- In the tab bar, click App Launcher, or in Salesforce Classic, click Nimble AMS, Staff View, Button, All Tabs.
- Click Integration Settings.
- Select a list view—like All Callout Integrations—and click Go!
- Click the name of the integration setting to which you want to add an integration response worker.
From the Integration Response Workers related list, click New Integration Response Worker.
Integration Setting
is populated.In
Worker Schedule
, enter the Apex scheduler expression. This field controls the frequency with which the integration response worker is executed. See Apex Scheduler to learn how to configure this field.In
Worker Batch Size
, enter the number of integration callouts with a Status ofPending
the integration response worker will processes at a time.Deselect
Worker Active
.The integration response worker must first be created before it is activated. Changes to the integration response worker must be made while the integration response worker is inactive.
Click Save.
- Click Edit.
Select
Worker Active
to activate the integration response worker.- Click Save.