Using Web Services to Post to Twitter

<p class=”alert alert-info”>This how-to article will help administrators to use a Workflow Web Service in TDAdmin to create a post to a Twitter account. The user must have the Admin or App Admin permissions to create this.</p>

Overview

This article serves as an example of adding a ticket workflow step that will post information to Twitter. This could be used to do something like sending out details on a Problem or Major Incident that arises within an IT Department and wants to inform their audience of details pulled from the ticket.

 

Learn more about setting up and using web service steps.

This web service requires using another service called Zapier, a tool that helps move info between web applications.

There are several steps needed to set up a workflow step that will post to Twitter:

  1. Create a Zapier account.
  2. Set up a Zap.
  3. Create the web service method.
  4. Test the method.

Creating a Zapier Account 

Sign up for a free Zapier account which provides you with 100 simple two-step Zaps (trigger + action) per month.

Setting Up a Zap in Zapier 

Zaps are what connect a trigger and assign a corresponding action.

 

Choose to create a new Zap and fill out the information to use a Catch Hook with Webhooks by Zapier as the trigger and Create a Tweet in Twitter as the association action step (will ask to link the account you want post to Twitter as).

 

This will have a test process where you have to actually POST JSON to the Zapier, validate it and choose the field you from your JSON to put into a Tweet template after receiving a valid POST.

Catch hook, create tweet

Once your Zap is up, tested and live, make sure to record your Zap URL as that is what you’ll need to put in TDX. It will look something like this: 
https://hooks.zapier.com/hooks/catch/XXXXXXX/YYYYYY/ 

 

Creating the TeamDynamix Web Service Method

This example will create a very simple post to Twitter and includes the ID of the current ticket. 

 

Note that Zapier is very strict about JSON syntax and both property names and values must be quoted.

 

To create a web service method that will post to Twitter:

  1. In TDAdmin, click Applications in the left navigation.
  2. Click the Name of the Ticketing application you want to add this workflow step to.
  3. Click Workflow Web Services in the left navigation, then click Web Service Methods.
  4. Click the +New button.
  5. On the New Web Service page, enter a Name for the method. This name will show up in the workflow builder
  6. Provider: Create a provider which is the URL of the Zapier Hook URL (obtained above). 
    Authentication: No authentication is required to post to Zapier URLs. Leave the dropdown blank. 
    Method (verb): POST 
    URL: This should be prefilled from the provider URL (which is the web hook URL) and should not need to be changed. 
    Headers:  
  7. Key: content-type 
    Value: application/json 
  8. Parameters: 
  9. TicketID - Integer - From Ticket – ID 
  10. Body:  

  11. "text":"Ticket ID {TicketID} started the approval workflow!" 

 

Testing the Method

You will need a ticket ID number to use for testing. Be sure to only use the fields and properties you sent to Zapier in your test.

To test the new method, in the web service:

  1. Click the Test Request button.
  2. In the OrigTicketId column, enter any number
  3. Click the Send button
  4. Verify the output

This web service method can now be included in a ticket workflow. Learn more about adding a web service step to a workflow.

Details

Article ID: 49813
Created
Wed 3/7/18 5:47 PM
Modified
Fri 6/25/21 1:01 PM